[SERVER-6771] Windows Service: 'net stop mongodb' gives System error 109 has occurred. -- The pipe has been ended. Created: 15/Aug/12 Updated: 03/Jan/18 Resolved: 11/Aug/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Packaging |
| Affects Version/s: | 2.0.7, 2.2.0-rc1 |
| Fix Version/s: | 2.7.5 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Tad Marshall | Assignee: | Mark Benvenuto |
| Resolution: | Done | Votes: | 12 |
| Labels: | Windows, cap-ticket-needed | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows, mongod.exe or mongos.exe running as a service |
||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||||||||||||||||||
| Operating System: | Windows | ||||||||||||||||||||||||||||||||||||||||
| Sprint: | Server 2.7.5 | ||||||||||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||||||||||||||||||||||||
| Description |
|
When mongod.exe is installed as a service on Windows (with --install), the "net stop mongodb" command does not reply with "The Mongo DB service was stopped successfully." the way it did in version 2.1.0 but instead displays "System error 109 has occurred." and "The pipe has been ended.". This was likely broken by changes we made to our exit logic after 2.1.0 but before 2.2.0-rc1. This error message is actually the extent of the problem – we shut down cleanly and no errors are logged in the Windows Event Log. |
| Comments |
| Comment by Githook User [ 07/Aug/14 ] |
|
Author: {u'username': u'markbenvenuto', u'name': u'Mark Benvenuto', u'email': u'mark.benvenuto@mongodb.com'}Message: |
| Comment by Michael Kennedy [ 25/Mar/14 ] |
|
I believe this is also the case on Windows 8.1 running 2.6 rc0. |
| Comment by Jose Medaglia [ 25/Mar/14 ] |
|
Regarding the affected versions, this is still happening on latest MongoDB version (2.4.9 64-bit) in Windows 7 |
| Comment by Michael Kennedy [ 07/Mar/14 ] |
|
Nice to see this getting some attention, thanks. |
| Comment by Tad Marshall [ 01/Oct/12 ] |
|
On some systems, you may see the "Error 109" from both a command line "net stop mongodb" and from a stop issued in the Services console, or you may see the error in one place and not in the other. The cause and the fix should be the same in both cases, but we'll be sure to test both when fixing this. |
| Comment by Tad Marshall [ 17/Aug/12 ] |
|
The commit that fixed this broke clean shutdown. I need to prevent early exit in a different way. |
| Comment by auto [ 17/Aug/12 ] |
|
Author: {u'date': u'2012-08-17T02:48:08-07:00', u'email': u'tad@10gen.com', u'name': u'Tad Marshall'}Message: Revert " This reverts commit a30fbf1c35b266c608e50a48d68d4a7a147015e8. This change appears to have broken clean shutdown in many cases |
| Comment by Tad Marshall [ 16/Aug/12 ] |
|
Fix pushed to master ... not yet to 2.2 or 2.0 branches. |
| Comment by auto [ 16/Aug/12 ] |
|
Author: {u'date': u'2012-08-16T10:56:06-07:00', u'email': u'tad@10gen.com', u'name': u'Tad Marshall'}Message: Stay running while the Windows Service Control Manager makes its |
| Comment by Tad Marshall [ 16/Aug/12 ] |
|
I spent some quality time in the debugger and learned what REALLY goes on when we run as a service and then get shut down. It's a little different from what I had thought before. When we call the Windows API StartServiceCtrlDispatcher(), that thread blocks inside the Windows Service Control Manager until it is ready to let go of us. The "start" address that we pass to this API is called on a new thread, and we proceed to do our run-as-a-service thing on that thread. The SCM wants us to RETURN from that thread, at which point it will return on the original thread and we are then free to call _exit() to prevent static destructors from doing any damage. What we CAN'T do is exit from the callback thread, at least if we want to keep the SCM happy. |