[JDK21] Fix jvmtiSuspendThread and jvmtiGetCarrierThread - #17999
Merged
Conversation
An unmounted virtual thread has no carrier thread. targetThread is NULL for an unmounted virtual thread. A NULL check has been added for the targetThread to prevent a segfault. Related: eclipse-openj9#17933 Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
babsingh
marked this pull request as ready for review
August 22, 2023 20:54
Contributor
Author
|
@gacholio Requesting your review. |
gacholio
reviewed
Aug 22, 2023
getVMThread can cause a deadlock for a virutal thread if the thread is already suspended. The suspended virtual thread halts during the mount or unmount phase while the virtualThreadInspectorCount is set to -1. Meanwhile, acquireVThreadInspector waits indefinitely for the virtualThreadInspectorCount to be set to 0 in the mount or unmount phase. To prevent the deadlock, jvmtiSuspendThread should return an error for already suspended threads without invoking getVMThread -> acquireVThreadInspector. This approach an be taken for both platform and virtual threads. Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
gacholio
approved these changes
Aug 23, 2023
Contributor
|
jenkins compile win jdk8 |
Contributor
|
jenkins test sanity zlinux jdk21 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Commit 1: Fix deadlock that occurs while suspending threads through JVMTI
getVMThread can cause a deadlock for a virutal thread if the thread is
already suspended. The suspended virtual thread halts during the mount
or unmount phase while the virtualThreadInspectorCount is set to -1.
Meanwhile, acquireVThreadInspector waits indefinitely for the
virtualThreadInspectorCount to be set to 0 in the mount or unmount
phase. To prevent the deadlock, jvmtiSuspendThread should return an
error for already suspended threads without invoking
getVMThread -> acquireVThreadInspector. This approach an be taken for
both platform and virtual threads.
Commit 2: Fix jvmtiGetCarrierThread
An unmounted virtual thread has no carrier thread.
targetThread is NULL for an unmounted virtual thread.
A NULL check has been added for the targetThread to prevent a segfault.
Related: #17933
Signed-off-by: Babneet Singh sbabneet@ca.ibm.com