Bug #8954 ObjectDisposeException in MySQLPoolManager
Submitted: 4 Mar 2005 18:55 Modified: 11 Nov 2005 8:00
Reporter: Jean Bédard Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:1.0.4 OS:Windows (Windows XP)
Assigned to: Bugs System CPU Architecture:Any

[4 Mar 2005 18:55] Jean Bédard
Description:
There is an ObjectDisposedException that occur when to Close an active connection to a MySQL server, dispose the MySQLConnection object, create a new MySQLConnection with the same ConnectionString and Open it. If the MySQL server does not response at this time, then when the Open method is call, the MySQLPoolManager sees that it already has a MySQLPool object associated with the specified ConnectionString but the writer object of the NativeDriver object in the pool is disposed.

See "How to repeat" section for details!
Jean Bédard

How to repeat:
1) Open a MySQLConnection on a running server
2) Shutdown the MySQL Service
3) Restart the MySQL Service
4) See that your connection isn't valid anymore so do the following to retry a new connection
   5) Call MySQLConnection.Close()
   6) Call MySQLConnection.Dispose()
   7) Create a new MySQLConnection with the same ConnectionString
   8) Call MySQLConnection.Open()

   ** At this point you see that the NativeDriver object from the existing pool
   contains a PacketWriter with a disposed stream.
   Because MySQLPoolManager contains a static Hashtable of pool, once the
   connection is lost, there is nothing to do (Severity 2)

Suggested fix:
What I did to get rid of this problem is that I added a static function in the MySQLPoolManager.  This function simply clear the pools hashtable.  This function is call in MySQLConnection.Close() and/or MySQLConnection.Dispose()
[14 Jul 2005 15:37] Reggie Burnett
I am  unable to reproduce this.  Can you post a small test case or app that shows this?
[18 Jul 2005 16:01] Jean Bédard
Try this project to reproduce the bug

Attachment: DebugMySQL.zip (application/x-zip-compressed, text), 9.56 KiB.

[18 Jul 2005 16:03] Jean Bédard
Simply use root user to connect to the mysql database (not modifications... don't worry!) Then restart the service, then click on the seconde button, the Ping() will fail so I close the connection and re-open it..... it just blow up!!

Thanks.
Jean Bédard
[18 Jul 2005 16:03] Jean Bédard
Oh... did you get the file ??
[11 Oct 2005 8:00] Vasily Kishkin
Thanks for test case. I tested on 1.0.6 and got the follow message box:

Connection to server is invalid, going to reconnect

As far as I can understand it is not bug message. Am I right ?
[12 Nov 2005 0: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".