RFR: JDK-8327468: Do not restart close if errno is EINTR [macOS/linux]

David Holmes dholmes at openjdk.org
Mon Mar 11 04:55:53 UTC 2024


On Fri, 8 Mar 2024 12:12:30 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> src/jdk.attach/linux/native/libattach/VirtualMachineImpl.c line 200:
>> 
>>> 198:     if (res == -1) {
>>> 199:         JNU_ThrowIOExceptionWithLastError(env, "close");
>>> 200:     }
>> 
>> I assume it would be better to not throw when errno is EINTR. If there is a profiler or some other tool firing signals at threads then there isn't anything that can be done here.
>
> Should I just ignore the result / return code of close and avoid throwing an exception completely ?

I would just ignore any error on close in this case and treat it as a best-effort attempt at closing the fd. The close could be successful even if an error is reported; conversely if a signal-based profiler is used (whether they use SA_RESTART or not) we don't want the profiler's actions to cause application/library exceptions.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18164#discussion_r1519155640


More information about the serviceability-dev mailing list