RFR: 8355608: Async UL should take the file lock of stream when outputting

Ioi Lam iklam at openjdk.org
Mon Apr 28 21:29:45 UTC 2025


On Fri, 25 Apr 2025 13:01:44 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

> With the introduction of [JDK-8349755](https://bugs.openjdk.org/browse/JDK-8349755), it is not entirely clear any longer that the Async UL has exclusive access to the files which are being logged to in the JVM. We should take the file lock for the stream being logged to for safety's sake.
> 
> If, for example, an unattached thread logs, then it will do so without the help of the Async UL thread.
> 
> This is expected to very rarely, if ever, happen. Since taking an uncontested mutex is very cheap, I expect this to have a negligible performance impact.
> 
> Testing: GHA, tier1
> 
> Cheers,
> Johan

Marked as reviewed by iklam (Reviewer).

Looks reasonable to me. After this PR, the locking sequence in logFileStreamOutput is the same as logFileOutput.

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

PR Review: https://git.openjdk.org/jdk/pull/24874#pullrequestreview-2801010975
PR Comment: https://git.openjdk.org/jdk/pull/24874#issuecomment-2836745883


More information about the hotspot-runtime-dev mailing list