[SERVER-47166] Self-deadlock when cancelling networking sessions Created: 27/Mar/20  Updated: 29/Oct/23  Resolved: 16/Apr/20

Status: Closed
Project: Core Server
Component/s: Concurrency, Networking
Affects Version/s: None
Fix Version/s: 4.4.0, 4.7.0

Type: Bug Priority: Major - P3
Reporter: Spencer Brody (Inactive) Assignee: Benjamin Caimano (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
is related to SERVER-47229 Make TransportSessionASIO cancelation... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Service arch 2020-04-20
Participants:
Linked BF Score: 32

 Description   

cancelSession erases the TransportSession under the Baton's mutex.  If that session has an outstanding Promise, however, it will try to break that promise, which in turn schedules the corresponding Future to run (and resolve with a BrokenPromise error).  But scheduling the Future to run requires locking the Baton's mutex.  This results in deadlock.

Instead of destroying the TransportSession under the Baton's mutex, we should move the TransportSession out of the Baton's _sessions map under the mutex, the release the mutex before actually destroying the TransportSession.



 Comments   
Comment by Githook User [ 23/Apr/20 ]

Author:

{'name': 'Ben Caimano', 'email': 'ben.caimano@10gen.com'}

Message: SERVER-47166 Explicitly break Baton Promises outside of locks
Branch: v4.4
https://github.com/mongodb/mongo/commit/36c9eb3937d083812788f6c1b522d92d6dfe9af9

Comment by Githook User [ 16/Apr/20 ]

Author:

{'name': 'Ben Caimano', 'email': 'ben.caimano@10gen.com'}

Message: SERVER-47166 Explicitly break Baton Promises outside of locks
Branch: master
https://github.com/mongodb/mongo/commit/5a3b48b31445888d06b593055ffcd13fa0d701b4

Generated at Thu Feb 08 05:13:28 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.