[Bug nptl/31477] Priority Inversion and Unlimited Spin of RWlock

pengzheng at apache dot org sourceware-bugzilla@sourceware.org
Fri May 30 04:36:44 GMT 2025


https://sourceware.org/bugzilla/show_bug.cgi?id=31477

--- Comment #8 from Peng Zheng <pengzheng at apache dot org> ---
Let me made it clear:

The normal writer gets stuck in 
https://github.com/PengZheng/glibc/blob/79b5febd762d6735ba8e878086a50ea04993e340/nptl/pthread_rwlock_common.c#L802

With exactly one ARM instruction away to finish its job (enable readers to
block themselves on the futex) but does not have chance to run because the two
readers grabs all available CPUs.

And the two poor readers are lost doing infinite spins in the loop:
https://github.com/PengZheng/glibc/blob/79b5febd762d6735ba8e878086a50ea04993e340/nptl/pthread_rwlock_common.c#L449-L520

They cannot wait on the futex because &rwlock->__data.__wrphase_futex is not
yet set to 1. And the thread should have done that is starved!

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list