RndNoob has asked for the wisdom of the Perl Monks concerning the following question:
Hi there. Perl is completely new for me, anyways I got stuck with this error trying to do a simple script than must keep a connection established with a remote server. When Ping is called for the second time and Mysql server is off segmentation fault occurs.
this is the skeleton working with a local mysql server (same error):
#!/usr/bin/perl use DBI; use warnings; use strict; use Term::ReadKey; my $dsnL = "dbi:mysql:database=test;host=127.0.0.1;port=3306"; my $dbhLocal = DBI->connect($dsnL, 'root',''); $dbhLocal->{mysql_auto_reconnect} = 1; my $exit; ReadMode 4; for ( ; ; ) { if ($dbhLocal->ping()) { print "OK\n"; } else { print "FAILED\n"; } defined( $exit = ReadKey(-1) ) && $exit ne 'Q' ? last : sleep 5; } ReadMode 0; exit 0;
Output:
root@debian1:/home/user# perl test.pl
OK
OK
OK
OK
Segmentation fault
Sometimes fails with *** Error in `perl': double free or corruption (!prev): 0x00000000020a89d0 ***
Someone have a idea what is happening or a way to tackle this problem?
perl -v This is perl 5, version 20, subversion 2 (v5.20.2) built for x86_64-linux-gnu-thread-multi
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBD::mysql Ping segmentation fault
by Anonymous Monk on Jun 12, 2015 at 06:10 UTC | |
by RndNoob (Initiate) on Jun 12, 2015 at 13:36 UTC |