Re: [Sqlrelay-discussion] infinite loop
Brought to you by:
mused
|
From: David M. <dav...@fi...> - 2006-07-27 18:09:41
|
I ran into a similar problem a while back. The mysql api does
erroneously return a db has gone away error when certain queries are
run. I believe in some cases, a query returns multiple result sets and
the code has to decide which one to use, and the first one has that
error in it, or something like that. I think I ran into the issue when
trying to get stored functions working. There were lots of references
to similar problems on the web. I haven't come up with a good solution
yet, but it's on my list :/
Dave
dav...@fi...
On Sat, 2006-07-22 at 10:04 -0700, Devananda wrote:
> Dear List,
>
> sqlrelay is regularly getting stuck in an infinite reconnect loop on
> both servers on which I am running it right now. This seems to happen
> /most often/ after hours of inactivity, but not always. I've spent a
> week tracking this down, and have found where the MySQL C API is
> returning an unexpected result, and sqlrelay goes into an infinite loop
> because of it.
>
> First, the platform; sqlrelay pulled from CVS a few weeks ago, Fedora
> 4/5, and MySQL 5.0.18-5.0.22.
>
> The loop itself happens inside the sqlrconnection_svr::handleQuery
> function, where the inline comments clearly state "loop here to handle
> down databases" :) The problem is that the MySQL C API (erroneously?)
> returns an error message (CR_SERVER_GONE_ERROR) at mysqlconnection.C:542
>
> if ((queryresult=mysql_stmt_execute(stmt))) {
>
> As a result, sqlrconnection_svr::processQuery returns FALSE, which
> triggers sqlrconnection_svr::handleError, which can not returnError()
> because the database appears to be down, and therefor calls reLogIn().
> However, the database is not actually down, and sqlrelay reconnects to
> it easily, tries to rerun the initial query, and gets the same return
> value of CR_SERVER_GONE_ERROR, thus beginning the loop again.
>
> Running sqlr-status during this time shows number of connections
> skyrocketing, and asking MySQL to "SHOW STATUS" shows the number of
> client connections (Aborted_clients and Connections) to be increasing as
> well. "SHOW PROCESSLIST" also displays sqlrelay's connections, which are
> being established and closed as fast as the server is able.
>
> This looks as though it could be caused by the bug reported at
> http://bugs.mysql.com/bug.php?id=19927.
>
> I have added some code to detect and break out of the infinite loop,
> hoping that would patch sqlrelay while MySQL fixes their bugs, however,
> simply breaking out of the loop does not sufficiently fix what ever is
> wrong. Any further debugging is beyond my abilities :(
>
> If anyone can help, it would be very appreciated. We are on a pretty
> tight development schedule, and this is really slowing us down. If
> anyone needs to see a sqlrelay debug file, let me know and I'll send it
> off-list.
>
>
>
> Best Regards,
> Devananda van der Veen
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Sqlrelay-discussion mailing list
> Sql...@li...
> https://lists.sourceforge.net/lists/listinfo/sqlrelay-discussion
>
|