From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp40.i.mail.ru (smtp40.i.mail.ru [94.100.177.100]) (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 55E7F45C306 for ; Sun, 13 Dec 2020 02:38:53 +0300 (MSK) From: Ilya Kosarev Date: Sun, 13 Dec 2020 02:38:46 +0300 Message-Id: <75f56c51e0d888a3b9aee1e8d18367819039face.1607815050.git.i.kosarev@tarantool.org> In-Reply-To: References: In-Reply-To: References: Subject: [Tarantool-patches] [PATCH v6 2/3] iproto: fix comment and add assert on destruction List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: v.shpilevoy@tarantool.org, alyapunov@tarantool.org Cc: tarantool-patches@dev.tarantool.org The comment in tx_process_destroy() about obuf destroting was wrong. Memory for them is actually allocated from tx-belonging slab cache and tx_process_destroy() obviously happens in tx, so the comment is fixed to reflect the reality. It is also implied that connection is in IPROTO_CONNECTION_DESTROYED state in tx_process_destroy(). Now it is verified with assert(). Part of #3776 --- src/box/iproto.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/box/iproto.cc b/src/box/iproto.cc index 6a1e509225..f7330af21d 100644 --- a/src/box/iproto.cc +++ b/src/box/iproto.cc @@ -1379,13 +1379,14 @@ tx_process_destroy(struct cmsg *m) { struct iproto_connection *con = container_of(m, struct iproto_connection, destroy_msg); + assert(con->state == IPROTO_CONNECTION_DESTROYED); if (con->session) { session_destroy(con->session); con->session = NULL; /* safety */ } /* - * Got to be done in iproto thread since - * that's where the memory is allocated. + * obuf is being destroyed in tx thread cause it is where + * it was allocated. */ obuf_destroy(&con->obuf[0]); obuf_destroy(&con->obuf[1]); -- 2.17.1