From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: tarantool-patches@freelists.org Cc: vdavydov.dev@gmail.com Subject: [PATCH v2 07/11] coio: fix double close of a file descriptor Date: Wed, 5 Dec 2018 00:28:54 +0300 [thread overview] Message-ID: <cff6926b05bad0be0b983eb9c614245a30af95a5.1543958698.git.v.shpilevoy@tarantool.org> (raw) In-Reply-To: <cover.1543958698.git.v.shpilevoy@tarantool.org> In-Reply-To: <cover.1543958698.git.v.shpilevoy@tarantool.org> coio_service_on_accept is called by evio by an on_accept pointer. If evio obtains not zero from on_accept pointer, it closes accepted socket. But coio_service_on_accept closes it too, when fiber_new fails. It is double close. Note that the bug existed even when on_accept was able to throw. --- src/coio.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/coio.cc b/src/coio.cc index 9b9c71c79..355c7a42e 100644 --- a/src/coio.cc +++ b/src/coio.cc @@ -595,9 +595,6 @@ coio_service_on_accept(struct evio_service *evio_service, { struct coio_service *service = (struct coio_service *) evio_service->on_accept_param; - struct ev_io coio; - - coio_create(&coio, fd); /* Set connection name. */ char fiber_name[SERVICE_NAME_MAXLEN]; @@ -609,9 +606,10 @@ coio_service_on_accept(struct evio_service *evio_service, if (f == NULL) { diag_log(); say_error("can't create a handler fiber, dropping client connection"); - evio_close(loop(), &coio); return -1; } + struct ev_io coio; + coio_create(&coio, fd); /* * The coio is passed into the created fiber, reset the * libev callback param to point at it. -- 2.17.2 (Apple Git-113)
next prev parent reply other threads:[~2018-12-04 21:28 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-12-04 21:28 [PATCH v2 00/11] SWIM preparation Vladislav Shpilevoy 2018-12-04 21:28 ` [PATCH v2 01/11] sio: remove unused functions Vladislav Shpilevoy 2018-12-09 12:10 ` Vladimir Davydov 2018-12-04 21:28 ` [PATCH v2 10/11] evio: make code C compatible Vladislav Shpilevoy 2018-12-05 8:56 ` Vladimir Davydov 2018-12-05 20:07 ` [tarantool-patches] " Vladislav Shpilevoy 2018-12-04 21:28 ` [PATCH v2 11/11] evio: turn nto c Vladislav Shpilevoy 2018-12-04 21:28 ` [PATCH v2 02/11] sio: treat EADDRINUSE in sio_listen as error Vladislav Shpilevoy 2018-12-09 12:57 ` Vladimir Davydov 2018-12-10 15:36 ` [tarantool-patches] " Vladislav Shpilevoy 2018-12-04 21:28 ` [PATCH v2 03/11] sio: remove exceptions Vladislav Shpilevoy 2018-12-09 12:54 ` Vladimir Davydov 2018-12-10 15:37 ` [tarantool-patches] " Vladislav Shpilevoy 2018-12-11 8:44 ` Vladimir Davydov 2018-12-04 21:28 ` [PATCH v2 04/11] sio: make code compatible with C Vladislav Shpilevoy 2018-12-05 8:57 ` Vladimir Davydov 2018-12-05 20:07 ` [tarantool-patches] " Vladislav Shpilevoy 2018-12-04 21:28 ` [PATCH v2 05/11] sio: turn into C Vladislav Shpilevoy 2018-12-04 21:28 ` [PATCH v2 06/11] evio: make on_accept be nothrow Vladislav Shpilevoy 2018-12-04 21:28 ` Vladislav Shpilevoy [this message] 2018-12-04 21:28 ` [PATCH v2 08/11] evio: remove exceptions Vladislav Shpilevoy 2018-12-04 21:28 ` [PATCH v2 09/11] coio: fix file descriptor leak on accept Vladislav Shpilevoy 2018-12-11 8:47 ` [PATCH v2 00/11] SWIM preparation Vladimir Davydov
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=cff6926b05bad0be0b983eb9c614245a30af95a5.1543958698.git.v.shpilevoy@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=vdavydov.dev@gmail.com \ --subject='Re: [PATCH v2 07/11] coio: fix double close of a file descriptor' \ /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