[SERVER-84241] AsioTransportLayer::stopAcceptingSessions can deadlock if called before listener thread started listening Created: 15/Dec/23  Updated: 18/Jan/24  Resolved: 20/Dec/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.2.1, 7.3.0-rc0

Type: Bug Priority: Major - P3
Reporter: Patrick Freed Assignee: Patrick Freed
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.2
Sprint: Service Arch 2023-12-25
Participants:
Linked BF Score: 105

 Description   

In the event that stopAcceptingSessions is invoked after the asio listener thread has started but before it has actually begun listening, stopAcceptingSessions will block forever while trying to join the listener thread. This is because the listener thread's state only transitions to kShuttingDown if its prior state was kActive, not also kNew.

This situation is pretty rare. An example trigger would be killing a new mongos/d process very quickly after starting it up.



 Comments   
Comment by Githook User [ 18/Jan/24 ]

Author:

{'name': 'Patrick Freed', 'email': 'patrick.freed@mongodb.com', 'username': 'patrickfreed'}

Message: SERVER-84241 Fix deadlock when AsioTransportLayer::stopAcceptingSessions is called before listener thread is active (#17636)
Branch: v7.2
https://github.com/mongodb/mongo/commit/c60fe31709d8fe4b431dd40494a082d610a8431a

Comment by Githook User [ 20/Dec/23 ]

Author:

{'name': 'Patrick Freed', 'email': 'patrick.freed@mongodb.com', 'username': 'patrickfreed'}

Message: SERVER-84241 Fix deadlock when AsioTransportLayer::stopAcceptingSessions is called before listener thread is active (#17636)

GitOrigin-RevId: c726e01e0c5759f1cfbe311102548538330d26e2
Branch: master
https://github.com/mongodb/mongo/commit/ce33e30c78960eafdf68973b23a0140ad687f8a3

Generated at Thu Feb 08 06:54:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.