New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Microsoft.Data.SqlClient.SqlConnection.GetOpenTdsConnection throws random exception invalid operation, connection closed #1664
Comments
@daxu7509 can you post a simple repro that we can investigate at our end? |
Also, it would be nice if we can have the error stack trace please. |
hi @JRahnama ,
} One strange thing is that when this error happened on our azure testing site, our appinsight logged no request (as the exception was logged around 2am and no one was testing that). AppInsight shows this: |
@daxu7509 what connection string properties are being used? |
"data source=xxxxx.xxxxxx7.database.windows.net;initial catalog=xxxx;user id=xx;Min Pool Size=30;Max Pool Size=300;TimeOut=25;TransparentNetworkIPResolution=False;ApplicationIntent=ReadOnly;TrustServerCertificate=true" |
@daxu7509 just to confirm a theory, if you take out |
hi @JRahnama I never tried this, don't know. Can I ask why you think that could make some difference? The most used UDT are these two:
|
@daxu7509 seems like the reader is disposed before getting the results back in an async call. When the reader is disposed the |
in the production code, we wrap connection and command in polly retry, like this: using (var cmd = new SqlCommand
|
does that have any impact on the problem we see? |
oh, dear. I see where you coming from now. @JRahnama I will remove CommandBehavior.CloseConnection and see what happens. With the polly retry, as long as I put our things in using bracket, that should still handle all dispose and connection close of SqlConnection, SqlCommand and SqlDataReader? Do I need to do something special? |
Correct. The Closing the issue due to inactivity. Feel free to open a new issue or comment here if there are more to discuss. |
Describe the bug
posted on stackoverflow as well
I was using System.Data.Client and see above error, according to this fix, I should upgrade to Microsoft.Data.Cient, so I did that (.net framework 4.8 windows running environment)
However, from the log, I still see the same error, the only difference is it was System.Data.SqlClient.SqlConnection.GetOpenTdsConnection, now it is Microsoft.Data.SqlClient.SqlConnection.GetOpenTdsConnection.
For the fix mentioned in the previous ticket, does it apply to .net framework 4.8 on an azure windows app service?
The text was updated successfully, but these errors were encountered: