From: Jianpeng Ma Date: Fri, 23 Aug 2019 06:15:43 +0000 (+0800) Subject: msg/async: Don't dec(msgr_active_connections) if conn still in accepting_conns. X-Git-Tag: v15.1.0~1139^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5b41e12fdb4452b974e9ec46378a58378e33c3b1;p=ceph.git msg/async: Don't dec(msgr_active_connections) if conn still in accepting_conns. I found this bug during test: "AsyncMessenger::Worker-0": { "msgr_active_connections": 18446744073709313353, }, This because before AsyncMessenger::accept_conn, the conn met fault and stop this conn. In unregister_conn, it will dec(msgr_active_connections). But the conn it don't inc(msgr_active_connections). Only erase from accepting_conns, it will inc(msgr_active_connections). Signed-off-by: Jianpeng Ma --- diff --git a/src/msg/async/AsyncMessenger.h b/src/msg/async/AsyncMessenger.h index 5c1c6ba397ec..b7370cfc9d0d 100644 --- a/src/msg/async/AsyncMessenger.h +++ b/src/msg/async/AsyncMessenger.h @@ -403,7 +403,8 @@ public: */ void unregister_conn(const AsyncConnectionRef& conn) { std::lock_guard l{deleted_lock}; - conn->get_perf_counter()->dec(l_msgr_active_connections); + if (!accepting_conns.count(conn)) + conn->get_perf_counter()->dec(l_msgr_active_connections); deleted_conns.emplace(std::move(conn)); if (deleted_conns.size() >= ReapDeadConnectionThreshold) {