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

Christian Franke Christian.Franke@t-online.de
Mon Jan 27 18:59:14 GMT 2025


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


> $ gcc -o mqhang mqhang.c
>
> $ ./mqhang
> mq_send...
> mq_send = 0
> mq_receive...
> mq_receive = 8
> mq_receive...
> mq_send...
> [...hangs...]
>
> Problem does not occur if mq_receive() is called from a fork()ed 
> process instead of a thread.
>

-- 
Regards,
Christian



More information about the Cygwin mailing list