I have errors (during global destruction - exit()) like this:
Attempt to free nonexistent shared string '', Perl interpreter: 0x801c +19c00 at ./gemu-test-worker.pl line 1311, <STDIN> line 1. Not a CODE reference at ./gemu-test-worker.pl line 1311, <STDIN> line +1. END failed--call queue aborted at ./gemu-test-worker.pl line 1311, <ST +DIN> line 1. Segmentation fault (core dumped)
or
panic: del_backref, *svp=801e59fc0, sv=8048dd5d0 at /ara/backup/disast +er_backup/glacier/mt-aws/lib/App/MtAws.pm line 120. Not a CODE reference at /ara/backup/disaster_backup/glacier/mt-aws/lib +/App/MtAws.pm line 122. END failed--call queue aborted at ./glacier/mt-aws/mtglacier line 122. panic: invalid MRO! at ./glacier/mt-aws/mtglacier line 122 during glob +al destruction.
sometimes on one machine there is stacktrace
Core dump stack: (gdb) backtrace #0 0x00000008008731f5 in Perl_Gv_AMupdate () from /usr/local/lib/perl5/5.16/mach/CORE/libperl.so #1 0x0000000800873508 in Perl_gv_handler () from /usr/local/lib/perl5/5.16/mach/CORE/libperl.so #2 0x00000008008e6514 in S_curse () from /usr/local/lib/perl5/5.16/mach/CORE/libperl.so #3 0x00000008008e5b92 in Perl_sv_clear () from /usr/local/lib/perl5/5.16/mach/CORE/libperl.so #4 0x00000008008dc369 in Perl_sv_clean_objs () from /usr/local/lib/perl5/5.16/mach/CORE/libperl.so #5 0x00000008008669c7 in perl_destruct () from /usr/local/lib/perl5/5.16/mach/CORE/libperl.so #6 0x0000000000400f39 in main ()
or simply Not a CODE reference + END failed--call queue aborted
or weird things like in "print Dumper \%INC" output line
'base.pm' => '/usr/local/lib/perl5/5.16/base.pm',
replaced with
'' => '',
(and message "Attempt to free nonexistent shared string" thrown)
or things just hangs with 100% CPU (and Ctrl-C produces Segfault)
happends in two different independent scripts, reproduced by me and another person, under FreeBSD 10.x only (perl 5.16.3). on two different machines.
Not reproducible under Linux in same perl version. In both cases error 100% reproducible.
In both cases scripts work (read,write) large files (> 4Gb) by chunks (i.e. not whole file at once).
Attempt to reduce file size throw error away. Attempt to reduce script to proof-of-concept is failed too (problem that script run is too long, so had to wait 10+mins after each modification to see if it still reproducible)

Note that scripts are not using threads. And both scripts fork other processes.
Question is - how to effectively debug such kind of things? What this can be? What to check?

UPD: It seems FreeBSD uses clang by default: http://unix.stackexchange.com/q/49906
$ cc --version FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610 Target: x86_64-unknown-freebsd10.0 Thread model: posix
so this is perl compilled by clang

UPD2: finaly created a PoC and reported a bug RT#122199 seems not only clang affected. reproduced with 5.18 gcc (but 5.16 clang only)

In reply to Debugging perl crash by vsespb

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.