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 085372A38A for ; Thu, 23 Aug 2018 12:00:36 -0400 (EDT) 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 S86FyJgyNdIR for ; Thu, 23 Aug 2018 12:00:35 -0400 (EDT) Received: from smtp35.i.mail.ru (smtp35.i.mail.ru [94.100.177.95]) (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 4668D2A393 for ; Thu, 23 Aug 2018 12:00:35 -0400 (EDT) From: Georgy Kirichenko Subject: [tarantool-patches] [PATCH] Don't throw an exception in a replication handler Date: Thu, 23 Aug 2018 19:00:31 +0300 Message-Id: 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 Kirichenko It is an error to throw an error out of a cbus message handler because it breaks cbus message delivery. In case of replication throwing an error prevents iproto against replication socket closing. Fixes 3642 --- Branch: https://github.com/tarantool/tarantool/tree/g.kirichenko/gh-3642-fix-replication-socket-leak Issue: https://github.com/tarantool/tarantool/issues/3642 src/box/iproto.cc | 2 +- test/replication/misc.test.lua | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/box/iproto.cc b/src/box/iproto.cc index 0b92c316e..df32e4f2b 100644 --- a/src/box/iproto.cc +++ b/src/box/iproto.cc @@ -1412,7 +1412,7 @@ tx_process_join_subscribe(struct cmsg *m) unreachable(); } } catch (SocketError *e) { - throw; /* don't write error response to prevent SIGPIPE */ + return; /* don't write error response to prevent SIGPIPE */ } catch (Exception *e) { iproto_write_error(con->input.fd, e, ::schema_version, msg->header.sync); diff --git a/test/replication/misc.test.lua b/test/replication/misc.test.lua index 850579769..32ab07924 100644 --- a/test/replication/misc.test.lua +++ b/test/replication/misc.test.lua @@ -79,4 +79,14 @@ box.space.space1:drop() test_run:cmd("switch default") test_run:drop_cluster(SERVERS) +test_run:cmd('create server sock with rpl_master=default, script="replication/replica.lua"') +test_run:cmd(string.format('start server sock')) +test_run:cmd('switch sock') +fiber = require('fiber') +k = tonumber(io.popen('ulimit -n'):read()) +for i = 2, k > 1024 and 1 or k + 20 do local replication = box.cfg.replication box.cfg{replication = {}} box.cfg{replication = replication} while box.info.replication[1].upstream.status ~= 'follow' do fiber.sleep(0.0001) end end +test_run:cmd('switch default') +test_run:cmd('stop server sock') +test_run:cmd('cleanup server sock') + box.schema.user.revoke('guest', 'replication') -- 2.18.0