Hello Roger,
I also have this problem, in a mult-threaded environment as you
described. I searched for a solution all over and went through all the
possibilities found on the mysql web site and others. It is definitely
not a timeout, as is said to be the most common reason for this
exception. I found no solution.
The work-around that I did was code the app to call ping() on the
connection object after that exception was thrown and then put the query
back in the query queue I have setup, which is then promptly processed
just fine. I even use the 'reconnect' and 'multi_statement' (needed
anyway for stored procedures) options. ping() will test and reconnect
the connection.
Not a fix by any means but at least it gets the job done, and just ever
so slightly slower, as like you said, it happens every 50 or 100 queries
or so.
Note: Using MySql 5.20 and the release of MySql++ 2.1.1. If I remember
correctly, this problem started happening when I started using stored
procedures.
- Bill K.
Urscheler, Roger (COM Chantry CA) wrote:
> Hi,
>
> I have a multi-threaded application with a threadpool where each thread has
> its own connection (and query and row objects). I did set the 'reconnect'
> and 'multi statement' options. Once a while (about every 50 or 100 queries)
> the connection to mysql is disconnected, the exception is "Lost connection
> to MySQL server during query". The 'reconnect' option reconnects
> automatically again, but still this query failed.
>
> Does anybody know about this problem?
>
> Thanks,
> Roger
>
>
>