Bug #121334 Process Crash because of MySQL Driver
Submitted: 21 Sep 8:43 Modified: 29 Sep 17:49
Reporter: Tobias Heeb Email Updates:
Status: Need Feedback Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:26.7 OS:Windows
Assigned to: CPU Architecture:Any

[21 Sep 8:43] Tobias Heeb
Description:
This is a serious problem for us. The sql server availability gets checked inside a watchdog process. If that process crashes our watchdog is not working anymore. We can't do anything against it, because unhandled exceptions always crash the process. Please fix this and make it more reliable when there are exceptions inside such cleanup tasks. always catch exceptions inside such tasks or the application will crash.

Maybe the same problem as in Bug 112933.

 Unhandled exception: System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.KeyCollection.Enumerator.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at MySql.Data.MySqlClient.MySqlPoolManager.<CleanIdleConnections>d__34.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()

How to repeat:
Not possible. It just crashes sometimes. Otherwise we need to see the source code to get an idea about how to force this bad behavior.

Suggested fix:
Always use try catch inside tasks. Unhandled exceptions will crash the whole process.
[29 Sep 17:49] Jose Ramirez Ruiz
Hello Tobias,

Thank you for the bug report.

To help investigate and attempt a reproduction, we’ll need some additional information about your environment and how Connector/NET is being used. Without those details, the possible scope is too broad to identify a meaningful trigger. 

Please provide a sanitized connection string and the pooling settings that are being used, relevant connection/open-close or pool-clearing code, and any details about concurrency, server topology, or events that precede the crash. This will help us narrow down what may be failing and create a focused reproduction.

Regards,
Jose Ramirez