JDK-8328741 : serviceability/jvmti/ObjectMonitorUsage/ObjectMonitorUsage.java failed with unexpected owner
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 23
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86_64
  • Submitted: 2024-03-21
  • Updated: 2024-04-29
  • Resolved: 2024-04-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 23
23 b20Fixed
Related Reports
Relates :  
Description
The following test failed in the JDK23 CI:

serviceability/jvmti/ObjectMonitorUsage/ObjectMonitorUsage.java

Here's a snippet from the log file:

#section:main
----------messages:(6/396)----------
command: main -Djdk.virtualThreadScheduler.parallelism=10 -agentlib:ObjectMonitorUsage ObjectMonitorUsage
reason: User specified action: run main/othervm/native -Djdk.virtualThreadScheduler.parallelism=10 -agentlib:ObjectMonitorUsage ObjectMonitorUsage 
started: Thu Mar 21 18:45:20 UTC 2024
Mode: othervm [/othervm specified]
finished: Thu Mar 21 18:45:21 UTC 2024
elapsed time (seconds): 1.038
----------configuration:(0/0)----------
----------System.out:(385/16454)----------

### main: started

>>> [1]
>>>          owner:               none (0x0)
>>>          entry_count:         0
>>>          waiter_count:        0
>>>          notify_waiter_count: 0

### test0: started platform
>>> MonitorWait event: WaitingPT0 counter: 1
>>> MonitorWait event: WaitingPT1 counter: 2
>>> MonitorWait event: WaitingPT2 counter: 3
>>> MonitorWait event: WaitingPT3 counter: 4
>>> [2]
>>>          owner:               WaitingPT3 (0x0x7fe0e0000be0)
>>>          entry_count:         1
>>>          waiter_count:        0
>>>          notify_waiter_count: 3
>>>  notify_waiters:
>>>                 0: WaitingPT0 (0x0x7fe0e0000be8)
>>>                 1: WaitingPT1 (0x0x7fe0e0000bf0)
>>>                 2: WaitingPT2 (0x0x7fe0e0000bf8)
FAILED: (2) unexpected owner: 0x0x7fe0e0000be0
FAILED: (2) entry_count expected: 0, actually: 1
FAILED: (2) notify_waiter_count expected: 4, actually: 3
>>> MonitorContendedEnter event: MainThread counter: 1
>>> MonitorContendedEntered event: MainThread counter: 0
>>> MonitorWaited event: WaitingPT0 counter: 3
>>> MonitorWaited event: WaitingPT3 counter: 2
>>> MonitorWaited event: WaitingPT2 counter: 1
>>> MonitorWaited event: WaitingPT1 counter: 0
### test0: finished platform

<snip>

----------System.err:(11/676)----------
java.lang.RuntimeException: Failed status returned from the agent
	at ObjectMonitorUsage.main(ObjectMonitorUsage.java:292)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
	at java.base/java.lang.Thread.run(Thread.java:1575)

JavaTest Message: Test threw exception: java.lang.RuntimeException: Failed status returned from the agent
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.lang.RuntimeException: Failed status returned from the agent
----------rerun:(38/6516)*----------
Comments
Changeset: 174d6265 Author: Serguei Spitsyn <sspitsyn@openjdk.org> Date: 2024-04-24 09:02:02 +0000 URL: https://git.openjdk.org/jdk/commit/174d62652c69e811cf44ab64db575b13a848a728
24-04-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/18778 Date: 2024-04-15 06:47:24 +0000
15-04-2024

This is the test issue. The WaitingPT3 thread posted the MonitorWait event but has not released the lockCheck monitor yet. The best approach to fix it is to wait for each WaitingTask thread to really reach the WAITING state.
15-04-2024

Tthank you, Dan! Will look at it.
26-03-2024

[~sspitsyn] - Serguei, I think you might want to take a look at this new test failure.
21-03-2024

This test was recently updated by the following fix: JDK-8247972 incorrect implementation of JVM TI GetObjectMonitorUsage
21-03-2024

Please note that LM_LIGHTWEIGHT has been made the default again in jdk-23+15-1173. That may have nothing to do with this new failure mode. jdk-23+15-1197-tier3 is the 11th Tier3 since jdk-23+15-1173...
21-03-2024