So I was sending hash back and forth over the network with Storable, and then I started getting these weird segfaults when I tried to read from a socket. So I thought, why not, I'll just trap SIGSEGV and force a dump():

(gdb) where #0 0xff082ce0 in clean_store_context () from /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/Storabl +e/Storable.so #1 0xff082f04 in clean_context () from /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/Storabl +e/Storable.so #2 0xff08bb98 in do_retrieve () from /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/Storabl +e/Storable.so #3 0xff08bf7c in pretrieve () from /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/Storabl +e/Storable.so #4 0xff08c548 in XS_Storable_pretrieve () from /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/auto/Storabl +e/Storable.so #5 0x9db30 in Perl_pp_entersub () at pp_hot.c:2255 #6 0x91e64 in Perl_runops_debug () at run.c:66 #7 0x23734 in perl_run (sv_interp=0x13c00c) at perl.c:1095 #8 0x1f230 in main (argc=2, argv=0xffbefd0c, env=0xffbefd18) at perlm +ain.c:51 (gdb)

....And so it seems like this is a Storable issue while reading from the socket. I call fd_retrieve like so:

sub read { my $socket = shift; my $timeout = shift || 60; return undef unless( _is_valid( $socket ) ); my $hash; local $@ = ''; eval{ local $SIG{ ALRM } = sub{ die "ALRM:Read Time Out\n" } +; alarm( $timeout ); $hash = fd_retrieve( $socket ); alarm( 0 ); }; if( $@ ) { return undef; } return $hash; }

At the point of the call to retrieve_fd, I believe there's nothing in the socket, so the alarm() should go off.

Do you guys see anything wrong here? Am I doing something really stupid? This is with 5.005_03 on a solaris.


In reply to Segfault with Storable by lestrrat

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.