RFR: 8205020: ZGC: Apply workaround for buggy sem_post() in glibc < 2.21

Stefan Karlsson stefan.karlsson at oracle.com
Thu Jun 14 09:39:52 UTC 2018


Looks good.

StefanK

On 2018-06-14 11:34, Per Liden wrote:
> We should apply a workaround for a bug in sem_post() in glibc < 2.21, 
> where it's not safe to destroy the semaphore immediately after returning 
> from sem_wait(). The reason is that sem_post() can touch the semaphore 
> after a waiting thread have returned from sem_wait(). To avoid this race 
> we should force the waiting thread to acquire/release the lock held by 
> the posting thread. This workaround is a bit ugly, but I propose we use 
> this until we find a batter solution. I can also add that we've never 
> actually seen any problems related to the specific cases addressed in 
> this patch, but the sem_post() bug has shown up in the Handshake code 
> (JDK-8204166), so we want to protect these paths too.
> 
> For more details about the sem_post() bug, see 
> https://sourceware.org/bugzilla/show_bug.cgi?id=12674
> 
> Bug: https://bugs.openjdk.java.net/browse/JDK-8205020
> Webrev: http://cr.openjdk.java.net/~pliden/8205020/webrev.0/
> 
> Testing: Passed tier{1,2,3,4}
> 
> cheers,
> Per



More information about the hotspot-gc-dev mailing list