Bug 166364 - Erratic behaviour when system fd limit reached
Erratic behaviour when system fd limit reached
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: kernel (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Peter Staubach
Brian Brock
Depends On:
Blocks: 168424
  Show dependency treegraph
Reported: 2005-08-19 15:38 EDT by Issue Tracker
Modified: 2007-11-30 17:07 EST (History)
2 users (show)

See Also:
Fixed In Version: RHSA-2006-0144
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-03-15 11:26:31 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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

  None (edit)
Description Issue Tracker 2005-08-19 15:38:44 EDT
Escalated to Bugzilla from IssueTracker
Comment 4 Jakub Jelinek 2005-08-19 19:39:43 EDT
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.
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
Comment 5 Peter Staubach 2005-08-26 10:17:39 EDT
Created attachment 118155 [details]
Proposed patch
Comment 6 Peter Staubach 2005-08-26 10:36:31 EDT
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 08:48:49 EDT
Created attachment 119023 [details]
Proposed patch
Comment 13 Ernie Petrides 2005-09-30 02:41:24 EDT
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 11:26:31 EST
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.


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