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: 37194
Status: resolved
Priority: 0/
Queue: Term-ReadLine-Gnu

People
Owner: Nobody in particular
Requestors: lubo.rintel [...] gooddata.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.17a
Fixed in: (no value)

Attachments


Subject: Term::ReadLine::Gnu causes panic during global destruction on perl 5.10
Running code such as the following use Term::ReadLine; new Term::ReadLine; results in the following, upon exit: panic: free from wrong pool during global destruction. Reproduced with the following: perl-5.10.0-32.fc10.i386 readline-5.2-13.fc9.i386 Seems like the same issue as: http://rt.perl.org/rt3/Public/Bug/Display.html?id=43090
From: lubo.rintel [...] gooddata.com
On Sat Jun 28 11:50:52 2008, lkundrak wrote: Show quoted text
> Running code such as the following > > use Term::ReadLine; > new Term::ReadLine;
Actually, probably I was not clear enough, it is reproducible virtually with any code that uses the module.
From: lubo.rintel [...] gooddata.com
This is how things look when I insert abort() just below the error message, so I can get core dump to for gdb: (gdb) bt #0 0x00de2402 in __kernel_vsyscall () #1 0x00c1b5f0 in raise () from /lib/libc.so.6 #2 0x00c1cfb8 in abort () from /lib/libc.so.6 #3 0x009eca51 in Perl_vcroak (my_perl=0x97cb008, pat=0xb43e0b "panic: free from wrong pool", args=0xbfc5b020) at util.c:1394 #4 0x009ed13e in Perl_croak_nocontext (pat=0xb43e0b "panic: free from wrong pool") at util.c:1405 #5 0x009f45fd in Perl_safesysfree (where=<value optimized out>) at util.c:231 #6 0x00a1cee8 in perl_destruct (my_perl=0x97cb008) at perl.c:836 #7 0x08048a30 in main (argc=2, argv=0xbfc5b224, env=0xbfc5b230) at perlmain.c:115 (gdb) #6 0x00a1cee8 in perl_destruct (my_perl=0x97cb008) at perl.c:836 836 safesysfree(environ[i]); (gdb) l 831 ) 832 { 833 I32 i; 834 835 for (i = 0; environ[i]; i++) 836 safesysfree(environ[i]); 837 838 /* Must use safesysfree() when working with environ. */ 839 safesysfree(environ); 840 (gdb)
From: gawrilow [...] math.tu-berlin.de
This panic is due to a conflict between perl's environment caching and rl_initialize updating the env. vars LINES and COLUMNS via the standard putenv(). I've just posted it as a perl core bug with ticket #56500, as it is not a problem specific to the readline library only.
Subject: Re: [rt.cpan.org #37194] Term::ReadLine::Gnu causes panic during global destruction on perl 5.10
Date: Tue, 1 Jul 2008 23:10:47 +0900
To: bug-Term-ReadLine-Gnu [...] rt.cpan.org
From: "林宏雄" <hiroo.hayashi [...] computer.org>
Hi, I'm the owner of Term::ReadLine::Gnu. Thanks a lot! 2008/7/1 Ewgenij Gawrilow via RT <bug-Term-ReadLine-Gnu@rt.cpan.org>: Show quoted text
> > Queue: Term-ReadLine-Gnu > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=37194 > > > This panic is due to a conflict between perl's environment caching and > rl_initialize updating the env. vars LINES and COLUMNS via the standard > putenv(). I've just posted it as a perl core bug with ticket #56500, as > it is not a problem specific to the readline library only.
-- Hiroo Hayashi
From: lubo.rintel [...] gooddata.com
I guess this can be marked resolved now. I confirm that this is not a bug of Term::ReadLine::Gnu -- recompiling perl with -DPERL_USE_SAFE_PUTENV helped.
After I released Term-ReadLine-Gnu-1.18 I got many fail report on freebsd from CPAN Testers. All of them are due to this problem. FYI: The below is the description of -DPERL_USE_SAFE_PUTENV in INSTALL for perl-5.10.0 distribution. =head3 Environment access Perl often needs to write to the program's environment, such as when C<%ENV> is assigned to. Many implementations of the C library function C<putenv()> leak memory, so where possible perl will manipulate the environment directly to avoid these leaks. The default is now to perform direct manipulation whenever perl is running as a stand alone interpreter, and to call the safe but potentially leaky C<putenv()> function when the perl interpreter is embedded in another application. You can force perl to always use C<putenv()> by compiling with -DPERL_USE_SAFE_PUTENV. You can force an embedded perl to use direct manipulation by setting C<PL_use_safe_putenv = 0;> after the C<perl_construct()> call.
On my perl, compiling with -DPERL_USE_SAFE_PUTENV does not help. This is Perl 5.10, T::R::G 1.19 and readline 6.0. Troubleshooting information as requested in INSTALL file is attached.

Message body not shown because it is not plain text.

On 2009-7月-29 水 09:09:47, DAXIM wrote: Show quoted text
> On my perl, compiling with -DPERL_USE_SAFE_PUTENV does not help. This > is Perl 5.10, T::R::G 1.19 and readline 6.0. Troubleshooting > information as requested in INSTALL file is attached.
Your report says; ------------------------------------------------- ==29242== Invalid read of size 8 ==29242== at 0x4639D6: Perl_safesysfree (util.c:230) ==29242== by 0x47E5D4: perl_destruct (perl.c:836) ==29242== by 0x422706: main (perlmain.c:115) ==29242== Address 0x6a28408 is not stack'd, malloc'd or (recently) free'd panic: free from wrong pool during global destruction. ==29242== ==29242== ERROR SUMMARY: 1 errors from 1 contexts suppressed: 8 from 2) ... Show quoted text
> perl -V
Summary of my perl5 (revision 5 version 10 subversion 0) configuration: ------------------------------------------------- This shows that perl_safesysfree at perl.c:836 caused an error. The follow is the part of perl.c of perl-5.10.0. ------------------------------------------------- 824 #ifndef PERL_MICRO 825 #if defined(USE_ENVIRON_ARRAY) && !defined(PERL_USE_SAFE_PUTENV) 826 if (environ != PL_origenviron && !PL_use_safe_putenv 827 #ifdef USE_ITHREADS 828 /* only main thread can free environ[0] contents */ 829 && PL_curinterp == aTHX 830 #endif 831 ) 832 { 833 I32 i; 834 835 for (i = 0; environ[i]; i++) 836 safesysfree(environ[i]); 837 838 /* Must use safesysfree() when working with environ. */ 839 safesysfree(environ); 840 841 environ = PL_origenviron; 842 } 843 #endif 844 #endif /* !PERL_MICRO */ ------------------------------------------------- The line 836 should not exist if PERL_USE_SAFE_PUTENV is defined. This means your perl.o was compiled without PERL_USE_SAFE_PUTENV defined. Use perl compile with -DPERL_USE_SAFE_PUTENV should be an fix for this issue.