-
Notifications
You must be signed in to change notification settings - Fork 332
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
Possible "zombie" connections in high-contention scenarios with Cancellation #469
Comments
I can (sometimes, not reliably) reproduce what I think you're talking about by running this code thousands of times in parallel:
The first time I run it, most of the connections time out with a I can't seem to reproduce it when logging is enabled, which may indicate some kind of race condition or concurrency problem (that's avoided by adding the overhead of logging). This needs further investigation, but it's looking like a pooling bug in MySqlConnector. |
I've identified (one) problem: if it is taking a long time to retrieve a connection from the pool (e.g., high contention), the |
Fixed in 0.38.0. |
I'm building a service that works with a high load of database operations (ASP.NET Core 2.0 Web API). The requests can be large and simultaneous. I'm using TPL Dataflow as a backbone for the processing logic.
In a situation where cancellations start to occur, either because of connection timeouts or because a request is aborted (the
RequestAborted
CancellationToken
is passed to all the underlying tasks)ServerSession
s appear to get "lost" after being returned to theConnectionPool
. Eventually a stream of "Too Many Connections" errors comes back from the server.Once the dust settles (all concurrent requests finish one way or another) the idle sessions are cleaned up--but there will still be many open, sleeping connections in the pool. These are never cleaned up until the process itself recycles, rendering the server itself useless. Sometimes it results in the dreaded "host blocked because of many errors; run flush_hosts". The last I hear from a zombie'd
ServerSession
is a "Pool(n) receiving Session... back".Some things remaining for me to check:
using() {...}
.The text was updated successfully, but these errors were encountered: