openj9 icon indicating copy to clipboard operation
openj9 copied to clipboard

Update jvmtiGetThreadGroupChildren for java 19

Open EricYangIBM opened this issue 2 years ago • 15 comments

The ThreadGroup class does not store its threads anymore and child groups are separated into "groups" and "weaks" ThreadGroup arrays.

The child ThreadGroups array is populated from the ThreadGroup's "groups" and "weaks" arrays, which are the child ThreadGroups that are strongly and weakly reachable from the parent.

The threads array is constructed by iterating over all J9VMThreads and adding the threads that belong in the given ThreadGroup.

The returned arrays are constructed while locking on the ThreadGroup object.

Fixes: #15244 Issue: #15183 Signed-off-by: Eric Yang [email protected]

EricYangIBM avatar Jul 13 '22 19:07 EricYangIBM

Test in linked issue passes with these changes

EricYangIBM avatar Jul 19 '22 16:07 EricYangIBM

@EricYangIBM The commits can be squashed.

@tajila These changes should work fine. But, still doubtful about the memory allocated for threads and groups arrays which are returned from this method (see comments inlined in code). Should we create new arrays with smaller/required size and copy the elements from the bigger array and free the bigger array?

babsingh avatar Jul 20 '22 19:07 babsingh

But, still doubtful about the memory allocated for threads and groups arrays which are returned from this method (see comments inlined in code). Should we create new arrays with smaller/required size and copy the elements from the bigger array and free the bigger array?

This is not going to return vthreads correct? If so, then I dont think returning a potentially larger buffer is a big deal as platform threads arent created as frequently

tajila avatar Aug 04 '22 18:08 tajila

It could be an optimization that is added later

tajila avatar Aug 04 '22 18:08 tajila

This is not going to return vthreads correct?

Vthreads will not be returned. See ref below. @EricYangIBM Can you add a comment in code and open an issue regarding this optimization for tracking purposes?

Ref: https://download.java.net/java/early_access/jdk19/docs/specs/jvmti.html#GetThreadGroupChildren

babsingh avatar Aug 04 '22 18:08 babsingh

I will open the issue after this PR is merged (to link to the comment)

EricYangIBM avatar Aug 04 '22 19:08 EricYangIBM

LGTM. The commits need to be squashed before the PR builds are launched.

babsingh avatar Aug 04 '22 19:08 babsingh

Squashed

EricYangIBM avatar Aug 04 '22 19:08 EricYangIBM

jenkins compile win jdk19,jdk17

babsingh avatar Aug 04 '22 19:08 babsingh

Does not work for me yet. Need to wait for @AdamBrousseau to add me.

babsingh avatar Aug 04 '22 19:08 babsingh

jenkins compile win jdk19,jdk17

babsingh avatar Aug 05 '22 14:08 babsingh

jenkins test sanity amac jdk19,jdk17

babsingh avatar Aug 05 '22 15:08 babsingh

These JVMTI changes should only impact the gtgc001 test, which has been enabled and passes for JDK17 and JDK19.

https://openj9-jenkins.osuosl.org/job/Test_openjdk17_j9_sanity.functional_aarch64_mac_Personal/75/

jit_vich_0_FAILED is unrelated to this PR. All tests in this suite pass but there is an error at the end (Invalid JIT return address).

===============================================
JIT_Test suite
Total tests run: 18, Failures: 0, Skips: 0
===============================================

*** Invalid JIT return address 000000037A4175E0 in 000000016FBDFD98

jit_vich_0_FAILED

babsingh avatar Aug 05 '22 17:08 babsingh

Still can't merge the PR. Need to wait for @AdamBrousseau to give the required permissions.

babsingh avatar Aug 05 '22 17:08 babsingh

Still can't merge the PR

This is an Eclipse Github team thing. It should be automatic. If it's not working then I would open an Eclipse ticket. https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues?sort=created_date&state=opened

AdamBrousseau avatar Aug 05 '22 17:08 AdamBrousseau