[jdk17] RFR: 8269865: Async UL needs to handle ERANGE on exceeding SEM_VALUE_MAX [v5]

David Holmes david.holmes at oracle.com
Tue Jul 13 07:17:56 UTC 2021


On 13/07/2021 4:10 pm, Xin Liu wrote:
> On Thu, 8 Jul 2021 22:12:23 GMT, Xin Liu <xliu at openjdk.org> wrote:
> 
>>> This patch solved the sempahore overflow issue with errno ERANGE or EOVERFLOW.
>>> Previously, we have asymmetric p/v operations for semaphore _sem. Each iteration
>>> only decrements _sem 1 but dequeues N messages. If logging threads keep preempting
>>> async logging thread, it may cause the value of _sem accumulates until overflow!
>>>
>>> The patch corrects the value of _sem after write(). n messages are dequeued/processed.
>>> We need to invoke _sem.wait() max(n-1, 1) time. This ensures that each iteration
>>> decrements n instead of 1.
>>
>> Xin Liu has updated the pull request incrementally with one additional commit since the last revision:
>>
>>    Refactor code with API change.
>>    
>>    Semaphore::signal returns a boolean value to indicate it's succeed or not.
> 
> Aha, os::PlatformMonitor is just the cross-platform condition variable, no strings attached!
> I think it is a better solution. TBH,  I don't like 'ignore_overflow'. it's a hack solution. let's save it as a back-up solution.
> 
> We still have 2 week before phase-2 rampdown.  Let me also take a look how JFR handle this case. It is said JFR also has an asynchronous buffer too.

JDK 17 will enter Rampdown Phase Two this Thursday, 15 July,
at 15:00 UTC. This needs to be handled promptly.

Thanks,
David

> -------------
> 
> PR: https://git.openjdk.java.net/jdk17/pull/216
> 


More information about the hotspot-runtime-dev mailing list