-
Notifications
You must be signed in to change notification settings - Fork 729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jdk19 OpenJDK timeout with call to VirtualThread.notifyJvmtiUnmountBegin #16340
Comments
FYI There is no evidence so far (GC does not block during Unmount) but potentially it might be regression from #16290. Would somebody from VM team triage it first please to be sure what scenario we have deal with? |
https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_sanity.openjdk_x86-64_mac_Nightly/52/ Timeout, no diagnostics. |
https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_sanity.openjdk_x86-64_windows_Nightly/55
|
There are different reasons for the timeouts. IssueFirst one: I was able to reproduce the
This is a classic deadlock. Thread 1 wants @amicic @dmitripivkine @gacholio Is there a variant of Core file, gdb and jdmpview outputhttps://ibm.box.com/shared/static/liii5foobatpj5dyym2ueigmi8zh63eg.zip GBD output
|
There is J9AllocateObjectNoGC that will return NULL, rather than trigger GC (hence not request exclusive VM access) |
This is not a real solution - if it returns NULL you'll have to abort the VM. |
Can you allocate the object without acquiring the mutex? After acquiring the mutex, if the object has already been allocated by another thread, just leave newly-allocated one to die. The standard check before mutex should make this infrequent, i.e. before acquiring the mutex, see if the head object is already allocated. |
Even better, why not just allocate the head at VM startup? |
After having a look at the code, and understanding the nature of this alloc, seems like this allocate is only on first mount, so likely should be able to do it early at startup, what @babsingh was already suggesting. |
re #16340 (comment) and #16340 (comment): Both solutions should be feasible. I am leaning towards VM startup, which was also previously mentioned in #16340 (comment). |
Remember in general that VM access should be treated like a mutex. Acquiring exclusive may release and reacquire VM access, so holding any mutex going for exclusive (and by extension allocating an object) is invalid. |
Continuing #16340 (comment) ... There are different reasons for the timeouts. The second timeout happens at This timeout was also previously discussed in the following comments:
Symptoms:
Two possible scenarios which can create the above symptoms:
@fengxue-IS Thoughts? In jdmpview output |
The two methods ( So Scenario 1 is not possible, since if
Maybe, I am not sure how exposed is |
|
I believe that it is the same. So, it won't be possible for two threads to concurrently invoke Related code: openj9/jcl/src/java.base/share/classes/java/lang/Access.java Lines 586 to 600 in 55c52ff
|
https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_sanity.openjdk_ppc64_aix_Nightly/55
https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_sanity.openjdk_x86-64_linux_Nightly/55
|
https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_sanity.openjdk_x86-64_mac_Nightly/54 No diagnostics. https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_sanity.openjdk_x86-64_windows_Nightly/56 No diagnostics. |
https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_sanity.openjdk_x86-64_windows_Nightly/57 https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_sanity.openjdk_aarch64_mac_Nightly/60 No diagnostics |
This change fixes the below deadlock. Thread 1 wants exclusive VM access but it is unable to acquire exclusive VM access because Thread 2 also holds VM access. Thread 2 is waiting to acquire liveVirtualThreadListMutex and unable to proceed because Thread 1 holds liveVirtualThreadListMutex. This prevents both threads to proceed and leads to a deadlock. Thread 1: JVM_VirtualThreadMountEnd -> Acquires VM Access and liveVirtualThreadListMutex -> J9AllocateObject -> Multiple GC frames -> acquireExclusiveVMAccess Thread 2: JVM_VirtualThreadMountEnd -> Acquires VM Access -> Blocked to enter liveVirtualThreadListMutex Related: eclipse-openj9#16340 Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_sanity.openjdk_ppc64_aix_Nightly/61/ https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_sanity.openjdk_ppc64le_linux_Nightly/60 https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_sanity.openjdk_s390x_linux_Nightly/63 |
This change fixes the below deadlock. Thread 1 wants exclusive VM access but it is unable to acquire exclusive VM access because Thread 2 also holds VM access. Thread 2 is waiting to acquire liveVirtualThreadListMutex and unable to proceed because Thread 1 holds liveVirtualThreadListMutex. This prevents both threads to proceed and leads to a deadlock. Thread 1: JVM_VirtualThreadMountEnd -> Acquires VM Access and liveVirtualThreadListMutex -> J9AllocateObject -> Multiple GC frames -> acquireExclusiveVMAccess Thread 2: JVM_VirtualThreadMountEnd -> Acquires VM Access -> Blocked to enter liveVirtualThreadListMutex Related: eclipse-openj9#16340 Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
closing the issue as the fix is in |
There are other earlier occurrences of this failure in comments of #16259
Other tests where this has been seen (Windows, xlinux, zlinux):
java/lang/Thread/virtual/HoldsLock.java
java/lang/Thread/virtual/stress/GetStackTraceALot.java#id0
https://openj9-jenkins.osuosl.org/job/Test_openjdk19_j9_sanity.openjdk_ppc64_aix_Nightly/52
jdk_lang_0
java/lang/Thread/virtual/ParkWithFixedThreadPool.java
Timeout.
https://openj9-artifactory.osuosl.org/artifactory/ci-openj9/Test/Test_openjdk19_j9_sanity.openjdk_ppc64_aix_Nightly/52/openjdk_test_output.tar.gz
The text was updated successfully, but these errors were encountered: