[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-serviceability-dev
Subject:    Re: 8218401: WRONG_PHASE: vmTestbase/nsk/jvmti test crash
From:       Daniil Titov <daniil.x.titov () oracle ! com>
Date:       2019-03-21 17:17:23
Message-ID: CE652D66-D825-4A0D-9620-269C289FAEC4 () oracle ! com
[Download RAW message or body]

Thank you, JC and Serguei, for reviewing this change.

 

Best regards,

Daniil

 

From: Jean Christophe Beyler <jcbeyler@google.com>
Date: Thursday, March 21, 2019 at 9:29 AM
To: Daniil Titov <daniil.x.titov@oracle.com>
Subject: Re: FW: 8218401: WRONG_PHASE: vmTestbase/nsk/jvmti test crash

 

Hi Daniil,

 

Sorry yes it looks great to me :-)

 

My only nit would be : "callbacksEnabled" is camel backed and should probably be \
callbacks_enabled for c++ code, but that's a nit ;-)

Jc

 

On Thu, Mar 21, 2019 at 9:26 AM Daniil Titov <daniil.x.titov@oracle.com> wrote:

Hi JC,

Just wanted to check with you that you are also OK with this version of the fix.

Webrev: http://cr.openjdk.java.net/~dtitov/8218401/webrev.03 
Bug : https://bugs.openjdk.java.net/browse/JDK-8218401 

Thanks!
--Daniil


On 3/20/19, 4:50 PM, "serguei.spitsyn@oracle.com" <serguei.spitsyn@oracle.com> \
wrote:

    Hi Daniil,

    You are right, there is a hole for this.

    It can be easily fixed if the callbacks check phase at the beginning.
    But I don't think this would be simpler than your current fix.
    As I already mentioned, I'm Okay with the fix you have now.

    I'm still thinking on how to fix this on the JVMTI level.

    Thanks,
    Serguei


    On 3/20/19 16:35, Daniil Titov wrote:
    > Hi Serguei,
    >
    > I could be missing something but as I understood the suggested alternative \
approach was  to not introduce the callbacksEnabled  flag and instead just unregister \
other callbacks inside VMDeath callback.  My concern was the case when one thread is \
on line 1302 (it is going to call a class loaded callback), while another thread just \
entered VMDeath callback. Without callbacksEnabled   flag the first thread will enter \
the callback and wait on the raw monitor acquired by VMDeath callback thread, after \
that it will continue and call JVMTI API that might throw WRONG_PHASE error if by \
this time the second thread  already returned from the VMDeath callback and changed \
the JVMTI phase.  >
    > 1277      void JvmtiExport::post_class_load(JavaThread *thread, Klass* klass) {
    >    1278     if (JvmtiEnv::get_phase() < JVMTI_PHASE_PRIMORDIAL) {
    >    1279       return;
    >    1280     }
    >    1281     HandleMark hm(thread);
    >    1282   
    >    1283     EVT_TRIG_TRACE(JVMTI_EVENT_CLASS_LOAD, ("[%s] Trg Class Load \
triggered",  >    1284                         \
JvmtiTrace::safe_get_thread_name(thread)));  >    1285     JvmtiThreadState* state = \
thread->jvmti_thread_state();  >    1286     if (state == NULL) {
    >    1287       return;
    >    1288     }
    >    1289     JvmtiEnvThreadStateIterator it(state);
    >    1290     for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = \
it.next(ets)) {  >    1291       if (ets->is_enabled(JVMTI_EVENT_CLASS_LOAD)) {
    >    1292         JvmtiEnv *env = ets->get_env();
    >    1293         if (env->phase() == JVMTI_PHASE_PRIMORDIAL) {
    >    1294           continue;
    >    1295         }
    >    1296         EVT_TRACE(JVMTI_EVENT_CLASS_LOAD, ("[%s] Evt Class Load sent \
%s",  >    1297                                            \
JvmtiTrace::safe_get_thread_name(thread),  >    1298                                  \
klass==NULL? "NULL" : klass->external_name() ));  >    1299         \
JvmtiClassEventMark jem(thread, klass);  >    1300         \
JvmtiJavaThreadEventTransition jet(thread);  >    1301         jvmtiEventClassLoad \
callback = env->callbacks()->ClassLoad;  >    1302         if (callback != NULL) {
    >    1303           (*callback)(env->jvmti_external(), jem.jni_env(), \
jem.jni_thread(), jem.jni_class());  >    1304         }
    >    1305       }
    >    1306     }
    >    1307   }
    >
    > Thanks!
    >
    > --Daniil
    >
    > On 3/20/19, 3:40 PM, "serguei.spitsyn@oracle.com" \
