Skip Menu |

This queue is for tickets about the CGI-SpeedyCGI CPAN distribution.

Report information
The Basics
Id: 13521
Status: open
Priority: 0/
Queue: CGI-SpeedyCGI

People
Owner: Nobody in particular
Requestors: Marek.Rouchal [...] gmx.net
Cc:
AdminCc:

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



Subject: Memory leak with Perl >5.8.5
With Perl 5.8.6 and 5.8.7 I see a memory leak in the test of CGI- SpeedyCGI (see also the posting I did on perl5-porters, http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2005- 02/msg00006.html ): t/be_memleak..........1..2 ok mem usage went from 3672K to 10328K in 1000 runs not ok FAILED test 2 Failed 1/2 tests, 50.00% okay With perl-5.8.5 (all with shared libperl, ithreads, compiled with gcc- 3.4.3 on Solaris 8 sparc and RedHat Enterprise Linux 3.0 x86) this memeory leak does not appear. Can you investigate where this could come from? Honestly, I do not know where to start and how, but a memory leak sounds dangerous to me. Let me know if you need any additional debugging information. Thanks & best regards, Marek PS. By the way, all Perl internal tests pass OK, and I did not see anything suspicious in other modules.
From: tomek
The same problem here, with Perl 5.8.7 on Gentoo I got: PERL_DL_NONLAZY=1 SPEEDY=/root/.cpan/build/CGI-SpeedyCGI- 2.22/speedy/speedy SPEEDY_BACKENDPROG=/root/.cpan/build/CGI-SpeedyCGI- 2.22/speedy_backend/speedy_backend SPEEDY_MODULE=/root/.cpan/build/CGI- SpeedyCGI-2.22// SPEEDY_TIMEOUT=300 /usr/bin/perl5.8.7 "- MExtUtils::Command::MM" "-e" "test_harness (0, '../blib/lib', '../blib/arch')" t/*.t t/alarm...............ok t/argv................ok t/basic1..............ok t/basic2..............ok t/be_memleak..........ok 1/2 mem usage went from 12168K to 15752K in 1000 runs t/be_memleak..........FAILED test 2 Failed 1/2 tests, 50.00% okay
From: banb [...] yahoo.co.jp
Since Perl 5.8.6, my_setenv() 's behavior in embed-perl changed as if the system has non-leaking putenv() function. So on some architectures, persistent embed perl interpreter produces memory leak. From perl586delta (Also see perl-5.8.*/INSTALL file) Show quoted text
> Changed Internals > > From now on all applications embedding perl will behave > as if perl were compiled with -DPERL_USE_SAFE_PUTENV. > See "Environment access" in the INSTALL file for details.
To work against that leak, set 'PL_use_safe_putenv = 0;' after perl_construct() call. Attached patch might work. -- banb MAREKR wrote: Show quoted text
> With Perl 5.8.6 and 5.8.7 I see a memory leak in the test of CGI- > SpeedyCGI (see also the posting I did on perl5-porters, > http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2005- > 02/msg00006.html ): > > t/be_memleak..........1..2 > ok > mem usage went from 3672K to 10328K in 1000 runs > not ok > FAILED test 2 > Failed 1/2 tests, 50.00% okay
--- src/speedy_backend_main.c.orig 2003-10-07 13:03:48.000000000 +0900 +++ src/speedy_backend_main.c 2006-12-14 10:29:40.531699151 +0900 @@ -176,6 +176,10 @@ DIE_QUIET("Cannot allocate perl"); perl_construct(my_perl); +#if defined(PL_use_safe_putenv) || defined(PL_Guse_safe_putenv) + PL_use_safe_putenv = 0; +#endif + #ifdef SPEEDY_DEBUG dont_fork = getenv("SPEEDY_NOPARENT") != NULL; #endif
Subject: RE: [rt.cpan.org #13521] Memory leak with Perl >5.8.5
Date: Fri, 17 Aug 2007 09:33:36 +0200
To: <bug-CGI-SpeedyCGI [...] rt.cpan.org>
From: <marek.rouchal [...] infineon.com>
Hi, sorry for the VERY late reply... yes, the suggested fix basically solves the issue. For me it is not entirely solved, but that is another story: Solaris changed the handling of the environment significantly between Solaris 8 and Solaris 10; and when you want to have a Perl binary that runs equally on Solaris 8 and 10, then there's no other choice than using putenv(), which leaks memory. Only a native compile on Solaris 10, using the new setenv() and unsetenv() functions (not available in Solaris 8) will cure the issue once and for all... Many thanks for your help anyway! Cheers, Marek Show quoted text
-----Original Message----- From: banb@yahoo.co.jp via RT [mailto:bug-CGI-SpeedyCGI@rt.cpan.org] Sent: Thursday, December 14, 2006 3:09 AM To: MAREKR@cpan.org Subject: [rt.cpan.org #13521] Memory leak with Perl >5.8.5 <URL: http://rt.cpan.org/Ticket/Display.html?id=13521 > Since Perl 5.8.6, my_setenv() 's behavior in embed-perl changed as if the system has non-leaking putenv() function. So on some architectures, persistent embed perl interpreter produces memory leak. From perl586delta (Also see perl-5.8.*/INSTALL file)
> Changed Internals > > From now on all applications embedding perl will behave > as if perl were compiled with -DPERL_USE_SAFE_PUTENV. > See "Environment access" in the INSTALL file for details.
To work against that leak, set 'PL_use_safe_putenv = 0;' after perl_construct() call. Attached patch might work. -- banb MAREKR wrote:
> With Perl 5.8.6 and 5.8.7 I see a memory leak in the test of CGI- > SpeedyCGI (see also the posting I did on perl5-porters, > http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2005- > 02/msg00006.html ): > > t/be_memleak..........1..2 > ok > mem usage went from 3672K to 10328K in 1000 runs > not ok > FAILED test 2 > Failed 1/2 tests, 50.00% okay