[SERVER-4872] EXIT_KILL breaks systemd Created: 03/Feb/12  Updated: 28/Oct/15  Resolved: 16/Feb/12

Status: Closed
Project: Core Server
Component/s: Stability
Affects Version/s: 2.0.2
Fix Version/s: 2.1.1

Type: Bug Priority: Major - P3
Reporter: Nathaniel McCallum Assignee: Andy Schwerin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Major Change
Operating System: ALL
Participants:

 Description   

systemd expects daemons that exit with non-zero exit statuses. But a standard SIGTERM to mongod returns 12. This causes systemd to believe that mongod has failed every time it exits. The exit code when signaled should be 0.



 Comments   
Comment by Andy Schwerin [ 16/Feb/12 ]

Wherever we document the meaning of mongod exit codes, we need to note that mongod exits with code 0 on Unix variants if it shuts down cleanly, even if it was shut down with a TERM, HUP or INT (control-c) signal.

Comment by auto [ 16/Feb/12 ]

Author:

{u'login': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}

Message: SERVER-4872: Fix the killall unit test, and make it more robust.

The test now has a little more documentation about what it does, and is a little
more rigorous about checking that it has succeeded.
Branch: master
https://github.com/mongodb/mongo/commit/2cd084da70f989062ae26d5778021fcf3f170b22

Comment by auto [ 16/Feb/12 ]

Author:

{u'login': u'andy10gen', u'email': u'schwerin@10gen.com', u'name': u'Andy Schwerin'}

Message: SERVER-4872 Have SIGTERM, SIGINT and SIGHUP report exit code 0 in mongod (successful shutdown).

Previously, these signals would cause mongod to exit with code 12 (EXIT_KILL), even though
shutdown happened cleanly. This makes systemd, and presumably other service startup kits
unhappy, because we've told them to shut down mongo using SIGTERM, and they consider it
warning-worthy when something exits with another code.
Branch: master
https://github.com/mongodb/mongo/commit/8ffd58917638fe20d3fd85fdf49d397ba57da0c1

Generated at Thu Feb 08 03:07:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.