Re: mod_dbd and mysql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 8 May 2007 08:11:13 -0500
"Frank Jones" <jonesf11@xxxxxxxxx> wrote:

> I'm using mod_dbd to access mysql. Since one of the queries I use is
> executed on every request, I prepare it by using DBDPrepareSQL.
> 
> However, I don't know what to do if apr_dbd_pvselect using the
> prepared statement returns 2013 (Lost connection). This happens when a
> long interval passes between queries (8 hours). Obviously I can
> increase the mysql timeout, but this isn't the most robust solution
> since I'll never know for sure whether I've increased it enough.

What MySQL version are you using?  This appears to have changed between
4.1 (where mysql_ping would reestablish a lost connection) and 5.0
(where it doesn't).

> The issue is that once the connection times out the prepared statement
> cannot be used. Is it safe to create a new prepared statement with
> apr_dbd_prepare and replace the defunct statement with apr_hash_set?
> Do I need to do anything to make sure the old statement is properly
> cleaned up?

The correct solution is for your module to call apr_dbd_invalidate
to invalidate the stale connection, then grab another from the pool.
But alas, only your module can decide how many times to retry in
case of problems.

BTW, this would be more on-topic on the dev or modules-dev list.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux