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

List:       openjdk-serviceability-dev
Subject:    Re: RFR(S): JDK-8054194 jstack crash: assert(handle != NULL) failed: JNI handle should not be null
From:       "serguei.spitsyn () oracle ! com" <serguei ! spitsyn () oracle ! com>
Date:       2014-08-26 17:00:40
Message-ID: 53FCBD38.8060503 () oracle ! com
[Download RAW message or body]

On 8/26/14 8:25 AM, Dmitry Samersoff wrote:
> Serguei,
> 
> On 2014-08-26 14:58, serguei.spitsyn@oracle.com wrote:
> > Dmitry,
> > 
> > I doubt, this webrev fixes the issue.
> > At least, I can't see it yet.
> > 
> > It looks like the assert is because the imagePath_ID or symbolPath_ID
> > were not initialized properly.
> If imagePath_ID or symbolPath_ID is NULL we get a crash, not assert.
> 
> Assert happens if (and only if) path is NULL on call to
> env->GetStringUTFChars(path, &isCopy); at ll. 316, 321
> 
> I verified it manually by setting these variables to different values.

Nice.
But how do we get path == null from one of the statements below ?
Is it because of the clazz value?

   path = (jstring) env->GetStaticObjectField(clazz, imagePath_ID);
   buf = env->GetStringUTFChars(path, &isCopy); <======== ???
   CHECK_EXCEPTION_(false);
   AutoJavaString imagePath(env, path, buf);

   path = (jstring) env->GetStaticObjectField(clazz, symbolPath_ID);
   buf = env->GetStringUTFChars(path, &isCopy); <======== ???
   CHECK_EXCEPTION_(false);

> 
> > But there is no clear explanation yet how this could happen.
> > Maybe, the conclusion above was wrong, but some prove is needed and/or
> > another possible root cause.
> > 
> > Also, Staffan is right, about killing the remote process.
> > The remote process has no relation to the fix.
> I can reproduce the problem (intermittently, once in couple of hours) by
> two scripts running in two separate windows - first script runs and
> kills Java2D demo second one runs jps and jstack -F against Java2D demo.
> 
> After the fix, problem is not reproducible anymore.
> 
> But I'll put more efforts to understand what is going wrong with jstack
> process.

Good.

Thanks,
Serguei

> 
> -Dmitry
> 
> > Thanks,
> > Serguei
> > 
> > 
> > On 8/25/14 3:58 AM, Staffan Larsen wrote:
> > > Dmitry,
> > > 
> > > Your changes look good (except missing spaces after commas). But what I do not \
> > > understand is how this relates to the bug. The code in setImageAndSymbolPath() \
> > > is not looking at the remote process, it’s just setting up data in the jstack \
> > > process. How does killing the remote process affect this code? What am I \
> > > missing? 
> > > /Staffan
> > > 
> > > On 21 aug 2014, at 14:56, Dmitry Samersoff <dmitry.samersoff@oracle.com> wrote:
> > > 
> > > > Hi Everyone,
> > > > 
> > > > Please review small agent changes:
> > > > 
> > > > http://cr.openjdk.java.net/~dsamersoff/JDK-8054194/webrev.01/
> > > > 
> > > > Under windows, If jstack attempts to attach to java process that is
> > > > being killed by someone else, GetStaticObjectField might return NULL.
> > > > 
> > > > -Dmitry
> > > > 
> > > > -- 
> > > > Dmitry Samersoff
> > > > Oracle Java development team, Saint Petersburg, Russia
> > > > * I would love to change the world, but they won't give me the sources.
> 