<serguei.spitsyn@oracle.com> wrote:  >
    >      Hi Daniil,
    >      
    >      No chance for it if you lock a raw monitor in the event callbacks.
    >      
    >      Thanks,
    >      Serguei
    >      
    >      On 3/20/19 14:58, Daniil Titov wrote:
    >      > 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: <serguei.spitsyn@oracle.com>
    >      > Organization: Oracle Corporation
    >      > Date: Tuesday, March 19, 2019 at 7:17 PM
    >      > To: Daniil Titov <daniil.x.titov@oracle.com>, OpenJDK Serviceability \
<serviceability-dev@openjdk.java.net>, Jean Christophe Beyler <jcbeyler@google.com>  \
>      > 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:serguei.spitsyn@oracle.com \
mailto:serguei.spitsyn@oracle.com 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
    >      >      >
    >      >      >
    >      >
    >      >
    >      >
    >      >
    >      >
    >      >
    >      >
    >      >
    >      
    >      
    >
    >





 

-- 

 

Thanks,

Jc


[Attachment #3 (text/html)]

<html xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type \
content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 \
(filtered medium)"><style><!-- /* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
	{mso-style-name:msonormal;
	mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
span.EmailStyle18
	{mso-style-type:personal-reply;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p \
class=MsoNormal>Thank you, JC and Serguei, for reviewing this \
change.<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Best \
regards,<o:p></o:p></p><p class=MsoNormal>Daniil<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><div style='border:none;border-top:solid #B5C4DF \
1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span \
style='font-size:12.0pt;color:black'>From: </span></b><span \
style='font-size:12.0pt;color:black'>Jean Christophe Beyler \
&lt;jcbeyler@google.com&gt;<br><b>Date: </b>Thursday, March 21, 2019 at 9:29 \
AM<br><b>To: </b>Daniil Titov &lt;daniil.x.titov@oracle.com&gt;<br><b>Subject: \
</b>Re: FW: 8218401: WRONG_PHASE: vmTestbase/nsk/jvmti test \
crash<o:p></o:p></span></p></div><div><p \
class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><div><div><p class=MsoNormal>Hi \
Daniil,<o:p></o:p></p><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p \
class=MsoNormal>Sorry yes it looks great to me :-)<o:p></o:p></p></div><div><p \
class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>My only nit would \
be : &quot;callbacksEnabled&quot; is camel backed and should probably \
be&nbsp;callbacks_enabled for c++ code, but that's a nit \
;-)<o:p></o:p></p></div><div><p \
class=MsoNormal>Jc<o:p></o:p></p></div></div></div></div><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><div><div><p class=MsoNormal>On Thu, Mar 21, \
2019 at 9:26 AM Daniil Titov &lt;<a \
href="mailto:daniil.x.titov@oracle.com">daniil.x.titov@oracle.com</a>&gt; \
wrote:<o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC \
1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><p \
class=MsoNormal style='margin-bottom:12.0pt'>Hi JC,<br><br>Just wanted to check with \
you that you are also OK with this version of the fix.<br><br>Webrev: <a \
href="http://cr.openjdk.java.net/~dtitov/8218401/webrev.03" \
target="_blank">http://cr.openjdk.java.net/~dtitov/8218401/webrev.03</a> <br>Bug : <a \
href="https://bugs.openjdk.java.net/browse/JDK-8218401" \
target="_blank">https://bugs.openjdk.java.net/browse/JDK-8218401</a> \
<br><br>Thanks!<br>--Daniil<br><br><br>On 3/20/19, 4:50 PM, &quot;<a \
href="mailto:serguei.spitsyn@oracle.com" \
target="_blank">serguei.spitsyn@oracle.com</a>&quot; &lt;<a \
href="mailto:serguei.spitsyn@oracle.com" \
target="_blank">serguei.spitsyn@oracle.com</a>&gt; wrote:<br><br>&nbsp; &nbsp; Hi \
Daniil,<br><br>&nbsp; &nbsp; You are right, there is a hole for this.<br><br>&nbsp; \
&nbsp; It can be easily fixed if the callbacks check phase at the \
beginning.<br>&nbsp; &nbsp; But I don't think this would be simpler than your current \
fix.<br>&nbsp; &nbsp; As I already mentioned, I'm Okay with the fix you have \
now.<br><br>&nbsp; &nbsp; I'm still thinking on how to fix this on the JVMTI \
level.<br><br>&nbsp; &nbsp; Thanks,<br>&nbsp; &nbsp; Serguei<br><br><br>&nbsp; &nbsp; \
On 3/20/19 16:35, Daniil Titov wrote:<br>&nbsp; &nbsp; &gt; Hi Serguei,<br>&nbsp; \
&nbsp; &gt;<br>&nbsp; &nbsp; &gt; I could be missing something but as I understood \
the suggested alternative approach was&nbsp; to not introduce the \
callbacksEnabled&nbsp; flag and instead just unregister other callbacks inside \
VMDeath callback.&nbsp; My concern was the case when one thread is on line 1302 (it \
is going to call a class loaded callback), while another thread just entered VMDeath \
callback. Without callbacksEnabled&nbsp; &nbsp;flag the first thread will enter the \
callback and wait on the raw monitor acquired by VMDeath callback thread, after that \
it will continue and call JVMTI API that might throw WRONG_PHASE error if by this \
time the second thread&nbsp; already returned from the VMDeath callback and changed \
the JVMTI phase.<br>&nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt; 1277&nbsp; &nbsp; &nbsp; \
void JvmtiExport::post_class_load(JavaThread *thread, Klass* klass) {<br>&nbsp; \
&nbsp; &gt;&nbsp; &nbsp; 1278&nbsp; &nbsp; &nbsp;if (JvmtiEnv::get_phase() &lt; \
JVMTI_PHASE_PRIMORDIAL) {<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; 1279&nbsp; &nbsp; &nbsp; \
&nbsp;return;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; 1280&nbsp; &nbsp; &nbsp;}<br>&nbsp; \
&nbsp; &gt;&nbsp; &nbsp; 1281&nbsp; &nbsp; &nbsp;HandleMark hm(thread);<br>&nbsp; \
&nbsp; &gt;&nbsp; &nbsp; 1282&nbsp; &nbsp;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; \
1283&nbsp; &nbsp; &nbsp;EVT_TRIG_TRACE(JVMTI_EVENT_CLASS_LOAD, (&quot;[%s] Trg Class \
Load triggered&quot;,<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; 1284&nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp;JvmtiTrace::safe_get_thread_name(thread)));<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; \
1285&nbsp; &nbsp; &nbsp;JvmtiThreadState* state = \
thread-&gt;jvmti_thread_state();<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; 1286&nbsp; &nbsp; \
&nbsp;if (state == NULL) {<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; 1287&nbsp; &nbsp; \
&nbsp; &nbsp;return;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; 1288&nbsp; &nbsp; \
&nbsp;}<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; 1289&nbsp; &nbsp; \
&nbsp;JvmtiEnvThreadStateIterator it(state);<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; \
1290&nbsp; &nbsp; &nbsp;for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets \
= it.next(ets)) {<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; 1291&nbsp; &nbsp; &nbsp; \
&nbsp;if (ets-&gt;is_enabled(JVMTI_EVENT_CLASS_LOAD)) {<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; 1292&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;JvmtiEnv *env = \
ets-&gt;get_env();<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; 1293&nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp;if (env-&gt;phase() == JVMTI_PHASE_PRIMORDIAL) {<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; 1294&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;continue;<br>&nbsp; &nbsp; \
&gt;&nbsp; &nbsp; 1295&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; 1296&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;EVT_TRACE(JVMTI_EVENT_CLASS_LOAD, \
(&quot;[%s] Evt Class Load sent %s&quot;,<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; \
1297&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
JvmtiTrace::safe_get_thread_name(thread),<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; \
1298&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
klass==NULL? &quot;NULL&quot; : klass-&gt;external_name() ));<br>&nbsp; &nbsp; \
&gt;&nbsp; &nbsp; 1299&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;JvmtiClassEventMark \
jem(thread, klass);<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; 1300&nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp;JvmtiJavaThreadEventTransition jet(thread);<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; 1301&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;jvmtiEventClassLoad callback = \
env-&gt;callbacks()-&gt;ClassLoad;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; 1302&nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp;if (callback != NULL) {<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; \
1303&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(*callback)(env-&gt;jvmti_external(), \
jem.jni_env(), jem.jni_thread(), jem.jni_class());<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; \
1304&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; 1305&nbsp; \
&nbsp; &nbsp; &nbsp;}<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; 1306&nbsp; &nbsp; \
&nbsp;}<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; 1307&nbsp; &nbsp;}<br>&nbsp; &nbsp; \
&gt;<br>&nbsp; &nbsp; &gt; Thanks!<br>&nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt; \
--Daniil<br>&nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt; On 3/20/19, 3:40 PM, &quot;<a \
href="mailto:serguei.spitsyn@oracle.com" \
target="_blank">serguei.spitsyn@oracle.com</a>&quot; &lt;<a \
href="mailto:serguei.spitsyn@oracle.com" \
target="_blank">serguei.spitsyn@oracle.com</a>&gt; wrote:<br>&nbsp; &nbsp; \
&gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; Hi Daniil,<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; &nbsp; <br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; No chance for it if you lock \
a raw monitor in the event callbacks.<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; \
<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; Thanks,<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; \
&nbsp; Serguei<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; <br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; &nbsp; On 3/20/19 14:58, Daniil Titov wrote:<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; &nbsp; &gt; Hi Serguei,<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; \
&gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; 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)&nbsp; but before it enters a raw monitor. Thus I decided to follow your \
original suggestion&nbsp; and restore volatile modifier for callbacksEnabled.&nbsp; \
Please review a new version of the patch.<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; \
&gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; Webrev: <a \
href="http://cr.openjdk.java.net/~dtitov/8218401/webrev.03/" \
target="_blank">http://cr.openjdk.java.net/~dtitov/8218401/webrev.03/</a><br>&nbsp; \
&nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; Bug : <a \
href="https://bugs.openjdk.java.net/browse/JDK-8218401" \
target="_blank">https://bugs.openjdk.java.net/browse/JDK-8218401</a><br>&nbsp; &nbsp; \
&gt;&nbsp; &nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; \
Thanks!<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; &nbsp; &gt; Best regards,<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; \
Daniil<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; \
&gt;&nbsp; &nbsp; &nbsp; &gt; From: &lt;<a href="mailto:serguei.spitsyn@oracle.com" \
target="_blank">serguei.spitsyn@oracle.com</a>&gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; \
&nbsp; &gt; Organization: Oracle Corporation<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; \
&nbsp; &gt; Date: Tuesday, March 19, 2019 at 7:17 PM<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; &nbsp; &gt; To: Daniil Titov &lt;<a href="mailto:daniil.x.titov@oracle.com" \
target="_blank">daniil.x.titov@oracle.com</a>&gt;, OpenJDK Serviceability &lt;<a \
href="mailto:serviceability-dev@openjdk.java.net" \
target="_blank">serviceability-dev@openjdk.java.net</a>&gt;, Jean Christophe Beyler \
&lt;<a href="mailto:jcbeyler@google.com" \
target="_blank">jcbeyler@google.com</a>&gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; \
&gt; Subject: Re: 8218401: WRONG_PHASE: vmTestbase/nsk/jvmti test crash<br>&nbsp; \
&nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; \
Hi Daniil,<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; &nbsp; &gt; I'd keep the volatile modifier for callbacksEnabled to disable \
compiler optimizations.<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; Otherwise, \
looks good to me.<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; \
&gt;&nbsp; &nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; Another \
approach could be to disable event notifications in VMDeath callback with:<br>&nbsp; \
&nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;&nbsp; &nbsp; \
SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_LOAD, NULL);<br>&nbsp; \
&nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;&nbsp; &nbsp; \
SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_BREAKPOINT, NULL);<br>&nbsp; \
&nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;&nbsp; &nbsp; . . .<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; Thanks,<br>&nbsp; \
&nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; Serguei<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; \
&nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; On 3/18/19 6:58 PM, Daniil \
Titov wrote:<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; Hi Serguei and \
JC,<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; \
&nbsp; &gt; Please review a new version of the fix that locks a monitor across the \
callbacks, as Serguei suggested.<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; \
&gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; Webrev: <a \
href="http://cr.openjdk.java.net/~dtitov/8218401/webrev.02/" \
target="_blank">http://cr.openjdk.java.net/~dtitov/8218401/webrev.02/</a><br>&nbsp; \
&nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; Bug: <a \
href="https://bugs.openjdk.java.net/browse/JDK-8218401" \
target="_blank">https://bugs.openjdk.java.net/browse/JDK-8218401</a><br>&nbsp; &nbsp; \
&gt;&nbsp; &nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; \
Thanks!<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; --Daniil<br>&nbsp; &nbsp; \
&gt;&nbsp; &nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; \
&gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; On 3/18/19, 9:47 AM, mailto:<a \
href="mailto:serguei.spitsyn@oracle.com" \
target="_blank">serguei.spitsyn@oracle.com</a> mailto:<a \
href="mailto:serguei.spitsyn@oracle.com" \
target="_blank">serguei.spitsyn@oracle.com</a> wrote:<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; \
Hi Daniil,<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; The JVMTI phase can change in the middle of \
callback work after the<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;&nbsp; &nbsp; \
&nbsp; check you added.<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;&nbsp; &nbsp; \
&nbsp; I'd suggest to lock a raw monitor across the callbacks to make them \
atomic.<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; Thank you for taking care about this \
issue!<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; Thanks,<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; \
&nbsp; &gt;&nbsp; &nbsp; &nbsp; Serguei<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; \
&gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; \
On 3/15/19 16:08, Daniil Titov wrote:<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; \
&gt;&nbsp; &nbsp; &nbsp; &gt; Please review the change that fixes 3 tests that \
intermittently fail with JVMTI_ERROR_WRONG_PHASE error.<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; \
&gt;&nbsp; &nbsp; &nbsp; &gt; 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&nbsp; quick return from the callbacks \
after VMDeath event is received.<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;&nbsp; \
&nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; \
&gt; Webrev: <a href="http://cr.openjdk.java.net/~dtitov/8218401/webrev.01/" \
target="_blank">http://cr.openjdk.java.net/~dtitov/8218401/webrev.01/</a><br>&nbsp; \
&nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; Bug: <a \
href="https://bugs.openjdk.java.net/browse/JDK-8218401" \
target="_blank">https://bugs.openjdk.java.net/browse/JDK-8218401</a><br>&nbsp; &nbsp; \
&gt;&nbsp; &nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; Thanks!<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt; -Daniil<br>&nbsp; &nbsp; &gt;&nbsp; \
&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; \
&gt;&nbsp; &nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt;&nbsp; &nbsp; &nbsp; \



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic