[SERVER-14576] mongod automatic shutdown on stdin close Created: 16/Jul/14 Updated: 10/May/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Admin |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Ian Daniel | Assignee: | DO NOT USE - Backlog - Platform Team |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | community-team, move-sa | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Sprint: | Server 2.7.6, Platforms 12 (04/01/16), Platforms 13 (04/22/16) | ||||||||||||
| Participants: | |||||||||||||
| Case: | (copied to CRM) | ||||||||||||
| Description |
|
Some OEM-style applications/systems need to control a mongod instance, including controlling its lifecycle. As part of that, the parent system needs a means of ensuring that if the parent process dies, the mongod instance also terminates. This includes the case of an unclean shutdown of the parent process. A proposal for handling this is for the child process (mongod) receives a custom stdin from the parent process. If this stdin (the pipe/file descriptor) gets closed (which will happen when the parent process shuts down, cleanly or uncleanly), the child process will also exit. The benefit of this approach is that it ensures that mongod will shutdown properly regardless of the parent process’s ability to do so. It also makes it much easier to script mongod's shutdown, as it does not require its parent process to be in a valid state (only to die). |
| Comments |
| Comment by Steven Vannelli [ 10/May/22 ] | |
|
Moving this ticket to the Backlog and removing the "Backlog" fixVersion as per our latest policy for using fixVersions. | |
| Comment by Matt Kangas [ 20/Aug/14 ] | |
|
mark.benvenuto confirms that Windows does support creating unnamed pipes via CreatePipe. However, to use this in the child process you have to convert a string to a handle, which is not directly supported. | |
| Comment by Andy Schwerin [ 21/Jul/14 ] | |
|
Some notes on matt.kangas@10gen.com's proposal.
| |
| Comment by Matt Kangas [ 17/Jul/14 ] | |
|
Proposal: in all servers (mongod, mongos) add a new command line option
The argument is an integer file descriptor (not a path). If no argument is provided, stdin (fd=0) is used. When this command line option is specified, a background thread is launched which reads the pipe forever and discards results. When the pipe is closed, the background thread initiates server shutdown. |