-
Notifications
You must be signed in to change notification settings - Fork 285
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
NotSupportedException & InvalidOperationException for unknown reasons #459
Comments
Ah, and I see now you've ported to Microsoft.Data.SqlClient, so I'll try that instead. |
The issue also occurs in Microsoft.Data.SqlClient, so re-opening this issue. Updated stack traces: Issue 1
Issue 2
|
Hi @joshlang Could you please upload your repro app that we can take a look at to understand dependencies? |
Hi Cheena, Sorry, I'm not going to be able to do that for you any time soon. |
According to investigations, I wrote a sample application to test the issue. You can change the connection string and the number of records and number of run it on your own. |
The |
I'm lumping these two bugs into one, because I suspect they have the same root cause.
.NET Standard 2.1
Running in Azure AKS (linux)
System.Data.SqlClient version 4.8.1
Connecting to a tiny little sql azure database instance
We've run into two issues:
Issue 1
InvalidOperationException:
Invalid operation. The connection is closed.
^-- FOREVER!
Our code is exceedingly simple (flattened):
Stack trace:
Sometimes, it gets stuck in an infinite loop of doing that. In other words, every attempt to execute this code would throw that same exception.
We fixed it by wrapping it like this:
To me, it looks like a SqlConnection gets into an unstable state, gets put back into the pool and then explodes every time it's taken from the pool.
I'd say it looks like a race condition with a forgotten using statement or something... but... no. There aren't even any concurrent calls happening.
Issue 2
NotSupportedException:
A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 35 - An internal exception was caught) The WriteAsync method cannot be called when another write operation is pending.
Stack trace:
Our application insights shows 183 exceptions of
Issue 1
and only 4 exceptions of thisIssue 2
over the past 24 hours.I'm somewhat at a loss on how to debug this or provide more useful information. Open to suggestions.
The text was updated successfully, but these errors were encountered: