Bug #85215 Broken connection will be enqueued into the idle pool which may cause problems
Submitted: 28 Feb 2017 3:25 Modified: 2 Mar 2017 5:35
Reporter: Yenan Wang Email Updates:
Status: Analyzing Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:6.9.9 and below OS:Windows
Assigned to: Assigned Account CPU Architecture:Any
Tags: broken connection, charset issue

[28 Feb 2017 3:25] Yenan Wang
Description:
According to the source code of connector/net,after Driver class created a new connection but before doing the Configuration operation or the operation have not been done completely,for example,the charset have not been set correctly,if an error occured this time(such as network issue,etc),an exception will be catched by the caller and when the caller invoking the Close method to close this broken imcompleted connection,it will be enqueued into the idle pool instead of being destroyed,or if the caller invoking the Dispose method,though it won't be enqueued into the idle pool,may lead to the connection leaking issue.

How to repeat:
Throw an exception manually after Drvier created the driver but before doing Configuration operation to emulate the network issue,a broken connection will be enqueued into the idle pool.

Suggested fix:
Driver creating and configuring should be atom operation like connector/J.
[28 Feb 2017 7:12] Chiranjeevi Battula
Hello Yenan Wang,

Thank you for the bug report.
Could you please provide repeatable test case(exact steps/sample project, sample connection details etc. - please make it as private if you prefer) to confirm this issue at our end?

Thanks,
Chiranjeevi.
[1 Mar 2017 6:13] Yenan Wang
Dummy code to repeat the situation.

Attachment: Program.cs (text/plain), 1.53 KiB.

[1 Mar 2017 6:15] Yenan Wang
Modify source code of MySql.Data to emulate the network issue.

Attachment: emulate_network_issue.png (image/png, text), 33.73 KiB.

[1 Mar 2017 6:18] Yenan Wang
I uploaded some dummy code to repeat the situation,but have to modify the source code of MySql.Data at first to emulate the network issue which may cause the problem.