Re: hang with mysql in execute

From: Chris Masters (rotis23_at_yahoo.com)
Date: 03/23/05


Date: Wed, 23 Mar 2005 04:27:28 -0800 (PST)
To: Tony Adolph <t_adolph@hotmail.com>, dbi-users@perl.org

Thanks for the reply Tony - much appreciated.

I've had this happen before with the C mysql lib. The
library handled the alarm signal internally somehow.
The only way to timeout the query was to use fork(2)
and select(2) - way too complex for the perl process
I'm using.

I wonder if the mysql server can be configured to
keepalive the connection or if my client can ping the
server every so often.

Will post my results anayway.

Chri

--- Tony Adolph <t_adolph@hotmail.com> wrote:
> Hi Chris,
>
> I've seen this problem before but connecting to an
> Oracle DB. I wasn't
> directly involved so at the time, but I believe that
> we found some
> documention that says that alarm is not guartenteed
> to respond "on time" on
> a busy system. In our case a 5 seconds wait came
> back over an hour later,
> so the application just hung.
>
> I've emailed my work mate to find out if he found a
> work around. Perhaps a
> post on perl monks is what's required here.
>
> HTH
> Cheers
> Tony
>
> >From: Chris Masters <rotis23@yahoo.com>
> >To: dbi-users@perl.org
> >Subject: Re: hang with mysql in execute
> >Date: Wed, 23 Mar 2005 02:09:40 -0800 (PST)
> >
> >Is the lack of response because this is a stupid
> >question related to an extensively documented
> problem
> >or does no one else have experience of this issue?
> >
> >Anyone?
> >
> >Thanks, Chris
> >
> >
> >--- Chris Masters <rotis23@yahoo.com> wrote:
> > > Hi All,
> > >
> > > A firewall is terminating my connection with a
> mysql
> > > database after a period of inactivity. I've used
> the
> > > following code (with ref to cpan docs and
> connect)
> > > and
> > > it still causes a hang.
> > >
> > >
> ###################################################
> > >
> > > my $result = 0;
> > > my $alarm = 0;
> > > eval
> > > {
> > > #set alarm to timeout query hangs
> > > my $h = Sys::SigAction::set_sig_handler(
> 'ALRM'
> > > ,sub { $alarm = 1; } );
> > > alarm(2);
> > >
> > > my $sth = $dbh->prepare("SELECT 1");
> > > $sth->execute();
> > > $result = 1;
> > >
> > > alarm(0);
> > > };
> > >
> > > alarm(0);
> > >
> > > if($@ || $alarm)
> > > {
> > > syslog('err',"execute error: $@");
> > > $result = 0;
> > > }
> > >
> > > return $result;
> > >
> > > ###############################################
> > >
> > > Am I using alarms wrongly with perl?
> > >
> > > Would it be better to use a select(2) wrapper?
> > >
> > > Any other ideas to prevent this hang?
> > >
> > > Thanks for any help on this.
> > >
> > > Chris
> > >
> > > redhat 8.0
> > > perl-5.8.0-88.3
> > > perl-DBI-1.30-1
> > > perl-DBD-MySQL-2.1017-3
> > >
> > >
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > Yahoo! Small Business - Try our new resources
> site!
> > > http://smallbusiness.yahoo.com/resources/
> > >
> >
> >
> >
> >__________________________________
> >Do you Yahoo!?
> >Make Yahoo! your home page
> >http://www.yahoo.com/r/hs
>
>
_________________________________________________________________
> Express yourself instantly with MSN Messenger!
> Download today it's FREE!
>
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
>

                
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/



Relevant Pages

  • Re: Apache, mysql, phpMyAdmin
    ... Chris Sharman wrote: ... > Installed all the latest versions on Alpha VMS 7.3-1. ... > All appears to be working, but I can't get phpMyAdmin to login properly. ... > I've got mysql installed on a test machine with passwords unset (ie open ...
    (comp.os.vms)
  • Re: Worthwhile to pay to submit my site to Yahoo Directory?
    ... Chris H. wrote: ... I am considering to pay the US $299.00 to submit my site to Yahoo ... Is it worth my money to do this in terms of increasing my ...
    (alt.internet.search-engines)
  • RE: ODBC logging via ISS Internet Scanner
    ... “ISS ODBC LOGGING” ... > MySQL server. ... I have a ODBC connection to this MySQL ... >> Check out Yahoo! ...
    (Security-Basics)
  • Re: snort logging in mysql on Debian!
    ... > I am not able to log into mysql. ... > degisiklige ugrayarak ulasmasindan veya gec ulasmasindan, ... The all-new My Yahoo! ...
    (Debian-User)
  • Re: FBSD 5.2.1-p4 and mysqld problems
    ... Usually freezes once per day. ... Just freezes and I had to kill mysql process ... I now have witness in the kernel...no deadlocks ... >Do you Yahoo!? ...
    (freebsd-current)