Skip Menu |

This queue is for tickets about the Term-ReadLine-Gnu CPAN distribution.

Maintainer(s)' notes

When you report a bug, please provide the following information;

- output of
	perl -V
	perl Makefile.PL verbose
	make test TEST_VERBOSE=1
	perl -Mblib t/00checkver.t
	echo $TERM
- terminal emulator which you are using
- compiler which is used to compile the GNU Readline Library (libreadline.a) if you can know.
Read INSTALL in the distribution for more details.

Report information
The Basics
Id: 129984
Status: open
Priority: 0/
Queue: Term-ReadLine-Gnu

People
Owner: HAYASHI [...] cpan.org
Requestors: daxim [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.36
Fixed in: (no value)



Subject: "panic: free from wrong pool, … during global destruction." on threaded Perl
Repro: 1. perl-5.30.0 brewed with -DDEBUGGING -Dusemorebits -Duseshrplib -Dusethreads -Accflags='-fPIC -DUSE_THREAD_SAFE_LOCALE' 2. run perl -mTerm::ReadLine -e'$0 = "trlg-debug"; $term = Term::ReadLine->new($0); while (defined ($_ = $term->readline("prompt>"))) {}' 3. while the prompt waits for input, resize terminal emulator window or run pkill -WINCH trlg-debug 4. ctrl+d to exit Expect: clean exit Got: panic: free from wrong pool, 70d000!=590260 during global destruction. Terminal emulator is KDE Konsole 19.04. Other system information is attached.
Subject: trlg.txt

Message body is not shown because it is too large.

Hi, I am sorry I overlooked your report. I cannot reproduce your fail on my environment. Do you still have the error? Can you try any other programs which uses the same GNU Readline Library, ex bash? My module does not care about the WINCH signal. The GNU Readline cares it. And your report says TERM is set to dumb. Do you use the same value on KDE Konsole? Any other clues are welcome. Thank you. On Fri, 5 Jul 2019 07:15:27 GMT, DAXIM wrote: Show quoted text
> Repro: > > 1. perl-5.30.0 brewed with -DDEBUGGING -Dusemorebits -Duseshrplib > -Dusethreads -Accflags='-fPIC -DUSE_THREAD_SAFE_LOCALE' > 2. run perl -mTerm::ReadLine -e'$0 = "trlg-debug"; $term = > Term::ReadLine->new($0); while (defined ($_ = $term-
> >readline("prompt>"))) {}'
> 3. while the prompt waits for input, resize terminal emulator window > or run pkill -WINCH trlg-debug > 4. ctrl+d to exit > > Expect: > > clean exit > > Got: > > panic: free from wrong pool, 70d000!=590260 during global destruction. > > Terminal emulator is KDE Konsole 19.04. Other system information is > attached.
Show quoted text
> Do you still have the error?
Yes. It also shows with perl-5.31.9. Show quoted text
> Can you try any other programs
I have tested a few programs depending on libreadline8: bash, bc, fdisk, gpg2, lftp, parted, python3, sqlite3, units, xfs_db, zypper. When they show a prompt: 1. I verify that I am on a readline prompt by using the Home key (does nothing on a readline prompt, but would print ^[[H on a non-readline prompt); 2. I send a WINCH signal to the program; 3. I press ctrl+d to exit the prompt. They all behave normally. What I mean is: they exit the same way whether I send the signal or not. It's only Perl programs with T::RL::G that panic, and only after receiving the signal. Show quoted text
> your report says TERM is set to dumb
That's in line 211 of the report file. This is because the test file t/02test_use.t sets TERM=dumb on purpose. My normal value is shown above in line 199: TERM=xterm-256color
Subject: "panic: free from wrong pool, … during global destruction." on threaded+debug Perl
Show quoted text
> Any other clues are welcome.
ilmari commented in IRC: | it might be a -DDEBUGGING-only panic | indeed, it's in an # ifdef PERL_TRACK_MEMPOOL, which is only defined under PERL_IMPLICIT_CONTEXT && DEBUGGING | PERL_IMPLICIT_CONTEXT is only defined by default under MULTIPLICITY, so you need threads _and_ debugging to trigger that | and I can reproduce it on 5.30.0-thr-dbg on debian stable | that error is from perl's safesysfree(), not readline or libc | so it's a value beeing freed by a different interpreter than the one that allocated it
Hi, Thank you for your info. They help me a lot. On Fri, 24 Apr 2020 23:24:00 GMT, DAXIM wrote: Show quoted text
> > Any other clues are welcome.
> > ilmari commented in IRC: > > | it might be a -DDEBUGGING-only panic > | indeed, it's in an # ifdef PERL_TRACK_MEMPOOL, which is only defined > under PERL_IMPLICIT_CONTEXT && DEBUGGING > | PERL_IMPLICIT_CONTEXT is only defined by default under MULTIPLICITY, > so you need threads _and_ debugging to trigger that > | and I can reproduce it on 5.30.0-thr-dbg on debian stable > | that error is from perl's safesysfree(), not readline or libc > | so it's a value beeing freed by a different interpreter than the one > that allocated it
This makes sense to me. T::RL::G has to handle strings which are allocated by Perl and GNU Readline Library. They can be mixed. I carefully choose Perl-free nor xfree (free used by GNU Readline Library). And there are codes which frees strings when it received signal in the GNU Readline Library. Strings allocated by perl may freed and may cause error by perl memory checker. Does 5.30.0-thr-dbg mean perl-debug package? https://packages.debian.org/search?lang=en&keywords=perl-debug I am not sure I can fix, but I will try.