RFR: 8256382: Use try_lock for hs_err EventLog printing [v2]

Thomas Stuefe stuefe at openjdk.java.net
Thu Nov 26 11:16:00 UTC 2020


On Thu, 26 Nov 2020 09:30:11 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> The EventLog locks are taken when the hs_err files are generated. Since crashes and asserts can occur when other locks are held, this can cause lock reordering problems if the held locks also are low-rank locks. There's no way to solve this if blocking locks are taken.
>> 
>> I hit this problem when investigating making the GCLogPrecious lock use the lowest lock rank (same as EventLog). See JDK-8254877.
>> 
>> Both GCLogPrecious and EventLog are considered "leaf" locks. No other locks should be taken when those locks are taken. However, if we crash in either of these sub-systems, there will be a lock-reordering error message in the hs_err file, and the rest of the logged info is skipped in the currently logged section.
>> 
>> The proposal is to use try_lock_without_range_check and only log information if the lock could be acquired without blocking. This relies on the new try_lock_without_range_check function from JDK-8255678.
>> 
>> I've tested this by injecting crashes while not holding locks in both GCLogPrecious, while holding locks during EventLog logging, and when not holding the locks, and verified that we get the expected behavior.
>> 
>> Example output while crashing during 'Internal exceptions' logging:
>> Classes redefined (0 events):
>> No events
>> 
>> Internal exceptions (5 events):
>> No events printed - crash while holding lock
>> 
>> Events (20 events):
>> Event: 1,437 loading class java/util/HashMap$KeyIterator
>> Event: 1,438 loading class java/util/HashMap$KeyIterator done
>> Event: 1,438 loading class java/lang/module/ModuleDescriptor$Exports
>
> Stefan Karlsson has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
> 
>  - Merge branch 'master' into 8256382_eventlog_try_lock
>  - 8256382: Use try_lock for hs_err EventLog printing

LGTM

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

Marked as reviewed by stuefe (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/1408


More information about the hotspot-dev mailing list