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