From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp53.i.mail.ru (smtp53.i.mail.ru [94.100.177.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id DC2984696C3 for ; Mon, 23 Mar 2020 09:44:00 +0300 (MSK) References: <0e7fddec984120e36c098cd546ecae4fddc726cd.1577346185.git.lvasiliev@tarantool.org> <20200318082610.GA26019@atlas> From: lvasiliev Message-ID: <8db85e49-c479-779b-7459-6ea6727ecb98@tarantool.org> Date: Mon, 23 Mar 2020 09:43:59 +0300 MIME-Version: 1.0 In-Reply-To: <20200318082610.GA26019@atlas> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH v2] Add some cancellation guard List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Konstantin Osipov , alexander.turenko@tarantool.org, tarantool-patches@dev.tarantool.org On 18.03.2020 11:26, Konstantin Osipov wrote: > * Leonid Vasiliev [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. > >