I'm seeking a tool to extract the stack(s) from a coredump of a (multithreaded) Perl application. CPAN turned up Devel::CoreStack but its 10 years old, and likely isn't going to be up to date with Perl 5.8 and/or ithreads. I also found the (very helpful, but not neccesarily for this issue) node Techniques for isolating bugs in perl.

My problem relates to a large scale multithreaded Perl app running on Linux (RHAS4, perl 5.8.7). (FWIW: Its sortof like a web server, but for other protocols.) After 16-20 hours of moderate use, one of the threads hangs in a 100% CPU loop. My hope was I could force a coredump, and then use a tool (like Devel::CoreStack) that could easily locate the stacks of each thread, and I could see where all the threads are executing at the coredump.

I was hoping to avoid the overhead of running with -d if possible, tho the method described by Re: Techniques for isolating bugs in perl may be one solution.

Is there a more current version of Devel::CoreStack (or equivalent) available ?

Update:
After some reflection, I think I've got a reasonable solution derived from Devel::DProf + IPC::ShareLite Sys::Mmap. Basically, I'll create a ring buffer in shared memory an mmap'ed file, 1 ring per thread, w/ fixed size slots to which I store "sprintf package::method::line timestamp" package, sub, line number, and timestamp in DB::DB, then use an external script to view the ring buffers while the profiled app is running.

Is there a module that already does this ? Everything I found just saved a big buffer and dumped it to a file at exit. Assuming there isn't such a module, does anyone have any recommendations for a namespace ? Current working title is "Devel::MmapProf", but I'm thinking "Devel::STrace" may make more sense, since thats essentially what the module does - strace for perl apps.

Update 2:
Done. See Devel::STrace and Devel::STrace: strace for Perl scripts (with some seedlings) for details.


In reply to Perl coredump analysis tool ? by renodino

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.