RFR: 8335836: serviceability/jvmti/StartPhase/AllowedFunctions/AllowedFunctions.java fails with unexpected exit code: 112 [v2]

Serguei Spitsyn sspitsyn at openjdk.org
Fri Aug 2 20:41:31 UTC 2024


On Thu, 1 Aug 2024 22:00:52 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> Serguei Spitsyn has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - fix typo in a comment
>>  - corrections in test ClassPrepare event handler
>
> test/hotspot/jtreg/serviceability/jvmti/StartPhase/AllowedFunctions/libAllowedFunctions.c line 359:
> 
>> 357:     // Block VMDeath event and other ClassPrepare events while this callback is executed.
>> 358:     // Sync with VMDeath event guards agains JVMTI_ERROR WRONG_PHASE.
>> 359:     err = (*jvmti)->RawMonitorEnter(jvmti, event_mon);
> 
> I don't see how this fixes the problem. You can be exiting VMDeath when this monitor is entered. This does not block the get_thread_local() call below, which is what leads to the WRONG_PHASE. I think using a raw monitor is the right approach, but I was expecting to see VMDeath set a flag after grabbing the monitor that indicated VMDeath had been called. Then ClassPrepare should check this flag after grabbing the monitor and ignore the event if it is set.

Thank you for the comment.
Fixed the `get_thread_local()` issue and corrected phase check.
New flag is not really needed as the `phase == JVMTI_PHASE_DEAD` can play its role.
Please, let me know if you are not okay with that.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20397#discussion_r1702299177


More information about the serviceability-dev mailing list