[SERVER-11826] DataFileSync thread should shutdown its Client cleanly Created: 22/Nov/13  Updated: 06/Dec/22  Resolved: 14/Sep/18

Status: Closed
Project: Core Server
Component/s: MMAPv1, Stability
Affects Version/s: 2.4.8
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Tom Robinson Assignee: Backlog - Storage Execution Team
Resolution: Won't Fix Votes: 0
Labels: mongod, shutdown, windows
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows Server 2012 R2 (64-bit)
Installed as a Windows Service
Journalling enabled

port=27017
logpath=C:\Mongo\mongod-XXX.log
dbpath=C:\Data\Mongo\XXX
directoryperdb=true
notablescan=true
profile=0
slowms=10000
rest=true


Issue Links:
Related
related to SERVER-9850 replsets/sync_passive.js fails on Win... Closed
Assigned Teams:
Storage Execution
Operating System: Windows
Participants:

 Description   

The MongoDB documentation suggests that the MongoDB service should just be shut down via the Windows Service Control Manager:

net stop MongoDB

When I did this recently, the following was logged and I ended up with a non-zero byte mongod.lock file on disk. (I used the --repair option to fix this but it turns out this probably wasn't necessary as I had journalling enabled.)

Thu Nov 21 11:08:12.011 [serviceShutdown] got SERVICE_CONTROL_STOP request from Windows Service Control Manager, will terminate after current cmd ends
Thu Nov 21 11:08:12.043 [serviceShutdown] now exiting
Thu Nov 21 11:08:12.043 dbexit:
Thu Nov 21 11:08:12.043 [serviceShutdown] shutdown: going to close listening sockets...
Thu Nov 21 11:08:12.043 [serviceShutdown] closing listening socket: 1492
Thu Nov 21 11:08:12.043 [serviceShutdown] closing listening socket: 1500
Thu Nov 21 11:08:12.043 [serviceShutdown] shutdown: going to flush diaglog...
Thu Nov 21 11:08:12.043 [serviceShutdown] shutdown: going to close sockets...
Thu Nov 21 11:08:12.043 [serviceShutdown] shutdown: waiting for fs preallocator...
Thu Nov 21 11:08:12.043 [serviceShutdown] shutdown: lock for final commit...
Thu Nov 21 11:08:12.043 [serviceShutdown] shutdown: final commit...
Thu Nov 21 11:08:12.043 [conn1333] end connection 127.0.0.1:51612 (18 connections now open)
Thu Nov 21 11:08:12.043 [conn1331] end connection 127.0.0.1:51610 (18 connections now open)
...snip...
Thu Nov 21 11:08:12.043 [conn1322] end connection 10.1.2.212:53303 (17 connections now open)
Thu Nov 21 11:08:12.043 [conn1337] end connection 127.0.0.1:51620 (18 connections now open)
Thu Nov 21 11:08:12.839 [serviceShutdown] shutdown: closing all files...
Thu Nov 21 11:08:14.683 [serviceShutdown] Progress: 5/163 3% (File Closing Progress)
Thu Nov 21 11:08:16.012 [serviceShutdown] Progress: 6/163 3% (File Closing Progress)
...snip...
Thu Nov 21 11:08:52.030 [serviceShutdown] Progress: 143/163 87% (File Closing Progress)
Thu Nov 21 11:08:54.092 [serviceShutdown] Progress: 153/163 93% (File Closing Progress)
Thu Nov 21 11:08:55.405 [serviceShutdown] closeAllFiles() finished
Thu Nov 21 11:08:55.405 [serviceShutdown] journalCleanup...
Thu Nov 21 11:08:55.405 [serviceShutdown] removeJournalFiles
Thu Nov 21 11:09:05.578 [DataFileSync] ERROR: Client::shutdown not called: DataFileSync



 Comments   
Comment by Eliot Horowitz (Inactive) [ 27/Nov/13 ]

temporary fix for SERVER-9850 will also fix this, though probably a cleaner way

Comment by Eliot Horowitz (Inactive) [ 27/Nov/13 ]

At shutdown, this is a purely cosmetic issue.
Will see how we can clean it up.

Comment by Tom Robinson [ 22/Nov/13 ]

StackOverflow posting that prompted this bug report:
http://stackoverflow.com/questions/20142123/whats-the-safest-way-to-shut-down-mongodb-when-running-as-a-windows-service?noredirect=1#comment30022908_20142123

Possible related issue:
https://jira.mongodb.org/browse/SERVER-2719

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