From: Yuval Lifshitz Date: Thu, 18 May 2023 18:02:29 +0000 (+0000) Subject: rgw/kafka: remove potential race condition between creation and deletion of endpoint X-Git-Tag: v19.0.0~1117^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bc013baccaef4a797e6b9b4bc90c93dc94dad49e;p=ceph.git rgw/kafka: remove potential race condition between creation and deletion of endpoint Fixes: https://tracker.ceph.com/issues/61254 Signed-off-by: Yuval Lifshitz --- diff --git a/src/rgw/rgw_kafka.cc b/src/rgw/rgw_kafka.cc index 163b242d5c02..b4c0ffa24cbb 100644 --- a/src/rgw/rgw_kafka.cc +++ b/src/rgw/rgw_kafka.cc @@ -482,6 +482,7 @@ private: if(conn->timestamp.sec() + max_idle_time < ceph_clock_now()) { ldout(conn->cct, 20) << "kafka run: deleting a connection due to idle behaviour: " << ceph_clock_now() << dendl; conn->destroy(STATUS_CONNECTION_IDLE); + std::lock_guard lock(connections_lock); conn_it = connections.erase(conn_it); --connection_count; \ continue;