Perl DBD::Sybase and signal handling

There appears to a bug with DBD::Sybase or perhaps Sybase OpenClient ctlib (threaded) that causes custom signal handlers to segfault.  This tripped up a monitoring script that I wrote.

I’ve asked the perl module maintainer, Michael Peppler, whether this is a DBD::Sybase bug or an Openclient bug.


looks like this is a DBD::Sybase bug not an OpenClient ctlib as the example $SYBASE/$SYBASE_OCS/sample/ctlibrary/multthrd.c with an added signal handler works fine:
$ diff multthrd.c $SYBASE/$SYBASE_OCS/sample/ctlibrary/multthrd.c

< #include <signal.h>
< 217,223d214
< void leave(int sig);
< void leave(int sig) {
<     printf("caught SIGINT\n");
<     exit(-1);
< }
<       (void) signal(SIGINT,leave);
<        for(;;) {
<         printf("Ready...\n");
<         (void)getchar();
<     }

&#91;text gutter="false"&#93;
Thread_2:All done processing rows - total 116.
caught SIGINT&#91;/text&#93;
<h3>Bug text:

use strict;
use DBI;
use DBD::Sybase;

$SIG{'INT'} = sub {print "hi there\n";exit();};

print "go\n";

while (1) {

If I run this and then type ^C I get a segmentation fault. If I comment out

the ‘use DBD::Sybase;’ line, it works fine


Build DBD::Sybase against the nonthreaded ( not openclient libraries.

Share Button

One Reply to “Perl DBD::Sybase and signal handling”

  1. Thankyou Thankyou Thankyou!

    We were having segfaults on our mod_perl servers which we fixed by pulling DBD::Sybase into the phase (this segfaulted immediately until we upgraded the OCS from 12_5 to 15_0); however this meant we couldn’t kill apache – it appears that DBD::Sybase (or one of the underlying sybase libraries) grabs all the signal handlers. Looks like the underlying problem was the threaded DBD::Sybase – I rebuilt DBD::Sybase with the non-threaded libs and *bang*: I can stop apache nicely now.

Leave a Reply

Your email address will not be published. Required fields are marked *