RFR: JDK-8290020 Deadlock in leakprofiler::emit_events during shutdown [v2]

Markus Grönlund mgronlun at openjdk.org
Thu Jul 14 10:20:03 UTC 2022


On Tue, 12 Jul 2022 13:22:35 GMT, Ludvig Janiuk <duke at openjdk.org> wrote:

>> Add a boolean parameter to Jfr::on_vm_shutdown to differentiate the "called from java" case, and in that case to not call JfrEmergencyDump::on_vm_shutdown.
>
> Ludvig Janiuk has updated the pull request incrementally with one additional commit since the last revision:
> 
>   rm CrasherHald test

Runtime.halt() is tricky in that this method does not cause shutdown hooks to be started. If the shutdown sequence has already been initiated then this method does not wait for any running shutdown hooks to finish their work. This means it could deadlock with the normal Leakprofiler dump logic, issued either by the thread that stops a recording or if the shutdown hooks have already started, with the shutdown hook. It was an oversight to not exclude Runtime.halt() from calling into the emergency dump logic. One could argue that it could be distinguished in that it does not pass the exception handler, so we are not crashing. Unfortunately, that is only one part of the problem because we also attempt to emit the emergency dump in cases of out-of-memory, which is very hard to coordinate correctly.

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

PR: https://git.openjdk.org/jdk/pull/9465


More information about the hotspot-dev mailing list