From: Vladimir Davydov <vdavydov.dev@gmail.com> To: Konstantin Osipov <kostja.osipov@gmail.com> Cc: tarantool-patches@freelists.org, i.kosarev@corp.mail.ru, Ilya Kosarev <ilyanapar@yandex.ru> Subject: Re: [tarantool-patches] [PATCH v2] iproto: close socket explicitly before wal_dir at exit Date: Mon, 25 Feb 2019 20:08:29 +0300 [thread overview] Message-ID: <20190225170829.wit66yfadk4hk3zb@esperanza> (raw) In-Reply-To: <20190225165047.GF2663@chai> On Mon, Feb 25, 2019 at 07:50:47PM +0300, Konstantin Osipov wrote: > * Ilya Kosarev <i.kosarev@tarantool.org> [19/02/25 19:14]: > > +void > > +iproto_free() > > +{ > > + tt_pthread_cancel(net_cord.id); > > + tt_pthread_join(net_cord.id, NULL); > > + /* > > + * Close socket descriptor to prevent hot standby instance > > + * failing to bind in case it tries to bind > > + * before socket is closed by OS. > > + */ > > + close(binary.ev.fd); > > +} > > What if there is no socket descriptor in binary.ev.fd? > I understand it's OK to close a non-existing descriptor, but still > looks a bit messy to me. Yeah, missed that, sorry. Fixed as shown below: From 37b883145ff0464640d917fe58b488eb7d539400 Mon Sep 17 00:00:00 2001 From: Vladimir Davydov <vdavydov.dev@gmail.com> Date: Mon, 25 Feb 2019 20:03:27 +0300 Subject: [PATCH] iproto: don't attempt to close socket if it was not open This can't entail any consequences, because socket fd is set to -1 in this case, but this just looks a bit messy. Let's clean it up. Follow-up commit 305dbcf68953 ("iproto: close socket explicitly before wal_dir at exit"). diff --git a/src/box/iproto.cc b/src/box/iproto.cc index 226b9d06..863eb4f0 100644 --- a/src/box/iproto.cc +++ b/src/box/iproto.cc @@ -2152,5 +2152,6 @@ iproto_free() * failing to bind in case it tries to bind before socket * is closed by OS. */ - close(binary.ev.fd); + if (evio_service_is_active(&binary)) + close(binary.ev.fd); }
next prev parent reply other threads:[~2019-02-25 17:08 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-02-25 14:56 Ilya Kosarev 2019-02-25 15:07 ` Vladimir Davydov 2019-02-25 16:50 ` [tarantool-patches] " Konstantin Osipov 2019-02-25 17:08 ` Vladimir Davydov [this message] 2020-08-14 10:46 [Tarantool-patches] " Ilya Kosarev
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=20190225170829.wit66yfadk4hk3zb@esperanza \ --to=vdavydov.dev@gmail.com \ --cc=i.kosarev@corp.mail.ru \ --cc=ilyanapar@yandex.ru \ --cc=kostja.osipov@gmail.com \ --cc=tarantool-patches@freelists.org \ --subject='Re: [tarantool-patches] [PATCH v2] iproto: close socket explicitly before wal_dir at exit' \ /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