[SERVER-27242] Improve shutdown semantics for NetworkInterfaceASIO Created: 30/Nov/16  Updated: 23/Jul/18  Resolved: 23/Jul/18

Status: Closed
Project: Core Server
Component/s: Networking
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Samantha Ritter (Inactive) Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Done Votes: 0
Labels: ASE, ASIO, service_architecture
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

The contract for NetworkInterfaceASIO is that callers should not call startCommand() if NetworkInterfaceASIO::inShutdown() is true, but we don't enforce this in any way.

Additionally, jobs that have started in the network interface may not complete if NIA shuts down while they are still running. We currently stop the asio machinery by calling io_service::stop():

 * To effect a shutdown, the application will then need to call the io_service
 * object's stop() member function. This will cause the io_service run() call
 * to return as soon as possible, abandoning unfinished operations and without
 * permitting ready handlers to be dispatched.
 *
 * Alternatively, if the application requires that all operations and handlers
 * be allowed to finish normally, the work object may be explicitly destroyed.

To implement a more graceful shutdown, we should destroy our asio::io_service::work object instead of calling stop(), and ensure that all callbacks passed into startCommand get called. I would not be surprised if our current implementation was the cause of some subtle hangs. We will also need to add checks throughout the system for kInShutdown, to stop work from circulating further in the system once we've shut down.



 Comments   
Comment by Gregory McKeon (Inactive) [ 23/Jul/18 ]

ASIO is gone.

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