File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -1487,8 +1487,15 @@ void DcpProducer::setDisconnect() {
14871487 ConnHandler::setDisconnect ();
14881488 std::for_each (
14891489 streams.begin (), streams.end (), [](StreamsMap::value_type& vt) {
1490+ std::vector<std::shared_ptr<Stream>> streamPtrs;
1491+ // MB-35049: hold StreamContainer rlock while calling setDead
1492+ // leads to lock inversion - so collect sharedptrs in one pass
1493+ // then setDead once it is released (itr out of scope).
14901494 for (auto itr = vt.second ->rlock (); !itr.end (); itr.next ()) {
1491- itr.get ()->setDead (END_STREAM_DISCONNECTED);
1495+ streamPtrs.push_back (itr.get ());
1496+ }
1497+ for (auto stream : streamPtrs) {
1498+ stream->setDead (END_STREAM_DISCONNECTED);
14921499 }
14931500 });
14941501}
You can’t perform that action at this time.
0 commit comments