[Attachment #3 (text/html)]

<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 8/26/14 8:25 AM, Dmitry Samersoff
      wrote:<br>
    </div>
    <blockquote cite="mid:53FCA6D9.6020301@oracle.com" type="cite">
      <pre wrap="">Serguei,

On 2014-08-26 14:58, <a class="moz-txt-link-abbreviated" \
href="mailto:serguei.spitsyn@oracle.com">serguei.spitsyn@oracle.com</a> wrote: </pre>
      <blockquote type="cite">
        <pre wrap="">Dmitry,

I doubt, this webrev fixes the issue.
At least, I can't see it yet.

It looks like the assert is because the imagePath_ID or symbolPath_ID
were not initialized properly.
</pre>
      </blockquote>
      <pre wrap="">
If imagePath_ID or symbolPath_ID is NULL we get a crash, not assert.

Assert happens if (and only if) path is NULL on call to
env-&gt;GetStringUTFChars(path, &amp;isCopy); at ll. 316, 321

I verified it manually by setting these variables to different values.</pre>
    </blockquote>
    <br>
    Nice.<br>
    But how do we get path == null from one of the statements below ?<br>
    Is it because of the clazz value?<br>
    <br>
    <meta http-equiv="content-type" content="text/html;
      charset=windows-1252">
      path = (jstring) env-&gt;GetStaticObjectField(clazz,
    imagePath_ID);
    <br>
      buf = env-&gt;GetStringUTFChars(path, &amp;isCopy); &lt;========
    ???
    <br>
      CHECK_EXCEPTION_(false);
    <br>
      AutoJavaString imagePath(env, path, buf);
    <br>
    <br>
      path = (jstring) env-&gt;GetStaticObjectField(clazz,
    symbolPath_ID);
    <br>
      buf = env-&gt;GetStringUTFChars(path, &amp;isCopy); &lt;========
    ???
    <br>
      CHECK_EXCEPTION_(false);
    <br>
    <br>
    <blockquote cite="mid:53FCA6D9.6020301@oracle.com" type="cite">
      <pre wrap="">

</pre>
      <blockquote type="cite">
        <pre wrap="">But there is no clear explanation yet how this could happen.
Maybe, the conclusion above was wrong, but some prove is needed and/or
another possible root cause.

Also, Staffan is right, about killing the remote process.
The remote process has no relation to the fix.
</pre>
      </blockquote>
      <pre wrap="">
I can reproduce the problem (intermittently, once in couple of hours) by
two scripts running in two separate windows - first script runs and
kills Java2D demo second one runs jps and jstack -F against Java2D demo.

After the fix, problem is not reproducible anymore.

But I'll put more efforts to understand what is going wrong with jstack
process.</pre>
    </blockquote>
    <br>
    Good.<br>
    <br>
    Thanks,<br>
    Serguei<br>
    <br>
    <blockquote cite="mid:53FCA6D9.6020301@oracle.com" type="cite">
      <pre wrap="">

-Dmitry

</pre>
      <blockquote type="cite">
        <pre wrap="">
Thanks,
Serguei


On 8/25/14 3:58 AM, Staffan Larsen wrote:
</pre>
        <blockquote type="cite">
          <pre wrap="">Dmitry,

Your changes look good (except missing spaces after commas). But what I do not \
understand is how this relates to the bug. The code in setImageAndSymbolPath() is not \
looking at the remote process, it’s just setting up data in the jstack process. How \
does killing the remote process affect this code? What am I missing?

/Staffan

On 21 aug 2014, at 14:56, Dmitry Samersoff <a class="moz-txt-link-rfc2396E" \
href="mailto:dmitry.samersoff@oracle.com">&lt;dmitry.samersoff@oracle.com&gt;</a> \
wrote:

</pre>
          <blockquote type="cite">
            <pre wrap="">Hi Everyone,

Please review small agent changes:

<a class="moz-txt-link-freetext" \
href="http://cr.openjdk.java.net/~dsamersoff/JDK-8054194/webrev.01/">http://cr.openjdk.java.net/~dsamersoff/JDK-8054194/webrev.01/</a>


Under windows, If jstack attempts to attach to java process that is
being killed by someone else, GetStaticObjectField might return NULL.

-Dmitry

-- 
Dmitry Samersoff
Oracle Java development team, Saint Petersburg, Russia
* I would love to change the world, but they won't give me the sources.
</pre>
          </blockquote>
        </blockquote>
        <pre wrap="">
</pre>
      </blockquote>
      <pre wrap="">

</pre>
    </blockquote>
    <br>
  </body>
</html>



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

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