-----Original Message----- >From: Jeremy Kister <[EMAIL PROTECTED]> >Sent: May 9, 2007 11:05 AM >To: beginners@perl.org >Subject: forking problem with dbd::mysql > >I'm am having an issue with a mysql connection that displays itself when >there's forking going on which I can't track down. > >I've made a test program at http://jeremy.kister.net/code/ftest.pl to >demonstrate. I expect this program to print 'SQL RESULT: 1' for as long >as it can. > >But instead: > >SQL RESULT: 1 >SQL RESULT: 1 >SQL RESULT: 1 >DBD::mysql::st execute failed: MySQL server has gone away at ftest.pl >line 36, <STDIN> line 3. >DBD::mysql::st execute failed: MySQL server has gone away at ftest.pl >line 36, <STDIN> line 3. > > >What's gone wrong? >
Hello, I don't clearly know what's wrong.But maybe due to the two reasons, 1) too less timeout setting in my.cnf? see /etc/my.cnf and look for this line: wait_timeout = ... 2) as we know,child exiting would return a SIGCHLD signal to parent,maybe this break the dbh connection?try to add these 2 lines in parent code: use POSIX qw(:signal_h WNOHANG); $SIG{CHLD}=sub {while((my $child=waitpid(-1,WNOHANG))>0){}}; Hope this helps. -- mailto:[EMAIL PROTECTED] http://home.arcor.de/jeffpang/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/