-
Bug
-
Resolution: Fixed
-
P4
-
9
-
b116
-
linux, os_x, aix
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8236662 | openjdk8u252 | Thomas Stuefe | P4 | Resolved | Fixed | b01 |
JDK-8340485 | 8u441 | Sean Coffey | P4 | Resolved | Fixed | b01 |
In linux_close.c - and similarily in bsd_close.c and aix_close.c - an array (fdTable) is used to keep an information record and a mutex per opened file descriptor. This array gets allocated at the start of the process.
In order to guess on the size of the table, getrlimit(RLIMIT_NO_FILE) is used.
There are some problems with this approach:
1) There is no handling for an infinite limit. Depending on what the numerical value is for RLIM_INFINITY, allocation of the file descriptor table may fail at this point (RLIM_INFINITY=-1) or be very small (RLIM_INFINITY=0). This may lead to file descriptors not covered by the whole wakeup mechanism implemented in this file, and hence to hanging threads.
2) For large - but not infinite - values of RLIMIT_NO_FILE, the memory usage is excessive. On Linux x64, each entry in the table is ~ 50Bytes; for a limit of 1000000, this eats up 50MB. Most of this memory is usually never used.
In order to guess on the size of the table, getrlimit(RLIMIT_NO_FILE) is used.
There are some problems with this approach:
1) There is no handling for an infinite limit. Depending on what the numerical value is for RLIM_INFINITY, allocation of the file descriptor table may fail at this point (RLIM_INFINITY=-1) or be very small (RLIM_INFINITY=0). This may lead to file descriptors not covered by the whole wakeup mechanism implemented in this file, and hence to hanging threads.
2) For large - but not infinite - values of RLIMIT_NO_FILE, the memory usage is excessive. On Linux x64, each entry in the table is ~ 50Bytes; for a limit of 1000000, this eats up 50MB. Most of this memory is usually never used.
- backported by
-
JDK-8236662 (linux|bsd|aix)_close.c: file descriptor table may become large or may not work at all
- Resolved
-
JDK-8340485 (linux|bsd|aix)_close.c: file descriptor table may become large or may not work at all
- Resolved
- relates to
-
JDK-8006395 Race in async socket close on Linux
- Closed