]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
msg: fix deadlock when handling existing but closed v2 connection 48254/head
authorRadosław Zarzyński <rzarzyns@redhat.com>
Fri, 17 Jun 2022 12:17:25 +0000 (14:17 +0200)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Mon, 26 Sep 2022 12:29:06 +0000 (19:29 +0700)
commit244b6a161ce62fc05431f772ee71c3386b791667
treef56240b1b9f43c88fbed550762aa338097118e08
parente3b54c2cf33fa0b0998e4b2ef08296e062dee14e
msg: fix deadlock when handling existing but closed v2 connection

The deadlock is illustrated best by the following snippet
provided by jianwei zhang who also made the problem analysis
(many thanks!).

```
thread-35
AsyncMessenger::shutdown_connections         hold             AsyncMessenger::lock            std::lock_guard l{lock}
AsyncConnection::stop                         wait                AsyncConnection::lock            lock.lock()

thread-3
ProtocolV2::handle_existing_connection        hold                AsyncConnection::lock            std::lock_guard<std::mutex> l(existing->lock)
AsyncMessenger::accept_conn                wait                AsyncMessenger::lock            std::lock_guard l{lock}
```

Fixes: https://tracker.ceph.com/issues/55355
Signed-off-by: Radosław Zarzyński <rzarzyns@redhat.com>
(cherry picked from commit a6fcb1ccbc44e60416eb5f4e2c7291afe3a9d44d)
src/msg/async/ProtocolV2.cc