Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Apr 2010 11:58:08 +0200
From:      Attilio Rao <attilio@freebsd.org>
To:        Jilles Tjoelker <jilles@stack.nl>
Cc:        Ed Maste <emaste@sandvine.com>, freebsd-arch@freebsd.org
Subject:   Re: so_rcv_sx, deadlkres, SIGSTOP
Message-ID:  <p2u3bbf2fe11004080258se3ce59c4qc857e8f1cce89aee@mail.gmail.com>
In-Reply-To: <q2s3bbf2fe11004080257t8eeccb1dhdf90913dee28bc2f@mail.gmail.com>
References:  <20100404175140.GB40499@stack.nl> <q2s3bbf2fe11004080257t8eeccb1dhdf90913dee28bc2f@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
2010/4/8 Attilio Rao <attilio@freebsd.org>:
> 2010/4/4 Jilles Tjoelker <jilles@stack.nl>:
>> 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).
>>
>> 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.
>
> Jilles,
> may you please try this patch?:
> http://www.freebsd.org/~attilio/Sandvine/deadlkres/deadlkres-blessed.diff
>
> It does introduce a blessed list where the sx_lock can be whitelisted.
> It also fixes, for long sleeps, the wrap-up of ticks object.
> The obvious fallout is that deadlkres can't help much with deadlocks
> for whitelisted sxlock or lockmgr but that is a fair price I think.

Forgot to mention: mutex are left out from this design by purpose
because a similar problem might never happen for them by design.

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p2u3bbf2fe11004080258se3ce59c4qc857e8f1cce89aee>