Hi Guys,

I have a segfault in a complex media program that I'm working on that is defying my attempts to debug it. I thought that talking it over with the experts might help to clear my head!

The application is a medical video application with the following technology stack:

The dmesg error says: [36693.088232] monitorQueue:sr[12552]: segfault at 5c ip 00007f2139c85e41 sp 00007f210e2eb7e0 error 4 in libperl.so.5.18.2[7f2139c37000+180000]

(monitorQueue is part of the customised Wx::MediaCtrl).

When I run it through Valgrind, I get the following backtrace at dump time:

==14613== Thread 6 monitorQueue:src: ==14613== Invalid read of size 4 ==14613== at 0x4E85E41: Perl_gv_fetchmeth_pvn (in /usr/lib/libperl. +so.5.18.2) ==14613== by 0x4E83AC0: Perl_gv_fetchmethod_pvn_flags (in /usr/lib/ +libperl.so.5.18.2) ==14613== by 0x685B43C: wxPliVirtualCallback::FindCallback(interpre +ter*, char const*) const (v_cback.cpp:30) ==14613== by 0x6865649: wxPliApp::Yield(bool) (app.h:184) ==14613== by 0x146F016B: wxGStreamerMediaBackend::SetupXOverlay() ( +in /usr/local/lib/perl/5.18.2/Alien/wxWidgets/gtk_2_8_11_uni/lib/libw +x_gtk2u_media-2.8.so.0.7.0) ==14613== by 0x146F0265: gst_bus_sync_callback (in /usr/local/lib/p +erl/5.18.2/Alien/wxWidgets/gtk_2_8_11_uni/lib/libwx_gtk2u_media-2.8.s +o.0.7.0) ==14613== by 0x14929601: gst_bus_post (in /usr/lib/x86_64-linux-gnu +/libgstreamer-0.10.so.0.30.0) ==14613== by 0x14936EB2: gst_element_post_message (in /usr/lib/x86_ +64-linux-gnu/libgstreamer-0.10.so.0.30.0) ==14613== by 0x14922A53: ??? (in /usr/lib/x86_64-linux-gnu/libgstre +amer-0.10.so.0.30.0) ==14613== by 0x14955384: ??? (in /usr/lib/x86_64-linux-gnu/libgstre +amer-0.10.so.0.30.0) ==14613== by 0x1491F9B7: ??? (in /usr/lib/x86_64-linux-gnu/libgstre +amer-0.10.so.0.30.0) ==14613== by 0x14929601: gst_bus_post (in /usr/lib/x86_64-linux-gnu +/libgstreamer-0.10.so.0.30.0) ==14613== Address 0x5c is not stack'd, malloc'd or (recently) free'd ==14613== ==14613== ==14613== Process terminating with default action of signal 11 (SIGSEG +V): dumping core ==14613== Access not within mapped region at address 0x5C ==14613== at 0x4E85E41: Perl_gv_fetchmeth_pvn (in /usr/lib/libperl. +so.5.18.2) ==14613== by 0x4E83AC0: Perl_gv_fetchmethod_pvn_flags (in /usr/lib/ +libperl.so.5.18.2) ==14613== by 0x685B43C: wxPliVirtualCallback::FindCallback(interpre +ter*, char const*) const (v_cback.cpp:30) ==14613== by 0x6865649: wxPliApp::Yield(bool) (app.h:184) ==14613== by 0x146F016B: wxGStreamerMediaBackend::SetupXOverlay() ( +in /usr/local/lib/perl/5.18.2/Alien/wxWidgets/gtk_2_8_11_uni/lib/libw +x_gtk2u_media-2.8.so.0.7.0) ==14613== by 0x146F0265: gst_bus_sync_callback (in /usr/local/lib/p +erl/5.18.2/Alien/wxWidgets/gtk_2_8_11_uni/lib/libwx_gtk2u_media-2.8.s +o.0.7.0) ==14613== by 0x14929601: gst_bus_post (in /usr/lib/x86_64-linux-gnu +/libgstreamer-0.10.so.0.30.0) ==14613== by 0x14936EB2: gst_element_post_message (in /usr/lib/x86_ +64-linux-gnu/libgstreamer-0.10.so.0.30.0) ==14613== by 0x14922A53: ??? (in /usr/lib/x86_64-linux-gnu/libgstre +amer-0.10.so.0.30.0) ==14613== by 0x14955384: ??? (in /usr/lib/x86_64-linux-gnu/libgstre +amer-0.10.so.0.30.0) ==14613== by 0x1491F9B7: ??? (in /usr/lib/x86_64-linux-gnu/libgstre +amer-0.10.so.0.30.0) ==14613== by 0x14929601: gst_bus_post (in /usr/lib/x86_64-linux-gnu +/libgstreamer-0.10.so.0.30.0) ==14613== If you believe this happened as a result of a stack ==14613== overflow in your program's main thread (unlikely but ==14613== possible), you can try to increase the size of the ==14613== main thread stack using the --main-stacksize= flag. ==14613== The main thread stack size used in this run was 8388608. ==14613== ==14613== HEAP SUMMARY: ==14613== in use at exit: 124,629,095 bytes in 789,922 blocks ==14613== total heap usage: 2,897,906 allocs, 2,107,984 frees, 369,0 +36,546 bytes allocated ==14613== ==14613== LEAK SUMMARY: ==14613== definitely lost: 743,262 bytes in 53,292 blocks ==14613== indirectly lost: 78,240 bytes in 2,855 blocks ==14613== possibly lost: 37,420,635 bytes in 59,640 blocks ==14613== still reachable: 85,036,022 bytes in 670,521 blocks ==14613== suppressed: 0 bytes in 0 blocks ==14613== Rerun with --leak-check=full to see details of leaked memory ==14613== ==14613== For counts of detected and suppressed errors, rerun with: -v ==14613== Use --track-origins=yes to see where uninitialised values co +me from ==14613== ERROR SUMMARY: 28 errors from 9 contexts (suppressed: 1 from + 1)

I've run it through various other debuggers like ddd, and really I'm not getting any joy, just more stack-dumps.

I've also tried back-stepping through git to get to a point before the bug was there, but actually, it just occurs less frequently, it doesn't dissapear altogether.

Any ideas would be welcome.

Regards

Steve.


In reply to Segfault in Perl_gv_fetchmeth_pvn (in /usr/lib/libperl.so.5.18.2) by Steve_BZ

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.