Bug 89560 - pipe-open() leaks filedescriptor when program fails to execute
pipe-open() leaks filedescriptor when program fails to execute
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: perl (Show other bugs)
2.1
All Linux
medium Severity high
: ---
: ---
Assigned To: Robin Norwood
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-04-24 07:36 EDT by Enrico Scholz
Modified: 2007-11-30 17:06 EST (History)
0 users

See Also:
Fixed In Version: AS2.1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-10-04 14:14:32 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Fixes filedescriptor leak (517 bytes, text/plain)
2003-04-28 21:32 EDT, Enrico Scholz
no flags Details

  None (edit)
Description Enrico Scholz 2003-04-24 07:36:54 EDT
Description of problem:

When using open() to read the output of a program and the execution of the
program fails, perl is leaking a filedescriptor.

E.g. look at fd 3 in:

| $ strace perl -e 'open(FH, "/NOT-THERE |"); close FH; waitpid -1,0;'
| ...
| pipe([3, 4])                            = 0
| pipe([5, 6])                            = 0
| fork()                                  = 22128
| close(4)                                = 0
| close(6)                                = 0
| read(5, "\2\0\0\0", 4)                  = 4
| close(5)                                = 0
| wait4(-1, [WIFEXITED(s) && WEXITSTATUS(s) == 1], 0, NULL) = 22128
| --- SIGCHLD (Child exited) ---
| rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
| _exit(0)                                = ?

fd 3 will be created by the pipe() syscall but never be closed.

perl-5.8 is closing it automatically and perl-5.0 returns the filedescriptor in
'FH'. But with the shipped perl-5.6.1 there does not exist a way to close it.


IMO this is a very critical bug; it brought down some of my servers running a
perl-based monitoring software.



Version-Release number of selected component (if applicable):

perl-5.6.1-34.99.6


How reproducible:

100%
Comment 1 Enrico Scholz 2003-04-28 21:32:28 EDT
Created attachment 91376 [details]
Fixes filedescriptor leak

This patch contains backported code from 5.8.0 and fixes the
filedescriptor-leak. As a side-effect, a zombie-process will be prevented also.
Comment 3 Jason Vas Dias 2006-04-21 21:25:42 EDT
fixed with perl-5.6.1-38.EL2_1
Comment 4 Robin Norwood 2006-10-01 19:30:00 EDT
assigning to rnorwood@redhat.com

Note You need to log in before you can comment on or make changes to this bug.