[SERVER-32477] ASIOSession fails to gracefully teardown sockets Created: 28/Dec/17  Updated: 30/Oct/23  Resolved: 03/Jan/18

Status: Closed
Project: Core Server
Component/s: Networking
Affects Version/s: 3.6.0, 3.6.1
Fix Version/s: 3.6.4, 3.7.1

Type: Task Priority: Minor - P4
Reporter: Matt Broadstone Assignee: Matt Broadstone
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Backport Requested:
v3.6
Sprint: Platforms 2018-01-15
Participants:

 Description   

In the cleanup handler of ServiceStateMachine we depend on socket teardown to occur as part of the destruction of a Session instance, however ASIOSession omits a dtor and leaves the job up to asio. Unfortunately, while this results in actually closing the socket, it does not do so gracefully, leaving the client side guessing what the current state is only to find a ECONNRESET on subsequent attempts to write. ASIOSession has most of the complete implementation for graceful shutdown in its shutdown method (notably omitting an explicit call to close the sockets), and everything behaves as expected if that's called in the ASIOSession dtor.



 Comments   
Comment by Githook User [ 05/Apr/18 ]

Author:

{'email': 'william.schultz@mongodb.com', 'name': 'William Schultz', 'username': 'will62794'}

Message: SERVER-32477 Fix lint
Branch: v3.6
https://github.com/mongodb/mongo/commit/3128ca2531aef67fbfe7cd04c824a4df58f508f8

Comment by Githook User [ 05/Apr/18 ]

Author:

{'email': 'jbreams@mongodb.com', 'name': 'Jonathan Reams', 'username': 'jbreams'}

Message: SERVER-32477 Fix logging and tests
Branch: v3.6
https://github.com/mongodb/mongo/commit/1d50738b604a637f1f7d896a17131d8be7b2aa23

Comment by Githook User [ 05/Apr/18 ]

Author:

{'email': 'mbroadst@gmail.com', 'name': 'Matt Broadstone', 'username': 'mbroadst'}

Message: SERVER-32477 Gracefully shutdown sockets in ASIOSession

We were depending on the dtor for the basic_stream_socket to
gracefully shutdown the socket on destruction, however this is
broken on OSX. Instead we need to explicitly shutdown the socket
(the asio docs indicate that this is the most "portable" solution).

(cherry picked from commit 4108212bffdad96a5be22e2fc71038f48d8740a4)
Branch: v3.6
https://github.com/mongodb/mongo/commit/11fabe4f8295da18f68aae8a877c38a48c1b5133

Comment by Githook User [ 03/Jan/18 ]

Author:

{'name': 'Matt Broadstone', 'username': 'mbroadst', 'email': 'mbroadst@gmail.com'}

Message: SERVER-32477 Gracefully shutdown sockets in ASIOSession

We were depending on the dtor for the basic_stream_socket to
gracefully shutdown the socket on destruction, however this is
broken on OSX. Instead we need to explicitly shutdown the socket
(the asio docs indicate that this is the most "portable" solution).
Branch: master
https://github.com/mongodb/mongo/commit/4108212bffdad96a5be22e2fc71038f48d8740a4

Generated at Thu Feb 08 04:30:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.