-
Enhancement
-
Resolution: Fixed
-
P3
-
15
-
b05
-
generic
-
generic
There exists a function os::fopen in HS code . This function sets "close-on-exec" flags (when possible) to the opened filedescriptor.
It might have some benefits to use os::fopen more in HS code, currently there are still quite a few calls directly to fopen .
see also the thread
https://mail.openjdk.java.net/pipermail/hotspot-dev/2020-January/040641.html
on hotspot-dev about the topic.
Comment from Thomas Stuefe :
Just a note, it is still possible for file descriptors to escape into child processes since you cannot guarantee that all forks happen via Runtime.exec():
- native third party code may fork.
- hotspot may fork to run tools for error reporting
Also note that the code which closes fds in Runtime.exec() may in theory fail to close all fds.
It might have some benefits to use os::fopen more in HS code, currently there are still quite a few calls directly to fopen .
see also the thread
https://mail.openjdk.java.net/pipermail/hotspot-dev/2020-January/040641.html
on hotspot-dev about the topic.
Comment from Thomas Stuefe :
Just a note, it is still possible for file descriptors to escape into child processes since you cannot guarantee that all forks happen via Runtime.exec():
- native third party code may fork.
- hotspot may fork to run tools for error reporting
Also note that the code which closes fds in Runtime.exec() may in theory fail to close all fds.
- relates to
-
JDK-8202720 (process) Clarify file handler behaviour
-
- Open
-