Hi Serguei, I think that just disabling event notifications inside VMDeath callback still leaves a small window for VMDeath callback being called after the classload callback is called (or about being called) but before it enters a raw monitor. Thus I decided to follow your original suggestion and restore volatile modifier for callbacksEnabled. Please review a new version of the patch.
Webrev: http://cr.openjdk.java.net/~dtitov/8218401/webrev.03/ Bug : https://bugs.openjdk.java.net/browse/JDK-8218401 Thanks! Best regards, Daniil From: <[email protected]> Organization: Oracle Corporation Date: Tuesday, March 19, 2019 at 7:17 PM To: Daniil Titov <[email protected]>, OpenJDK Serviceability <[email protected]>, Jean Christophe Beyler <[email protected]> Subject: Re: 8218401: WRONG_PHASE: vmTestbase/nsk/jvmti test crash Hi Daniil, I'd keep the volatile modifier for callbacksEnabled to disable compiler optimizations. Otherwise, looks good to me. Another approach could be to disable event notifications in VMDeath callback with: SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_LOAD, NULL); SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_BREAKPOINT, NULL); . . . Thanks, Serguei On 3/18/19 6:58 PM, Daniil Titov wrote: Hi Serguei and JC, Please review a new version of the fix that locks a monitor across the callbacks, as Serguei suggested. Webrev: http://cr.openjdk.java.net/~dtitov/8218401/webrev.02/ Bug: https://bugs.openjdk.java.net/browse/JDK-8218401 Thanks! --Daniil On 3/18/19, 9:47 AM, mailto:[email protected] mailto:[email protected] wrote: Hi Daniil, The JVMTI phase can change in the middle of callback work after the check you added. I'd suggest to lock a raw monitor across the callbacks to make them atomic. Thank you for taking care about this issue! Thanks, Serguei On 3/15/19 16:08, Daniil Titov wrote: > Please review the change that fixes 3 tests that intermittently fail with JVMTI_ERROR_WRONG_PHASE error. > > The problem here is that the callbacks these tests enable keep processing events and perform JVMTI calls after VM is terminated. The fix makes these test listen for VMDeath event and quick return from the callbacks after VMDeath event is received. > > Webrev: http://cr.openjdk.java.net/~dtitov/8218401/webrev.01/ > Bug: https://bugs.openjdk.java.net/browse/JDK-8218401 > > Thanks! > -Daniil > >
