The I'm using the following code to attempt to open a file handle to an oracle database and to handle a failure of the attempt in a somewhat graceful manner:

BEGIN { my $need= '/local/src/local.perl/oracle/instantclient_10_2'; my $ld= $ENV{LD_LIBRARY_PATH}; if( ! $ld ) { $ENV{LD_LIBRARY_PATH}= $need; } elsif( $ld !~ m#(^|:)\Q$need\E(:|$)# ) { $ENV{LD_LIBRARY_PATH} .= ':' . $need; } else { $need= ""; } if( $need ) { exec 'env', $^X, $0, @ARGV; } } use DBI; use DBD::Oracle; use Sys::SigAction qw( set_sig_handler ); my $dbh; my $host = "some.where.else"; my $sid = "FAKE"; my $user = 'faker'; my $passwd = 'evenmorefaker'; my $thissrv = `hostname`; $start = time; $elapsed = time; while (1) { last if( ($elapsed - $start) > 14400 ); # stop after 4hrs of tryin +g sleep(2); eval { my $h = set_sig_handler( 'ALRM' ,sub { die "connect failed" ;} + ); alarm(2); #implement 2 second time out $dbh = DBI->connect("dbi:Oracle:host=$host;sid=$sid", $user, $ +passwd); alarm(0); }; #original signal handler restored here when $h goes out of scop +e alarm(0); if ( $@ ) { # The attempt to connect to db has failed chomp($@); # just for debugging print "FAILED:$@:$elapsed\n"; $elapsed = time; next; } # # reaching here shows database is now accessable # $elapsed = time; last; # exit the polling loop } #just for debuging print "Pretending to bring services up"

Now the code works ok but when it finishes its run it spits out:

root@somewhere# ./test.pl Pretending to bring services up Out of memory! Callback called exit. END failed--call queue aborted. root@somewhere #

The problem seems to stem from using Sys::SigAction. Any suggestions about why I'm getting 'Out of memory!' errors?

dhj...

In reply to "Out of memory!" and Sys::SigAction by dhj74

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.