List:MySQL++« Previous MessageNext Message »
From:Roger (COM Chantry CA) Urscheler Date:January 17 2007 4:52pm
Subject:RE: Lost connection to MySQL server during query
View as plain text  
Thanks for your reply. Yes I am interessted in your marcos.

I am not sure what you mean by init mysql. All I do is instantiate a
mysqlpp::Connection object per thread and call its connect() function. I
don't see any mysqlpp interface to initialize the thread.

I see following comment in mysql++ 2.1 whishlist:

          Need some way to call mysql_thread_init() and
          mysql_thread_end() per thread.  Also, work in some way to
          call mysql_thread_safe() automatically, perhaps the first
          time through the function that calls mysql_thread_init().
          If the C API library reports that it is not thread-safe,
          report this to the caller, perhaps through an exception,
          or simply by refusing to init more than one thread.

Does mysql++ 2.2 provide more functionallity regarding threading? According
to Bill's reply, he has the same problem with mysql++ 2.2. 

Roger

-----Original Message-----
From: Jim Wallace [mailto:jwallace@stripped] 
Sent: Wednesday, January 17, 2007 11:34 AM
To: MySQL++ Mailing List
Subject: RE: Lost connection to MySQL server during query

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

	CHECK_CONNECTION

	BEGIN_TRY_SQL

.....

	END_TRY_SQL( "DeletePlayer" )

As an aside, did you init mysql on each thread? (mysql_thread_init,
etc.)


-----Original Message-----
From: Urscheler, Roger (COM Chantry CA)
[mailto:roger.urscheler@stripped]
Sent: Wednesday, January 17, 2007 10:33 AM
To: Bill K
Cc: MySQL++ Mailing List
Subject: RE: Lost connection to MySQL server during query

Thanks Bill,

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.

Roger

-----Original Message-----
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

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
>
>
>   

-- 
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus To unsubscribe:
http://lists.mysql.com/plusplus?unsub=1




-- 
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:
http://lists.mysql.com/plusplus?unsub=1
Thread
Lost connection to MySQL server during queryCOM Chantry CA)17 Jan
  • Re: Lost connection to MySQL server during queryBill K17 Jan
  • Re: Lost connection to MySQL server during queryManuel Jung17 Jan
  • Re: Lost connection to MySQL server during queryManuel Jung17 Jan
  • Re: Lost connection to MySQL server during queryManuel Jung17 Jan
RE: Lost connection to MySQL server during queryCOM Chantry CA)17 Jan
RE: Lost connection to MySQL server during queryJim Wallace17 Jan
RE: Lost connection to MySQL server during queryCOM Chantry CA)17 Jan
  • Re: Lost connection to MySQL server during queryWarren Young17 Jan