Skip to content

(0.51) Pin virtual threads while they hold raw monitors#21510

Merged
tajila merged 1 commit intoeclipse-openj9:v0.51.0-releasefrom
babsingh:v0.51.0-release-v2
Mar 28, 2025
Merged

(0.51) Pin virtual threads while they hold raw monitors#21510
tajila merged 1 commit intoeclipse-openj9:v0.51.0-releasefrom
babsingh:v0.51.0-release-v2

Conversation

@babsingh
Copy link
Copy Markdown
Contributor

Our current implementation uses J9VMThread->ownedMonitorCount to
track both object monitors and raw monitors owned by a virtual thread.

The RI pins a virtual thread while it holds a raw monitor. Our current
implementation allows a virtual thread to be unmounted and remounted
while holding a raw monitor. This causes J9ThreadMonitor->owner to
become invalid, as the virtual thread's J9Thread changes during the
unmount and remount phases.

Currently, there is no way to track which raw monitors a virtual
thread owns. This prevents us from fixing J9ThreadMonitor->owner
for raw monitors when a virtual thread is unmounted and remounted.

To match the RI, continuationPinCount will be used instead of
ownedMonitorCount to pin a virtual thread when it acquires a raw
monitor.

Fixes: #21409

Backport of #21503

Our current implementation uses J9VMThread->ownedMonitorCount to
track both object monitors and raw monitors owned by a virtual thread.

The RI pins a virtual thread while it holds a raw monitor. Our current
implementation allows a virtual thread to be unmounted and remounted
while holding a raw monitor. This causes J9ThreadMonitor->owner to
become invalid, as the virtual thread's J9Thread changes during the
unmount and remount phases.

Currently, there is no way to track which raw monitors a virtual
thread owns. This prevents us from fixing J9ThreadMonitor->owner
for raw monitors when a virtual thread is unmounted and remounted.

To match the RI, continuationPinCount will be used instead of
ownedMonitorCount to pin a virtual thread when it acquires a raw
monitor.

Fixes: eclipse-openj9#21409

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
@babsingh babsingh requested a review from tajila March 27, 2025 21:24
@pshipton pshipton changed the title Pin virtual threads while they hold raw monitors (0.51) Pin virtual threads while they hold raw monitors Mar 27, 2025
babsingh added a commit to babsingh/aqa-tests that referenced this pull request Mar 27, 2025
HEAD fix: eclipse-openj9/openj9#21503
0.51 fix: eclipse-openj9/openj9#21510

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
babsingh added a commit to babsingh/aqa-tests that referenced this pull request Mar 27, 2025
HEAD fix: eclipse-openj9/openj9#21503
0.51 fix: eclipse-openj9/openj9#21510

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
babsingh added a commit to babsingh/aqa-tests that referenced this pull request Mar 27, 2025
HEAD fix: eclipse-openj9/openj9#21503
0.51 fix: eclipse-openj9/openj9#21510

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
karianna pushed a commit to adoptium/aqa-tests that referenced this pull request Mar 28, 2025
HEAD fix: eclipse-openj9/openj9#21503
0.51 fix: eclipse-openj9/openj9#21510

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
karianna pushed a commit to adoptium/aqa-tests that referenced this pull request Mar 28, 2025
HEAD fix: eclipse-openj9/openj9#21503
0.51 fix: eclipse-openj9/openj9#21510

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
@tajila tajila merged commit 2ff585f into eclipse-openj9:v0.51.0-release Mar 28, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants