You mean that this connection was in opened idle state > 8 hours before you called Close(), don't you? This is a designed behaviour in this case. Please call Close() to put connection to the pool after every its usage.tduong wrote:Step 2 - Instantiates a MySqlConnection using connection string 2, and closes it. This step can take several hours. For the particular exception that we encountered, this step took > 8 hours, which is (surprise) the default wait_timeout value as set on the msyql server.
Probably, you have retrieved connection from the pool after it was terminated by the server for some reason and before the next validation of it by the pool manager. As we mentioned above, connection in the pool is validated every ~60 seconds. And it is not validated before retrieving because it will affect the performance. You can use the Ping() method to validate it yourself.tduong wrote:Exception occurs in step 3 when step 2 > wait_timeout. The server terminates connection 1, but the pool still returns this connection. You can even call "MySqlConnection.Open()" successfully, but when a command is executed, we get the infamous "lost connection to MySql server during query".
We have implemented the MySqlConnection.ClearAllPools(bool force) method in the 5.70 version of dotConnect for MySQL. If force=true, all pools are cleaned without timeout. Here is this thread: http://www.devart.com/forums/viewtopic.php?t=17229.tduong wrote:Another alternative would be for us to invalidate the pool after Step2, but, as you said before, there is a 30 second wait time out.
Please tell me if I've got something wrong in your post.