A known problem with how Solaris handles dynamically loading a
library that uses threads into a executable that doesn't.
A probable workaround is to "use DBD::Oracle;" before the alarm() call.
Please let me know if that works.
Tim.
On Tue, Aug 12, 2003 at 02:05:09PM +0100, Avis, Ed wrote:
> I am using DBI-1.37 and DBD::Oracle-1.06 successfully with the
> application yasql-1.81 (an sqlplus replacement). But when I tried
> installing DBD::Oracle-1.14, yasql appeared to work as normal but
> developed a strange timeout problem. After working correctly for
> about 20 seconds after login, it would print
>
> Warning: Connection lost (timeout: 20)
>
> and then exit. If no SQL commands had been sent to the database then
> the message would be 'Alarm Clock' instead.
>
> I mention these messages so that search engines will find them. A bit
> of digging shows that the problem is caused by an alarm signal being
> received even though alarm(0) has been called. In other words, code
> like
>
> alarm(20);
> alarm(0);
> print "waiting\n";
> 0 while 1;
>
> will print 'waiting' and then get SIGALRM. I have reduced the bug to
> a test case of two files. First a stripped-down DBI.pm:
>
> package DBI;
> use DynaLoader;
> @ISA = qw(DynaLoader);
> bootstrap DBI;
> sub install_driver {
> eval 'require DBD::Oracle;';
> }
> 1;
>
> Save this code as DBI.pm.min. Then create another file:
>
> $SIG{ALRM} = sub { print "got alarm\n"; exit(0) };
> alarm(1); print "set alarm\n";
> package DBD::Oracle;
> require 'DBI.pm.min';
> @ISA = qw(DynaLoader);
> bootstrap DBD::Oracle;
> alarm(0); print "unset alarm\n";
> 0 while 1;
>
> Save this and run it with perl. The expected output would be
>
> set alarm
> unset alarm
>
> followed by an infinite loop which you can interrupt with C-c. But on
> my system it prints
>
> set alarm
> unset alarm
> got alarm
>
> showing that alarm(0) did not stop alarms from happening.
>
> As likely as not this is a problem with my particular system:
>
> % uname -a
> SunOS ftidev1.london.kbcfp.com 5.8 Generic_108528-15 sun4u sparc SUNW,Sun-Fire-280R
> Solaris
>
> but still I'd appreciate it if others could try this test case and see
> what it does. It needs DBD::Oracle installed; the strange thing is
> that it works correctly with DBD::Oracle-1.06 but not with 1.14. I
> haven't yet narrowed down the versions further.
>
> --
> Ed Avis <[EMAIL PROTECTED]>