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

com.sun.jdi.ThreadReference.ownedMonitorsAndFrames() returns unexpected monitor

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 6
    • hotspot
    • generic
    • generic

      Attached test reproduces bug found during execution multiple JDI tests in single VM.

      Test scenario:
      Fisrt, debuggee VM starts thread with name "TestThread1" which acquires monitor with JNI MonitorEnter and finishes, then debugger starts second thread with name "TestThread2" which just executes infinite loop. Debuggeer first print data obtained for "TestThread1" and then print data obtained for "TestThread2" and for both threads method ownedMonitorsAndFrames() returns the same monitor and this is wrong for "TestThread2" which doesn't acquire any monitor.

      Bug reproduces intermittently.

      Test output:

      debuggee out>>>Command received: createThread1
      Thread: instance of OwnedMonitorsDebuggee$Thread1(name='TestThread1', id=151)
      Total monitors: 1
      Monitor: instance of java.lang.Object(id=155) Thread: instance of OwnedMonitorsDebuggee$Thread1(name='TestThread1', id=151) Depth: -1
      debuggee out>>>Command received: createThread2
      Thread: instance of OwnedMonitorsDebuggee$Thread2(name='TestThread2', id=158)
      Total monitors: 1
      Monitor: instance of java.lang.Object(id=155) Thread: instance of OwnedMonitorsDebuggee$Thread2(name='TestThread2', id=158) Depth: -1
      Unexpected monitors was returned for TestThread2
      debuggee out>>>Command received: QUIT
      debuggee out>>>Exit
      TEST FAIL

            Unassigned Unassigned
            sboikovsunw Semen Boikov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: