[SERVER-69868] Return an error when starting a `TransportLayer` that is shutdown Created: 21/Sep/22  Updated: 29/Oct/23  Resolved: 06/Oct/22

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 6.1.1, 4.4.18, 5.0.14, 6.0.3, 6.2.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Amirsaman Memaripour Assignee: Celina Tala
Resolution: Fixed Votes: 0
Labels: new-eng, save-for-celina
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Backport Requested:
v6.1, v6.0, v5.0, v4.4
Sprint: Service Arch 2022-10-17
Participants:
Linked BF Score: 5

 Description   

The interface for TransportLayer::start is designed to return a Status, however, TransportLayerASIO internally uses an invariant to verify that the instance of TransportLayer is not shutdown: https://github.com/mongodb/mongo/blob/6f450a3cea6287612329f44e90536d72fe7c16c5/src/mongo/transport/transport_layer_asio.cpp#L1371

 

This can cause an unnecessary server-crash if the main thread attempts to start the TransportLayer after a shutdown is initiated.

A possible solution to fix this issue is to return a shutdown error and properly handle this non-okay Status at the initialization site, thus, avoid crashing the server when shutdown is in progress.



 Comments   
Comment by Githook User [ 01/Nov/22 ]

Author:

{'name': 'Celina Tala', 'email': 'celinahtala@gmail.com', 'username': 'celinatala-1'}

Message: SERVER-69868 Return ShutdownStatus When Starting a Shutdown `TransportLayer`

(cherry picked from commit 29006706c176ca036120d1b2569c0f59dd8f53b6)
Branch: v5.0
https://github.com/mongodb/mongo/commit/a170f2d160c42a7e7af48de775c97a693880fc1c

Comment by Githook User [ 01/Nov/22 ]

Author:

{'name': 'Celina Tala', 'email': 'celinahtala@gmail.com', 'username': 'celinatala-1'}

Message: SERVER-69868 Return ShutdownStatus When Starting a Shutdown `TransportLayer`

(cherry picked from commit 29006706c176ca036120d1b2569c0f59dd8f53b6)
Branch: v4.4
https://github.com/mongodb/mongo/commit/8ed32b5c2c68ebe7f8ae2ebe8d23f36037a17dea

Comment by Githook User [ 31/Oct/22 ]

Author:

{'name': 'Celina Tala', 'email': 'celinahtala@gmail.com', 'username': 'celinatala-1'}

Message: SERVER-69868 Return ShutdownStatus When Starting a Shutdown `TransportLayer`

(cherry picked from commit 29006706c176ca036120d1b2569c0f59dd8f53b6)
Branch: v6.0
https://github.com/mongodb/mongo/commit/98294fb90ae6b70224d7b96ecb86807fddf9b459

Comment by Githook User [ 31/Oct/22 ]

Author:

{'name': 'Celina Tala', 'email': 'celinahtala@gmail.com', 'username': 'celinatala-1'}

Message: SERVER-69868 Return ShutdownStatus When Starting a Shutdown `TransportLayer`

(cherry picked from commit 29006706c176ca036120d1b2569c0f59dd8f53b6)
Branch: v6.1
https://github.com/mongodb/mongo/commit/793987870066916318c87b6a082ef2aceb9a5c3b

Comment by Githook User [ 06/Oct/22 ]

Author:

{'name': 'Celina Tala', 'email': 'celinahtala@gmail.com', 'username': 'celinatala-1'}

Message: SERVER-69868 Return ShutdownStatus When Starting a Shutdown `TransportLayer`
Branch: master
https://github.com/mongodb/mongo/commit/29006706c176ca036120d1b2569c0f59dd8f53b6

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