Bug #83087 Stackoverflow exception when mysql service is gone
Submitted: 21 Sep 2016 21:50 Modified: 23 Oct 2016 12:07
Reporter: Vladimir Riadchenko Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:6.9.9 OS:Windows
Assigned to: Assigned Account CPU Architecture:Any

[21 Sep 2016 21:50] Vladimir Riadchenko
Description:
I'm using MySQL server 5.7.14-log on Windows server 2008 x64
Application is .net service which using .net connector 6.9.9 with pooling option enabled
Sometimes application crashing with stackoverflow exception

How to repeat:
Make some simple app which periodically connect to local mysql with .net connector, make simple select (not matter which) and close connection.
I'm using Shared memory protocol (I don't know maybe it's important)
You must enable pooling option in connection string
In some time restart mysql service - application must crash with stackoverflow exception.

I've catch stacktrace for you

        ....
 	MySql.Data.dll!MySql.Data.MySqlClient.NativeDriver.HandleException(MySql.Data.MySqlClient.MySqlException ex)	
 	MySql.Data.dll!MySql.Data.MySqlClient.NativeDriver.ExecutePacket(MySql.Data.MySqlClient.MySqlPacket packetToExecute)	
 	MySql.Data.dll!MySql.Data.MySqlClient.NativeDriver.Close(bool isOpen)	
 	MySql.Data.dll!MySql.Data.MySqlClient.Driver.Dispose(bool disposing = true)	
 	MySql.Data.dll!MySql.Data.MySqlClient.Driver.Close()	
 	MySql.Data.dll!MySql.Data.MySqlClient.NativeDriver.HandleException(MySql.Data.MySqlClient.MySqlException ex)	
 	MySql.Data.dll!MySql.Data.MySqlClient.NativeDriver.ExecutePacket(MySql.Data.MySqlClient.MySqlPacket packetToExecute)	
 	MySql.Data.dll!MySql.Data.MySqlClient.NativeDriver.Close(bool isOpen)	
 	MySql.Data.dll!MySql.Data.MySqlClient.Driver.Dispose(bool disposing = true)	
 	MySql.Data.dll!MySql.Data.MySqlClient.Driver.Close()	
 	MySql.Data.dll!MySql.Data.MySqlClient.NativeDriver.HandleException(MySql.Data.MySqlClient.MySqlException ex)	
 	MySql.Data.dll!MySql.Data.MySqlClient.NativeDriver.ExecutePacket(MySql.Data.MySqlClient.MySqlPacket packetToExecute)	
 	MySql.Data.dll!MySql.Data.MySqlClient.NativeDriver.Close(bool isOpen)	
 	MySql.Data.dll!MySql.Data.MySqlClient.Driver.Dispose(bool disposing = true)	
 	MySql.Data.dll!MySql.Data.MySqlClient.Driver.Close()	
 	MySql.Data.dll!MySql.Data.MySqlClient.NativeDriver.HandleException(MySql.Data.MySqlClient.MySqlException ex)	
 	MySql.Data.dll!MySql.Data.MySqlClient.NativeDriver.ReadOk(bool read)	
 	MySql.Data.dll!MySql.Data.MySqlClient.NativeDriver.Ping()	
 	MySql.Data.dll!MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()	
 	MySql.Data.dll!MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()	
 	MySql.Data.dll!MySql.Data.MySqlClient.MySqlPool.GetConnection()	
 	MySql.Data.dll!MySql.Data.MySqlClient.MySqlConnection.Open()
[21 Sep 2016 22:49] MySQL Verification Team
Please provide a repeatable code test case (private if you wish). Thanks.
[22 Sep 2016 7:10] Vladimir Riadchenko
Sample app

Attachment: mysqlTestBug.zip (application/zip, text), 706.80 KiB.

[22 Sep 2016 7:15] Vladimir Riadchenko
Just run app, wait some time (10 sec for sample) and stop mysql service.

You will see repeatable errors about lost connection and after 5 seconds stackoverflow exception and app crash.

It's important to use shared memory protocol because on tcp all works fine and connection restoread after restart mysql without stackoverflow exception.
[22 Sep 2016 12:36] Chiranjeevi Battula
Hello  Vladimir,

Thank you for the bug feedback.
I could not repeat the issue at our end using your test case with Visual Studio 2013, Connector/NET 6.9.9 and MySQL 5.7.15 version.

Thanks,
Chiranjeevi.
[22 Sep 2016 12:37] Chiranjeevi Battula
Screenshot

Attachment: 83087.JPG (image/jpeg, text), 52.64 KiB.

[22 Sep 2016 13:04] Vladimir Riadchenko
1. Did you use shared memory protocol and run application on the same machine as server? Shared memory protocol is important. 

2. How long have you been waiting after stopping the server?

3. Try change some lines of code because you use VS 2013

 Console.WriteLine("Result : " + cmd.ExecuteScalar());

and

 Console.WriteLine("Some error : " + ex.Message);

4. Which target framework you use?

I've tested on 3 different servers and result the same
[23 Sep 2016 12:07] Chiranjeevi Battula
Hello  Vladimir,

Thank you for the bug feedback.
Yes I used shared memory protocol and tested with suggested time lines as you said and I used EF 6.1.3.

Thanks,
Chiranjeevi.
[23 Sep 2016 12:07] Chiranjeevi Battula
Screenshot

Attachment: 83087_1.JPG (image/jpeg, text), 241.20 KiB.

[24 Oct 2016 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".