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() {
1487
1487
ConnHandler::setDisconnect ();
1488
1488
std::for_each (
1489
1489
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).
1490
1494
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);
1492
1499
}
1493
1500
});
1494
1501
}
You can’t perform that action at this time.
0 commit comments