From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.3) Gecko/20050104 Red Hat/1.4.3-3.0.7 Description of problem: I have a long running daemon process written in perl that makes heavy use of perl's eval function. I noticed a memory leak and after some debugging have narrowed the leak down to the eval statement. Here is a simple test script which exhibits the same memory leak: #!/usr/bin/perl $t=10; while (1) { $x=int(rand(20)); if (eval "$x > $t") { print "$x > $t = 1\n" } else { print "$x > $t = 0\n" } } Version-Release number of selected component (if applicable): perl-5.8.0-89.10 How reproducible: Always Steps to Reproduce: 1. run test script. 2. repeatedly look at the process memory usage using ps and watch it grow. 3. kill the script before the system runs out of memory. Actual Results: Process leaks memory. Expected Results: Process should not leak memory. Additional info: I have tested the same script on other systems (AIX, Solaris & debian), which have different versions of perl installed and none of them leak memory. Using the second form of eval with the {BLOCK}, which is parsed only once, does not leak memory.
I should also add that I cannot use the once-parsed {BLOCK} format of eval since my code actually has a test expression which changes in a variable like this: $t='> 10'; with an eval statement like: if (eval "$x $t") ....
Is there a proposed date for fixing this? We too have been burned... Thanks a lot, Marilyn Safran marilyn.safran.il
We also have a support ticket open for this problem (issue #68865). There RedHat has verified that the leak exists on perl 5.8.0 only. I think it was fixed in perl 5.8.1 and above, but the exact cause and fix is difficult to extract from the major changes that went into core perl with respect to eval: http://www.mail-archive.com/perl5-changes@perl.org/msg05868.html I believe right now RH is thinking of building a new perl package based on a newer upstream version of perl for us to test. I assume that if this fixes the problem and doesn't break anything else then it might go into a future RHEL3 update, maybe U6 or later.... Another possible option is to upgrade to RHEL4 which comes with perl-5.8.5, since it doesn't suffer from this eval memory leak. ~Jason
Thanks for the info. Marilyn
A possible perl update package would probably be 5.8.5, because 5.8.1 is known to break ABI, and it would be less of a maintenance burden in the long term to make it match RHEL4's 5.8.5. Every perl version in 5.8.x is supposed to be ABI compatible (5.8.1 screwed up), so modules built on 5.8.0 *theoretically* will work on 5.8.5. There are however several other contributing factors (like gcc or other libraries) that might complicate things.
Ok as for this bug, it is not going to be fixed. The possible fix is too complicated for an update release and there is still a possibility to upgrade to rhel4 or upgrade perl only (the latter is however completely unsupported by redhat). The bug only affects limited number of systems so those should be dealt with on a case-by-case basis. There is an UNOFFICIAL backport from rhel4 at http://people.redhat.com/prockai/perl-rhel3-backport/ -- it is there to help you if you need rhel3 with a fixed perl release, but i should reiterate that it is completely UNSUPPORTED. The preferred solution, if possible, would be to upgrade to rhel4. I am sorry about this, but it is about as much as can be done.