[SERVER-14475] Race conditions in clean shutdown Created: 07/Jul/14  Updated: 11/Jul/16  Resolved: 25/Jul/14

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

Type: Bug Priority: Major - P3
Reporter: Mathias Stearn Assignee: Kaloian Manassiev
Resolution: Done Votes: 0
Labels: cap-ticket-needed
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Tested
Operating System: ALL
Participants:

 Description   

inShutdown() becomes true rather late in the shutdown procedure. Among potentially other issues, it comes after we close our listening sockets which can trigger fatal assertion 16727.
As an example search for "Fatal Assertion 16727" in http://buildlogs.mongodb.org/mci_0.9_windows-64-debug/builds/66149/test/aggregation_0/testshard1.js

I think inShutdown must become true before we begin any shutdown-related activities. This may require decoupling it from the numExitCalls counter.

There's also a race condition with the listener thread exiting before the _exit call from a previous exitClean call completing, which causes the server to exit with return code 48 (EXIT_NET_ERROR).



 Comments   
Comment by Githook User [ 25/Jul/14 ]

Author:

{u'username': u'kaloianm', u'name': u'Kaloian Manassiev', u'email': u'kaloian.manassiev@mongodb.com'}

Message: SERVER-14475 Network thread should not exit with error during clean shutdown
Branch: master
https://github.com/mongodb/mongo/commit/aa7a01f3f9cd8b7d018ac572bb7fae60544dd146

Comment by Githook User [ 24/Jul/14 ]

Author:

{u'username': u'kaloianm', u'name': u'Kaloian Manassiev', u'email': u'kaloian.manassiev@mongodb.com'}

Message: SERVER-14475 Use loadRelaxed instead of load for inShutdown
Branch: master
https://github.com/mongodb/mongo/commit/a3c8b1c2eee598ba9fe740a118bab31e03647bdb

Comment by Githook User [ 18/Jul/14 ]

Author:

{u'username': u'kaloianm', u'name': u'Kaloian Manassiev', u'email': u'kaloian.manassiev@mongodb.com'}

Message: SERVER-14475 Cleanup the shutdown code and indicate shutdown earlier
Branch: master
https://github.com/mongodb/mongo/commit/848999f1527e8390d4d76f9fad0860218b73be4d

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