Tarantool development patches archive
 help / color / mirror / Atom feed
From: Ilya Kosarev <i.kosarev@tarantool.org>
To: v.shpilevoy@tarantool.org, alyapunov@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v9 2/3] iproto: fix comment and add assert on destruction
Date: Thu, 24 Dec 2020 23:13:02 +0300	[thread overview]
Message-ID: <d863f1555bd4d061b60376c21ccb59d19ab99db5.1608840673.git.i.kosarev@tarantool.org> (raw)
In-Reply-To: <cover.1608840673.git.i.kosarev@tarantool.org>
In-Reply-To: <cover.1608840673.git.i.kosarev@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 6a1e50922..f7330af21 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

  parent reply	other threads:[~2020-12-24 20:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-24 20:13 [Tarantool-patches] [PATCH v9 0/3] iproto: greeting enhancement Ilya Kosarev
2020-12-24 20:13 ` [Tarantool-patches] [PATCH v9 1/3] iproto: move msg fields initialization to iproto_msg_new() Ilya Kosarev
2020-12-24 20:13 ` Ilya Kosarev [this message]
2020-12-28 11:49   ` [Tarantool-patches] [PATCH v9 2/3] iproto: fix comment and add assert on destruction Vladislav Shpilevoy
2020-12-28 11:49     ` Vladislav Shpilevoy
2020-12-24 20:13 ` [Tarantool-patches] [PATCH v9 3/3] iproto: move greeting from tx thread to iproto Ilya Kosarev
2020-12-28 11:21   ` Vladislav Shpilevoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d863f1555bd4d061b60376c21ccb59d19ab99db5.1608840673.git.i.kosarev@tarantool.org \
    --to=i.kosarev@tarantool.org \
    --cc=alyapunov@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v9 2/3] iproto: fix comment and add assert on destruction' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox