On Wed, 27 Sep 2023 17:54:51 GMT, Roman Kennke <rken...@openjdk.org> wrote:

>> The SA can run concurrently with Java threads, SA code that inspects locking 
>> state should be able to deal with that. On the other hand, the particular 
>> code is only used in printing routine and is not expected to be precise. 
>> When resolving an anonymous owner, we may not find one, because Java threads 
>> may already have moved on. Instead of crashing with a stacktrace, we should 
>> gracefully return null here.
>> 
>> Testing:
>>  - [x] sun/tools/jhsdb/JStackStressTest.java
>>  - [x] sun/tools/jhsdb
>>  - [x] serviceability/sa
>
> Roman Kennke has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Print warning when anonymous lock cannot be found

Changes requested by dholmes (Reviewer).

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java line 
245:

> 243:                 }
> 244:                 // We should have found the owner. However, the code can 
> run concurrently with
> 245:                 // Java code and locking state can change at any time. 
> This code is not

The second sentence is not accurate as things are not running concurrently and 
cannot change state at any time. Suggestion:

// We should have found the owner, however, as the VM could be in any state, 
including the middle
// of performing GC, it is not always possible to do so. Just return null if we 
can't locate it.

-------------

PR Review: https://git.openjdk.org/jdk/pull/15907#pullrequestreview-1647736396
PR Review Comment: https://git.openjdk.org/jdk/pull/15907#discussion_r1339374587

Reply via email to