Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8210984

[TESTBUG] hs203t003 fails with "# ERROR: hs203t003.cpp, 218: NSK_CPP_STUB2 ( ResumeThread, jvmti, thread)"

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b14

      Backports

        Description

         MyThread :: MyThread().
         MyThread.doThisFunction()
        # info :: File = ./bin/newclass00/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/MyThread.class
        # info **Agent:: opening file ./bin/newclass00/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/MyThread.class
        # info file size= 1040
         File red completely
         Agent :: Redefined.
         Agent :: Suspendeding thread.
        #error Agent :: Thread was not suspened.The following fake exception stacktrace is for failuire analysis.
        nsk.share.Fake_Exception_for_RULE_Creation: (hs203t003.cpp:218) NSK_CPP_STUB2 ( ResumeThread, jvmti, thread)
        at nsk_lvcomplain(nsk_tools.cpp:172)
        # ERROR: hs203t003.cpp, 218: NSK_CPP_STUB2 ( ResumeThread, jvmti, thread)
        # jvmti error: code=13, name=JVMTI_ERROR_THREAD_NOT_SUSPENDED
        #error Agent :: while resuming thread.
         Agent :: Succeded in suspending.
        Timeout refired 1200 times

        It looks the java agentMethod() method is getting a bit ahead of the code in the agent callbackFieldAccess() function, which has started suspending the thread, but has not yet completed it. Meanwhile agentMethod() has detected that the redefine has happened, and has moved on to calling resumeThread() before it has been suspended. agentMethod() really needs an additional sync check to make sure the suspend has happened.

        I think the reason this doesn't happen all the time (it seems to have only ever happenced once) is because agentMethod() sits in a loop waiting for the redefine to complete, and sleeps 100ms on each iteration. So probably on the first sleep 100ms ends up being more than enough for the redefine to complete and for callbackFieldAccess() to finish suspending the thread. I bet if it slept for 1ms, it would happen almost every time.

        When addressing this bug, I'd suggest first experimenting with a 1ms sleep time to see if that makes it easier to reproduce, then verify whatever fix it put in place with the short sleep time.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                gadams Gary Adams (Inactive)
                Reporter:
                cjplummer Chris Plummer
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: