Skip to content
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

Fix issue in java.lang.Thread.getThreads #15619

Merged
merged 1 commit into from
Jul 28, 2022

Conversation

dnakamura
Copy link
Contributor

Current code holds pointers to thread objects across the call to
allocate the returned array. This results in ptentially returning invalid
pointers if the allocation results in a GC.

Signed-off-by: Devin Nakamura devinn@ca.ibm.com

@dnakamura
Copy link
Contributor Author

Should fix #15321

@tajila
Copy link
Contributor

tajila commented Jul 26, 2022

jenkins test sanity win,plinux jdk19

@pshipton
Copy link
Member

I suspect this may also fix #15355

@pshipton
Copy link
Member

The failures all occur with sanity.openjdk

jenkins test sanity.openjdk all jdk19

gacholio
gacholio previously approved these changes Jul 26, 2022
@gacholio gacholio self-requested a review July 26, 2022 16:22
@gacholio
Copy link
Contributor

Actually, this code is not correct - as soon as exclusive is released, you can no longer depend on the validity of the J9VMThread structures.

@gacholio
Copy link
Contributor

A yuckier (but correct) solution would be to make JNI refs from all of the threadObject values and unwrap them into the final array. Creation of JNI local refs will work while holding exclusive.

Current code holds pointers to thread objects across the call to
allocate the returned array. This results in ptentially returning invalid
pointers if the allocation results in a GC.

Signed-off-by: Devin Nakamura <devinn@ca.ibm.com>
@gacholio
Copy link
Contributor

jenkins test sanity.openjdk win jdk19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants