RFR: 8343285: java.lang.Process is unresponsive and CPU usage spikes to 100%
Aleksey Shipilev
shade at openjdk.org
Tue Nov 12 16:40:17 UTC 2024
On Fri, 8 Nov 2024 19:08:28 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:
> We lower the max value of allowed file descriptors on macOS to match that of Linux, i.e. 0x100000 (1,048,576).
>
> Background:
>
> On JDK22 and earlier the limit on maximum number of file descriptors allowed in Java process on macOS was 10,240. We increased it in jdk23 to unlimited value (MAX_LONG), as allowed by the os, but that caused a crash in KSH, so we then lowered it to MAX_INT (so it wouldn't overflow an int).
>
> Then we noticed that we had code in jdwp agent that would iterate over all allowed file descriptors trying to close them all, which would time out internal tests, because it was taking so long. We fixed this in jdwp, so that we only close actual opened file descriptors - see https://github.com/openjdk/jdk/commit/a6632487863db5ff3136cdcc76b7440c15ce6be9#diff-1a48137c6688c91d10f931b3e37e4b961b24748fbcb2906d629807aea53db80fR71
>
> However, there are other external jdk clients, that do the exact same thing and their java processes also appear to hang closing all allowed file descriptors.
>
> Since `MaxFDLimit` is ON by default, we have no other choice, but to lower the value, so it doesn't cause regressions. With this new max value, closing all file descriptors on an old x86_64 machine takes under 1 second on macOS (and Linux).
>
> Testing: in progress...
Marked as reviewed by shade (Reviewer).
-------------
PR Review: https://git.openjdk.org/jdk/pull/21992#pullrequestreview-2430130732
More information about the hotspot-runtime-dev
mailing list