Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

need help golfing down/making a backtrace for panic: free from wrong pool, … during global destruction.

by daxim (Curate)
on Jul 03, 2019 at 13:09 UTC ( [id://11102352]=perlquestion: print w/replies, xml ) Need Help??

daxim has asked for the wisdom of the Perl Monks concerning the following question:

Repro:
  1. perl-5.30.0 brewed with -DDEBUGGING -Dusemorebits -Duseshrplib -Dusethreads -Accflags='-fPIC -DUSE_THREAD_SAFE_LOCALE'
  2. install Term::ReadLine::Gnu::XS and Devel::REPL
  3. run KDE Konsole 19.04
  4. run re.pl
  5. View → Clear Scrollback and Reset
  6. ctrl+d to exit repl
  7. crash
I know when I get a SIGSEGV I can run gdb and when it crashes, "bt full" gives me the backtrace. But this is a different kind of bug here and I don't know enough.
  • Comment on need help golfing down/making a backtrace for panic: free from wrong pool, … during global destruction.

Replies are listed 'Best First'.
Re: need help golfing down/making a backtrace for panic: free from wrong pool, … during global destruction.
by dave_the_m (Monsignor) on Jul 03, 2019 at 18:34 UTC
    That error message usually means that memory which was allocated by one thread was freed by another thread. This usually occurs if an XS-based module is not written to be thread-safe, or is buggy. Less commonly in recent perls, it may indicate a bug in perl itself.

    The usual way to debug such things is to set a breakpoint at the place in the src where the error is is tested for and raised, to see what address is being freed, and by what. Then re-run with a conditiomnal breakpoint set in the allocation code to see where that address is allocated.

    Run gdb with PERL_HASH_SEED=0 to get consistent results between runs.

    Dave.

      The instructions are too vague to be of use for me, that's above my skill level.

        Can you golf your instructions down a bit?

        Is "run KDE Konsole 19.04" necessary or does any Linux console suffice? Can you replicate the problem in a *BSD VM maybe?

        What commands/input does "KDE Konsole 19.04" send when you use the menu option "Clear Scrollback and Reset"? Is sending that input enough to make the problem reproducible in a non-interactive fashion?

        Does the problem go away if you use a Perl built without threading?

        While it's great that you have a reproducible case, it is still tied very much to your setup. If you are using threads anywhere, dave_the_ms guess is likely good, any C library that is not threadsafe will have problems if you use threads.

Re: need help golfing down/making a backtrace for panic: free from wrong pool, … during global destruction.
by bliako (Monsignor) on Jul 04, 2019 at 15:37 UTC

    In Konsole's src, the action you are doing calls clearHistoryAndReset() (SessionController.cpp) which calls emulation->reset(), session->refresh(), session->setCodec() and clearHistory(). Of all these, the easiest to debug is refresh() which changes the window width by 1 pixel, then waits for some millis and then changes width back to original as a means of a force-refresh hack. So you can see if resizing the window causes you any crash, unlikely though.

    The next in line is setCodec(). It may be that it re-sets the encoding and the locale. So you can perhaps try to manually change the encoding and see if crashes?

      This answer is exemplary and that's the reason why I come to PM with my difficult questions. I wish I could upvote more than once.
      if resizing the window causes you any crash, unlikely though.
      Resizing causes the crash indeed. This also means the repro becomes easier and independent of any specific terminal emulator: pkill -WINCH re.pl

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11102352]
Approved by Athanasius
Front-paged by haukex
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-19 12:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found