From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 3F203469719 for ; Mon, 17 Feb 2020 20:19:48 +0300 (MSK) Received: by mail-lj1-f195.google.com with SMTP id h23so19728158ljc.8 for ; Mon, 17 Feb 2020 09:19:48 -0800 (PST) Date: Mon, 17 Feb 2020 20:19:40 +0300 From: Konstantin Osipov Message-ID: <20200217171940.GD11553@atlas> References: <20200217155953.25803-1-gorcunov@gmail.com> <20200217155953.25803-5-gorcunov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200217155953.25803-5-gorcunov@gmail.com> Subject: Re: [Tarantool-patches] [PATCH 4/4] box/txn: fix nil dereference in txn_rollback List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cyrill Gorcunov Cc: tml * Cyrill Gorcunov [20/02/17 20:08]: > In case if we get failed in allocation of new > journal entry the txn_rollback will try to > derefernce nil pointer This is lgtm (apart from typos in the comment), however, I think this patch is incomplete, since wal_write() still calls rollback on failure to queue the task to cbus. Could you please remove txn_rollback() from wal_write in scope of this series? I mean this part: fail: entry->res = -1; journal_entry_complete(entry); return -1; } (remove jounral_entry_complete() from here). I think once you remove journal_entry_complete (which basically calls rollback), you will be able to remove this ugly "cleanr-then-restore" of txn as well: > + /* > + * Queue the entry for processing in journal > + * engine. The semantics of complete_cb implies > + * that fiber's txn (kept in storage) is nil > + * becase WAL is a separet thread, for this > + * sake we zap it here. > + * > + * Still this is messy since the caller runs > + * txn_rollback if something bad happened. Thus > + * restore the former txn on error path. > + */ > + fiber_set_txn(fiber(), NULL); > if (journal_write(req) < 0) { > + fiber_set_txn(fiber(), txn); > diag_set(ClientError, ER_WAL_IO); > diag_log(); > return -1; -- Konstantin Osipov, Moscow, Russia https://scylladb.com