Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Doug Morse <morse at pobox dot com>
Subject: Segmentation Faults (SIGSEGV) occurring with DBD::Sybase under mod_perl
Date: Jul 26 2000 6:12PM


I'm having problems with a configuration that I've been using flawlessly for a
some time until I decided to do a system upgrade (i.e., the usual story:
upgrade the OS, get the latest of everything, including Perl modules, etc.).
The relevant pieces I now have are what I suspect is a pretty common

    apache-1.3.12-2         (stock RedHat RPM)
    mod_perl-1.21-10        (stock RedHat RPM)
    perl-5.00503-10         (stock RedHat RPM)
    DBI 1.14                (installed using CPAN)
    Apache::Registry 2.01   (part of the mod_perl-1.21-10 RPM)
    Apache::DBI 0.87        (installed using CPAN)
    DBD::Sybase 0.22        (installed using CPAN)
    HTML::Embperl 1.3b4     (installed using CPAN)

...all running under a standard RedHat Linux 6.2 (Zoot) installation.

The problem is as follows.  Apache::DBI is being used to maintain persistent
database handles (under mod_perl).  Everything works great until enough
inactivity occurs that Sybase closes a www database handle.  At that point,
*all* httpd children segfault whenever a database handle is accessed:

    [Wed Jul 26 10:00:30 2000] [notice] child pid 6770 exit signal
    Segmentation fault (11)

So, in a nutshell, my site works great (i.e., no segfaults, no errors in the
log files) until enough inactivity occurs that Sybase closes a www database
handle, at which point all WWW <-> Sybase communication is completely cut off.
I did not have this problem using the exact same configuration under RedHat
Linux 6.0 (and obviously using slightly older RPMs and Perl modules).

Running a gdb trace produces the output shown at the end of this message.
Basically, I fired up the httpd process under gdb and then loaded an
Embperl/Apache::DBI page using a web browser just fine.  Then I used isql to
kill the 'www' user database connection process.  When I then try to reload
the same page, a SIGPIPE occurs in libc which in turn causes to

I imagine I could somewhat fix this by not letting Sybase timeout connections,
but that in my mind doesn't really solve the problem.  What I really want is
to be able to depend on Apache::DBI to ensure that db handles are always OK
and if not then that new ones are created automatically.

As an aside, the main httpd segfaults when I add a line "PerlModule
Apache::DBI" in the httpd.conf file, which I found a bit odd as well, but I'm
not sure if add such a line is "proper procedure" anymore and so just
dropped it from the conf file:

    (gdb) run -X -f /etc/httpd/conf/httpd.conf -d /tmp
    Starting program: /usr/sbin/httpd -X -f /etc/httpd/conf/httpd.conf -d /tmp

    Program received signal SIGSEGV, Segmentation fault.
    0x40320b12 in boot_DBI ()
       from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBI/

Any and all help / suggestions / pointers is much appreciated!

Doug Morse


GNU gdb 19991004
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(no debugging symbols found)...
(gdb) run -X -f /etc/httpd/conf/httpd.conf -d /tmp
Starting program: /usr/sbin/httpd -X -f /etc/httpd/conf/httpd.conf -d /tmp

Program received signal SIGPIPE, Broken pipe.
0x40156c82 in __libc_send () from /lib/
(gdb) cont

Program received signal SIGSEGV, Segmentation fault.
0x4036d2c6 in cleanUp ()
   from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/Sybase/
(gdb) backtrace
#0  0x4036d2c6 in cleanUp ()
   from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/Sybase/
#1  0x4036e5fa in syb_st_destroy ()
   from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/Sybase/
#2  0x40368cfe in XS_DBD__Sybase__st_DESTROY ()
   from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/Sybase/
#3  0x40305262 in __nis_hash (keyarg=0x82d7508, len=0) at nis_util.c:74
#4  0x402a94e8 in Perl_sv_upgrade () from /etc/httpd/modules/
#5  0x402799fc in init_main_stash () from /etc/httpd/modules/
#6  0x402adcdc in Perl_sv_2mortal () from /etc/httpd/modules/
#7  0x402ae038 in Perl_newSVsv () from /etc/httpd/modules/
#8  0x402adec5 in Perl_newSVnv () from /etc/httpd/modules/
#9  0x402ae038 in Perl_newSVsv () from /etc/httpd/modules/
#10 0x4029eac2 in magic_methpack () from /etc/httpd/modules/
#11 0x402addd6 in Perl_newSVpvn () from /etc/httpd/modules/
#12 0x402ae038 in Perl_newSVsv () from /etc/httpd/modules/
#13 0x402bbd93 in Perl_leave_scope () from /etc/httpd/modules/
#14 0x402a506d in Perl_pp_rv2av () from /etc/httpd/modules/
#15 0x402d499d in ?? () from /etc/httpd/modules/
#16 0x40279a11 in init_main_stash () from /etc/httpd/modules/
#17 0x4035a0c3 in CallCV ()
   from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/HTML/Embperl/
#18 0x4035a88b in EMBPERL_EvalTransFlags ()
   from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/HTML/Embperl/
---Type  to continue, or q  to quit---
#19 0x4035a8c8 in EMBPERL_EvalTrans ()
   from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/HTML/Embperl/
#20 0x40351066 in ScanCmdEvals ()
   from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/HTML/Embperl/
#21 0x403544b0 in EMBPERL_ProcessBlock ()
   from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/HTML/Embperl/
#22 0x4035af98 in EMBPERL_EvalMain ()
   from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/HTML/Embperl/
#23 0x4035414a in ProcessFile ()
   from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/HTML/Embperl/
#24 0x403548d1 in EMBPERL_ExecuteReq ()
   from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/HTML/Embperl/
#25 0x4034d562 in XS_HTML__Embperl__Req_ExecuteReq ()
   from /usr/lib/perl5/site_perl/5.005/i386-linux/auto/HTML/Embperl/
#26 0x402a94e8 in Perl_sv_upgrade () from /etc/httpd/modules/
#27 0x402d499d in ?? () from /etc/httpd/modules/
#28 0x40279a11 in init_main_stash () from /etc/httpd/modules/
#29 0x4025f8df in perl_cmd_dispatch_handlers ()
   from /etc/httpd/modules/
#30 0x4025f18d in mod_perl_dir_env () from /etc/httpd/modules/
#31 0x4025dd44 in mod_perl_register_cleanup ()
   from /etc/httpd/modules/
#32 0x805345e in ap_invoke_handler ()
#33 0x80618fb in ap_some_auth_required ()
---Type  to continue, or q  to quit---
#34 0x8061958 in ap_process_request ()
#35 0x805b940 in ap_child_terminate ()
#36 0x805baa7 in ap_child_terminate ()
#37 0x805bba8 in ap_child_terminate ()
#38 0x805c058 in ap_child_terminate ()
#39 0x805c65f in main ()
#40 0x400bc9cb in __libc_start_main (main=0x805c3e0 
, argc=6, argv=0xbffffc34, init=0x804f014 <_init>, fini=0x807b99c <_fini>, rtld_fini=0x4000ae60 <_dl_fini>, stack_end=0xbffffc2c) at ../sysdeps/generic/libc-start.c:92 (gdb) ----- EOT