ethrbunny has asked for the wisdom of the Perl Monks concerning the following question:

Im getting the mysql/DBH 'segmentation fault' error this morning. I have it 'pruned' down to a small sample.
#!/usr/bin/perl -w use strict; use DBI; use LWP::UserAgent; use HTTP::Request::Common; use XML::Simple; use Date::Manip; my $db_user = 'db_user'; my $db_pw = 'dbpw'; ## # DB connect my $dbh = DBI->connect('DBI:mysql:db_name:db_host', $db_user, $db_pw, + {PrintError => 1, AutoCommit => 1, RaiseError => 1} ); if (DBI::err) { die $DBI::errstr; } my $xml = new XML::Simple (KeyAttr=>[]); my $Browser = new LWP::UserAgent; push @{ $Browser->requests_redirectable }, 'POST'; my $URL = 'https://some_site_with_xml_data'; my %Fields; ##################note this code################# ## my $Page = $Browser->request(POST $URL,\%Fields); ## ################################################# # clean up $dbh->disconnect();
If I run the above code I get a 'segmentation fault' error. If I comment out the call to browser->request the error goes away. Its coming from DBI/DBH.

The snip is from a larger file that opens the XML data and walks through it. Im wanting to retrieve several values from this file and put them in a DB. The code was working until I added the calls to DBI. I pruned until I could get the error to go away.

Suggestions? I've used DBI::mysql in plenty of other projects before. Im not clear on why its not happy with this group of modules.

Replies are listed 'Best First'.
Re: DBH - segmentation fault - out of memory?
by Corion (Patriarch) on Jan 24, 2008 at 13:21 UTC

    Are you sure that the problem is with both, DBI and LWP/https ? I would try to check whether the problem is "simply" with a broken Crypt::SSLeay installation.

      The msg *does* go away if I use a non-HTTPS site. IE 'craigslist' or similar. Other HTTPS sites cause the error.

      It must be some combination of the two. I can connect to a DB *or* I can get the XML data. Not both.

      To be sure I did a CPAN 'install Crypt::SSLeay'.
      Writing /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/Cr +ypt/SSLeay/.packlist Appending installation info to /usr/lib/perl5/5.8.5/i386-linux-thread- +multi/perllocal.pod DLAND/Crypt-SSLeay-0.57.tar.gz sudo make install -- OK
      No change in the error.

        Here's an interesting twist: If I add the line 'use Crypt::SSLeay;' right after 'use strict' the error goes away.

        Go figure.