8290020: Deadlock in leakprofiler::emit_events during shutdown

Reviewed-by: mgronlun, dholmes, egahlin
This commit is contained in:
Ludvig Janiuk 2022-07-12 15:54:36 +00:00 committed by Erik Gahlin
parent 7f0e9bd632
commit e8568b890a
6 changed files with 30 additions and 34 deletions

View file

@ -401,7 +401,7 @@ void print_statistics() {
// Note: before_exit() can be executed only once, if more than one threads
// are trying to shutdown the VM at the same time, only one thread
// can run before_exit() and all other threads must wait.
void before_exit(JavaThread* thread) {
void before_exit(JavaThread* thread, bool halt) {
#define BEFORE_EXIT_NOT_RUN 0
#define BEFORE_EXIT_RUNNING 1
#define BEFORE_EXIT_DONE 2
@ -448,7 +448,7 @@ void before_exit(JavaThread* thread) {
event.commit();
}
JFR_ONLY(Jfr::on_vm_shutdown();)
JFR_ONLY(Jfr::on_vm_shutdown(false, halt);)
// Stop the WatcherThread. We do this before disenrolling various
// PeriodicTasks to reduce the likelihood of races.