Bug 89560 - pipe-open() leaks filedescriptor when program fails to execute
Summary: pipe-open() leaks filedescriptor when program fails to execute
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 2.1
Classification: Red Hat
Component: perl   
(Show other bugs)
Version: 2.1
Hardware: All
OS: Linux
medium
high
Target Milestone: ---
Assignee: Robin Norwood
QA Contact: David Lawrence
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-04-24 11:36 UTC by Enrico Scholz
Modified: 2007-11-30 22:06 UTC (History)
0 users

Fixed In Version: AS2.1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-10-04 18:14:32 UTC
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-29 01:32 UTC, Enrico Scholz
no flags Details

Description Enrico Scholz 2003-04-24 11:36:54 UTC
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-29 01:32:28 UTC
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-22 01:25:42 UTC
fixed with perl-5.6.1-38.EL2_1

Comment 4 Robin Norwood 2006-10-01 23:30:00 UTC
assigning to rnorwood@redhat.com


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