RFR: 8284632: runtime/Thread/StopAtExit.java possibly leaking memory again [v2]
Daniel D.Daugherty
dcubed at openjdk.java.net
Fri Apr 29 16:59:26 UTC 2022
> Throwing async exceptions at exiting JavaThreads can leak the exception:
>
> 1) HandshakeOperation::do_handshake() recognizes that the target thread
> might be terminated, but needs to do some cleanup when the operation
> is one that installs an async exception.
>
> 2) JavaThread::exit() uses a NoAsyncExceptionDeliveryMark to protect the
> VM's call out to Thread::exit() from async exceptions, but it needs to do
> some cleanup when those async exceptions cannot be delivered because
> the target thread has logically exited.
>
> Also tweaked runtime/Thread/StopAtExit.java to alternate between throwing
> RuntimeException and ThreadDeath. The async exception queuing code accepts
> any exception, but it recognizes ThreadDeath as special. When a target thread
> already has a queued async ThreadDeath exception, then another exception will
> not be queued. So the test now throws RuntimeException on odd iterations and
> ThreadDeath on even iterations and the target thread will have at most two async
> exceptions queued up.
>
> This fix has been tested with Mach5 Tier[1-7] (about to start a Tier8) and I also ran
> my StressWrapper_StopAtExit.java test using {release, fastdebug, and slowdebug}
> bits for 12 hours per config. No leaks detected. Previously, release bits would
> fail with OutOfMemoryException in ~2 minutes with StressWrapper_StopAtExit.java.
Daniel D. Daugherty has updated the pull request incrementally with one additional commit since the last revision:
pchilano, robehn, dholmes-ora - CR changes
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/8388/files
- new: https://git.openjdk.java.net/jdk/pull/8388/files/5869a636..f5e59644
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8388&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8388&range=00-01
Stats: 115 lines in 4 files changed: 45 ins; 58 del; 12 mod
Patch: https://git.openjdk.java.net/jdk/pull/8388.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/8388/head:pull/8388
PR: https://git.openjdk.java.net/jdk/pull/8388
More information about the hotspot-runtime-dev
mailing list