[Tarantool-patches] [PATCH v2] Add some cancellation guard

lvasiliev lvasiliev at tarantool.org
Mon Mar 23 09:43:59 MSK 2020



On 18.03.2020 11:26, Konstantin Osipov wrote:
> * Leonid Vasiliev <lvasiliev at tarantool.org> [19/12/26 10:51]:
>> We need to set a thread cancellation guard, because
>> another thread may cancel the current thread at a
>> really bad time (messages flush, mutex lock)
>>
>> Fixes: #4127
> 
> I think we have to do this patch, as long as we use
> pthread_cancel().
> 
> An alternative is to ignore the bug. There is no harm in Tarantool
> in crashing at exit, as long as we close the wal first.
> 
> And we should close the wal first!
> 
> AFAIU pthread_setcancellable is a thread-local and cheap
> operation. Could you please confirm this? (I haven't studied the
> pthread implementation code since 2001, when Linux only had Xavier
> Leroy's threads).

Hi! Yes, it is a thread local. About cheap (a comment from the code): 
"The atomic operation can potentially be expensive if the memory has to 
be locked and remote cache lines have to be invalidated." But, if I am 
understand correctly, it should not affect us.

> 
> 


More information about the Tarantool-patches mailing list