so_rcv_sx, deadlkres, SIGSTOP

Kostik Belousov kostikbel at gmail.com
Sun Apr 4 18:30:15 UTC 2010


On Sun, Apr 04, 2010 at 07:51:40PM +0200, Jilles Tjoelker wrote:
> The SX locks so_snd_sx and so_rcv_sx can be legitimately held for
> arbitrary amounts of time, while waiting until a send or recv is
> possible. Any other threads wanting to send/recv on the socket will
> sleep interruptibly on the corresponding SX. If deadlkres is activated,
> it may detect a deadlock even though there is no problem.
> 
> If a SIGSTOP or similar comes in while waiting until send/recv is
> possible, the SX is held across the suspension and noone will be able to
> send/recv on the socket until the process is resumed. On the other hand
> a thread waiting for the SX can be suspended without harm. Adding PBDRY
> to various sleeps may help but may also introduce other problems
> (SIGSTOP disturbing the functioning of the process more, possibly with
> stuff like SO_RCVTIMEO).
Could you, please, elaborate on this (interaction between PBDRY and some
socket timeout stuff) ?

> 
> Example (using the fact that fifos are implemented using sockets):
> 
> term1% mkfifo testfifo
> term1% cat >testfifo
> 
> term2% cat testfifo
> 
> term3% cat testfifo
> 
> Letting this sit for half an hour will trigger deadlkres.
> 
> If the reader in term2 (started first) is suspended, the reader in term3
> will not get any input written to the fifo.
> 
> -- 
> Jilles Tjoelker
> _______________________________________________
> freebsd-arch at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-arch
> To unsubscribe, send any mail to "freebsd-arch-unsubscribe at freebsd.org"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20100404/30e50690/attachment.pgp


More information about the freebsd-arch mailing list