On Sat, 23 Jan 2021 03:25:49 GMT, Yasumasa Suenaga <[email protected]> wrote:
>> test/hotspot/jtreg/serviceability/sa/TestObjectMonitorIterate.java line 78: >> >>> 76: SATestUtils.addPrivilegesIfNeeded(processBuilder); >>> 77: OutputAnalyzer SAOutput = >>> ProcessTools.executeProcess(processBuilder); >>> 78: SAOutput.shouldHaveExitValue(0); >> >> Is it reasonable to expect at least one ObjectMonitor to be found? >> There are a couple of system threads that wait on ObjectMonitors >> so if the target VM runs for a little bit of time, there will be at least >> two contended ObjectMonitors. > > Yes, we can see the monitor for reference queue at least. > This test aims to check whether SA can find the monitors. I wasn't trying to state that you should only check for one ObjectMonitor. I was trying to make sure that I understood your logic and that you are intentionally requiring at least one ObjectMonitor (and you are). For diagnostic purposes, it would be good if you dumped all the ObjectMonitors that were found. That would require switching from the if-statement back to the while-loop, setting a variable when you find an ObjectMonitor and then doing the return outside the while-loop when you know that you've seen an ObjectMonitor. ------------- PR: https://git.openjdk.java.net/jdk/pull/1910
