On Wed, Jun 30, 2004 at 03:19:15PM +0200, Dave Mullen - Marikina CGI wrote: > Dear Mr Bunce, > > We are using perl 5.005 and mysql 3.23 on a Linux Redhat 7.2 system. > > We are trying to implement a better "timeout" for the DBI connections, as > the one incorporated in the DBI module only has a granularity of seconds. > > We don't use persistent connections or mod-perl, so connection time is an > important factor for us, and we wish to avoid excessive times, as this > affects our server performance.
So why not use persistent connections or mod-perl like the rest of the world? > Herewith is the test script, which basically wraps the connection in an eval > block, and the Time::HiRes "alarm" will cause the eval to die after 10ms. > This script perfomed well over a 24 hour period, our only concern is that > sometimes we recorded the following error message during the "eval cleanup" > > (in cleanup) dbih_getcom handle DBI::db=HASH(0x8258a28) is not a DBI handle > (has no magic) > > Obviously, the alarm triggers and the eval block dies at some point during > the creation of the DBI object, our concern is that this "eval cleanup > failure" may be leaving resources behind on the system ??? Probably. > Your comments please. Don't do it. Honestly. It's not reliable and can't be made reliable. Search the web for discussions of perl and signals. Even if you got it to work (and appear reliable) it'll probably break when you upgrade perl to a later one that has "safe signals". Here be dragons. The rest of the world uses persistent connections or mod-perl for a reason. Tim.
