RFR: 8268638: semaphores of AsyncLogWriter may be broken when JVM is exiting. [v2]

David Holmes dholmes at openjdk.java.net
Mon Jun 14 11:01:03 UTC 2021


On Sun, 13 Jun 2021 04:48:03 GMT, Xin Liu <xliu at openjdk.org> wrote:

>> All 3 semaphores used by AsyncLogWriter are static member data. C++ runtime on
>> MacOS deletes them. Currently, AsyncLog Thread doesn't exit. Semaphore_wait/signal
>> returns with KERN_INVALID_NAME(15) if those semaphore are destroyed. 
>> 
>> This patch change those to regular data members. This prevents from deleting.
>
> Xin Liu has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Support --with-debug-level=optimized.
>   
>   release build with debug level optimized doesn't define PRODUCT.
>   use ASSERT instead.

Changes requested by dholmes (Reviewer).

src/hotspot/share/logging/logAsyncWriter.cpp line 36:

> 34:  public:
> 35:   AsyncLogLocker(Semaphore* sem): _sem(sem) {
> 36:     assert(sem != nullptr && sem->value() == 1,

The value() check is not necessary. Please do not pollute the Semaphore API with this.

Rather than passing the Semaphore in it should just be accessed directly as there is only one Semaphore to ever be used here. Make AsyncLogLocker a friend class to allow access.

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

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


More information about the hotspot-runtime-dev mailing list