Skip to content

Commit

Permalink
Incorporate feedback/suggestion from David Holmes:
Browse files Browse the repository at this point in the history
- Change the flag to be expressed as the number of 10ms chunks (i.e. number of wait attempts) to wait.
- Limit the max allowed wait to 10s. That's 1000 wait attempts with each attempt=10ms.
  • Loading branch information
jianglizhou committed Nov 13, 2023
1 parent 173d2ad commit 8a02e7e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/hotspot/share/runtime/globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -835,10 +835,12 @@ const int ObjectAlignmentInBytes = 8;
"JVM aborts, producing an error log and core/mini dump, on the " \
"first occurrence of an out-of-memory error thrown from JVM") \
\
product(intx, WaitUserThreadAtExitTimeout, 300, \
"Maximum delay in milliseconds at exit waiting for user threads " \
"in native") \
range(0, max_intx) \
product(intx, UserThreadWaitAttemptsAtExit, 30, \
"Number of attempts waiting for user threads in native during " \
"JVM exit. Each wait attempt is 10-millisecond. The max allowed " \
"wait attempts for user threads in native is 1000, which is " \
"10 seconds.") \
range(0, 1000) \
\
/* tracing */ \
\
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/runtime/vmOperations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,7 @@ int VM_Exit::wait_for_threads_in_native_to_block() {
// better to terminate VM when current thread is the only active thread, so
// wait for user threads too. Numbers are in 10 milliseconds.
int wait_time_per_attempt = 10; // in milliseconds
int max_wait_attempts_user_thread =
WaitUserThreadAtExitTimeout / wait_time_per_attempt;
int max_wait_attempts_user_thread = UserThreadWaitAttemptsAtExit;
int max_wait_attempts_compiler_thread = 1000; // at least 10 seconds

int attempts = 0;
Expand Down

0 comments on commit 8a02e7e

Please sign in to comment.