Bug 166364 - Erratic behaviour when system fd limit reached
Summary: Erratic behaviour when system fd limit reached
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: kernel
Version: 3.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Peter Staubach
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks: 168424
TreeView+ depends on / blocked
 
Reported: 2005-08-19 19:38 UTC by Issue Tracker
Modified: 2007-11-30 22:07 UTC (History)
2 users (show)

Fixed In Version: RHSA-2006-0144
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-03-15 16:26:31 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Proposed patch (1.76 KB, patch)
2005-08-26 14:17 UTC, Peter Staubach
no flags Details | Diff
Proposed patch (1.80 KB, patch)
2005-09-20 12:48 UTC, Peter Staubach
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2006:0144 0 qe-ready SHIPPED_LIVE Moderate: Updated kernel packages available for Red Hat Enterprise Linux 3 Update 7 2006-03-15 05:00:00 UTC

Description Issue Tracker 2005-08-19 19:38:44 UTC
Escalated to Bugzilla from IssueTracker

Comment 4 Jakub Jelinek 2005-08-19 23:39:43 UTC
        mkstemp("/var/tmp/mkstempXXXXXX");
This is of course going to fail, no matter whether there are enough file
descriptors or not.
Unless -fwritable-strings (which is deprecated), "/var/tmp/mkstempXXXXXX"
is read-only, but:
"The mkstemp() function shall replace the contents of the string pointed to by
template by a unique filename"
The pointer passed to mkstemp must point into a writable char array.
So
char filename[] = "/var/tmp/mkstempXXXXXX";
mkstemp (filename);
is ok, but
mkstemp ("/var/tmp/mkstempXXXXXX")
is not.

As for open, I haven't tried to reproduce it, but if open really creates
a file even when it returns -1, that would be a POSIX violation.
POSIX on open says:
"No files shall be created or modified if the function returns -1."

If ulimit -n is reached, then open with O_CREAT in my testing doesn't create
the file, but the testcase is about reaching the system wide limit of file
descriptors.

Comment 5 Peter Staubach 2005-08-26 14:17:39 UTC
Created attachment 118155 [details]
Proposed patch

Comment 6 Peter Staubach 2005-08-26 14:36:31 UTC
The problem is the ordering of creating the entry in the directory and
allocating the file struct to reference the file.  The file struct was
getting allocated second, but should be allocated before the directory
entry is created.  Thus, if the allocation fails, then the error can be
returned without creating the directory entry.

Comment 10 Peter Staubach 2005-09-20 12:48:49 UTC
Created attachment 119023 [details]
Proposed patch

Comment 13 Ernie Petrides 2005-09-30 06:41:24 UTC
A fix for this problem has just been committed to the RHEL3 U7
patch pool this evening (in kernel version 2.4.21-37.4.EL).


Comment 16 Red Hat Bugzilla 2006-03-15 16:26:31 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2006-0144.html



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