mq_send()/mq_receive() may never return if used from threads

Christian Franke Christian.Franke@t-online.de
Tue Jan 28 08:00:21 GMT 2025


Corinna Vinschen via Cygwin wrote:
> On Jan 27 20:35, Corinna Vinschen via Cygwin wrote:
>> On Jan 27 19:59, Christian Franke via Cygwin wrote:
>>> Christian Franke wrote:
>>>> Found with 'stress-ng --workload ...':
>>>>
>>>> If mq_receive is called on an empty queue and mq_send is called later
>>>> from a different thread, both functions never return and signals
>>>> (including SIGKILL) are no longer processed.
>>>>
>>>> Testcase (attached):
>>>>
>>>> $ uname -r
>>>> 3.5.5-1.x86_64
>>>>
>>> The problem is also reproducible with 3.5.6-1 and recent
>>> 3.6.0-0.345.gb940faa144ca
>> Yes, because I didn't have the time to look into it yet.
>>
>> I just did, and I think I see what's going on.  This should be fixed
>> in 3.5.7.
> I just pushed a patch, please try cygwin-3.6.0-0.346.gfe6ddc15a356.

$ uname -r
3.6.0-0.346.gfe6ddc15a356.x86_64

$ time ./mqhang
mq_send...
mq_send = 0
mq_receive...
mq_receive = 8
mq_receive...
mq_send...
mq_receive = 8
mq_send = 0

real    0m5.002s
user    0m0.000s
sys     0m0.000s

$ stress-ng --workload 16 --timeout 60 --verify
stress-ng: info:  [4873] setting to a 1 min run per stressor
stress-ng: info:  [4873] dispatching hogs: 16 workload
stress-ng: info:  [4874] workload: running with 2 threads per stressor 
instance
stress-ng: info:  [4873] skipped: 0
stress-ng: info:  [4873] passed: 16: workload (16)
stress-ng: info:  [4873] failed: 0
stress-ng: info:  [4873] metrics untrustworthy: 0
stress-ng: info:  [4873] successful run completed in 1 min, 3.31 secs

Looks good!

Thanks,
Christian



More information about the Cygwin mailing list