From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 27481281EF for ; Fri, 22 Feb 2019 07:05:05 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id D8GpLmRWUSZu for ; Fri, 22 Feb 2019 07:05:05 -0500 (EST) Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id DBCFE27B07 for ; Fri, 22 Feb 2019 07:05:04 -0500 (EST) From: Ilya Kosarev Subject: [tarantool-patches] [PATCH] Close socket explicitly before wal_dir at exit Date: Fri, 22 Feb 2019 15:05:00 +0300 Message-Id: <20190222120500.21180-1-i.kosarev@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: georgy@tarantool.org, i.kosarev@corp.mail.ru, Ilya Kosarev tarantool instance didn't close socket explicitly which could cause hot standby instance to fail to bind in case it tries to bind before socket is closed by OS. Now it is fixed by closing socket explicitly before wal_dir. Closes #3967 --- Branch: https://github.com/tarantool/tarantool/tree/i.kosarev/gh-3967-close-socket-explicitly Issue: https://github.com/tarantool/tarantool/issues/3967 src/box/box.cc | 1 + src/box/iproto.cc | 7 +++++++ src/box/iproto.h | 3 +++ 3 files changed, 11 insertions(+) diff --git a/src/box/box.cc b/src/box/box.cc index 9a8ca1585..38bdebeba 100644 --- a/src/box/box.cc +++ b/src/box/box.cc @@ -1666,6 +1666,7 @@ box_free(void) tuple_free(); port_free(); #endif + iproto_socket_free(); replication_free(); sequence_free(); gc_free(); diff --git a/src/box/iproto.cc b/src/box/iproto.cc index 19a945d2a..1d2fb3bdd 100644 --- a/src/box/iproto.cc +++ b/src/box/iproto.cc @@ -2075,3 +2075,10 @@ iproto_set_msg_max(int new_iproto_msg_max) iproto_do_cfg(&cfg_msg); cpipe_set_max_input(&net_pipe, new_iproto_msg_max / 2); } + +void +iproto_socket_free() +{ + tt_pthread_cancel(net_cord.id); + close(binary.ev.fd); +} diff --git a/src/box/iproto.h b/src/box/iproto.h index b9a6cf8f7..6a9627705 100644 --- a/src/box/iproto.h +++ b/src/box/iproto.h @@ -80,6 +80,9 @@ iproto_listen(const char *uri); void iproto_set_msg_max(int iproto_msg_max); +void +iproto_socket_free(); + #endif /* defined(__cplusplus) */ #endif -- 2.17.1