Our server is set to disconnect idle sessions, so it is a 'normal'
occurrence to get this error. Ping() doesn't appear to help, so I use a
set of macros to handle exceptions and do retry. Below is how I use
them. I can send them to you if your interested.
And here's how I use them
END_TRY_SQL( "DeletePlayer" )
As an aside, did you init mysql on each thread? (mysql_thread_init,
From: Urscheler, Roger (COM Chantry CA)
Sent: Wednesday, January 17, 2007 10:33 AM
To: Bill K
Cc: MySQL++ Mailing List
Subject: RE: Lost connection to MySQL server during query
I am using MySql++ 2.1.1 and MySql 5.1.9. Do you know whether this is a
mysql++ or mysql problem?
Mine is definitly also no timeout issue. Thanks for your workaround, but
we should figure out what the root cause of this is.
From: Bill K [mailto:reply@stripped]
Sent: Wednesday, January 17, 2007 10:25 AM
To: Urscheler, Roger (COM Chantry CA)
Cc: MySQL++ Mailing List
Subject: Re: Lost connection to MySQL server during query
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
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
- Bill K.
Urscheler, Roger (COM Chantry CA) wrote:
> I have a multi-threaded application with a threadpool where each
> thread has its own connection (and query and row objects). I did set
> 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?
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus