Skip Menu |

This queue is for tickets about the Env-C CPAN distribution.

Report information
The Basics
Id: 95366
Status: rejected
Priority: 0/
Queue: Env-C

People
Owner: Nobody in particular
Requestors: GVL [...] cpan.org
Cc:
AdminCc:

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



Subject: leak.t fails on SuSE
The leak.t test fails on SuSE > 12.1 standard installation. build.log from cpanm attached, tested on SuSE 13.1.
Subject: build.log
Download build.log
application/octet-stream 7.5k

Message body not shown because it is not plain text.

On Mon May 05 05:51:46 2014, GVL wrote: Show quoted text
> The leak.t test fails on SuSE > 12.1 standard installation. build.log > from cpanm attached, tested on SuSE 13.1.
Confirmed in vagrant. Actually has nothing to do with Env::C. If you simply run a tight loop like this in a perl script all by itself: ----------- for (1..3000000) { $ENV{TZ} = 'GMT'; $ENV{TZ} = ''; } ----------- The process grows considerably (to over 200MB in my test case). I build 5.18.2 in perlbrew, and it does not leak, using only -Accflags=-fPIC -Dusethreads. So this seems to be caused by any of: - opensuse patches applied to perl - different perl build flags used by opensuse Haven't had time to dig further into this yet so I know where to report upstream :)
On Mon May 05 11:42:58 2014, MSCHOUT wrote: Show quoted text
> - different perl build flags used by opensuse
Opensuse sets -DPERL_USE_SAFE_PUTENV I built another 5.18.2 in perlbrew with -Accflags=-DPERL_USE_SAFE_PUTENV and it leaks just like the system perl does. So this is apparently caused by PERL_USE_SAFE_PUTENV
Ok, Fedora ticket about this is: https://bugzilla.redhat.com/show_bug.cgi?id=575842 See also upstream https://rt.perl.org/Public/Bug/Display.html?id=73672 The short answer is that Suse has chosen to use the system putenv() in perl (which is what -DPERL_USE_SAFE_PUTENV does). Unfortunately, the C library putenv() leaks memory (see description in Perl ticket #73672). Fedora fixed this issue by compiling perl without -DPERL_USE_SAFE_PUTENV, and I can confirm that works on Suse also. I do not know what Suse's reasons are for building with PERL_USE_SAFE_PUTENV, but that is definately the problem here. Closing this ticket as not related to Env::C (its a perl/putenv interaction issue), and should be fixed upstream (probably by removing PERL_USE_SAFE_PUTENV as Fedora did). Example script to show how the memory grows with no Env::C usage at all: ---------------- #!/usr/bin/perl -w use strict; for (my $i = 1; 1; $i++) { do { local %ENV = %ENV; # <==== this is the leak ! $ENV{HOME} = "/tmp"; }; print " --->> $i iterations --- mem used --->> ", memsize($$), "\n" unless $i % 10000; } sub memsize { my ($pid) = @_; open my $fh, '<', "/proc/$pid/status" or die $!; local $_; while (<$fh>) { chomp; return $1 if /^VmRSS:\s+(\d+)\D+$/; } } ----------------