[SERVER-1434] "Net stop mondodb" returns an error on windows. Created: 18/Jul/10  Updated: 12/Jul/16  Resolved: 15/Mar/11

Status: Closed
Project: Core Server
Component/s: Tools, Usability
Affects Version/s: 1.5.5
Fix Version/s: 1.9.0

Type: Bug Priority: Major - P3
Reporter: Justin Dearing Assignee: Tad Marshall
Resolution: Done Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7 64bit


Issue Links:
Related
is related to SERVER-2833 mongod.exe does not shut down correct... Closed
Operating System: ALL
Participants:

 Description   

This is from a POST 1.55 daily build.

If I type net stop mongodb from the command line I get:
System error 109 has occurred.

The pipe has been ended.

The log says this:
[websvr] Sun Jul 18 01:12:18 Listener: accept() returns -1 errno:10038 An operation was attempted on something that is not a socket.

The long version of what I did.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

C:\Program Files\10gen\mongodb-win32-x86_64-2010-07-17\bin>mongod --reinstall --logpath "c:\data\logs\mongo.log"
all output going to: c:\data\logs\mongo.log
Deleting service MongoDB.
Service deleted successfully.
Creating service MongoDB.
Service creation successful.
Service can be started from the command line via 'net start "MongoDB"'.
Sun Jul 18 01:11:45 dbexit:
Sun Jul 18 01:11:45 closeAllFiles() finished
Sun Jul 18 01:11:45 dbexit: really exiting now

C:\Program Files\10gen\mongodb-win32-x86_64-2010-07-17\bin>
C:\Program Files\10gen\mongodb-win32-x86_64-2010-07-17\bin>
C:\Program Files\10gen\mongodb-win32-x86_64-2010-07-17\bin>net start mongodb

The Mongo DB service was started successfully.

C:\Program Files\10gen\mongodb-win32-x86_64-2010-07-17\bin>net stop mongodb
System error 109 has occurred.

The pipe has been ended.

C:\Program Files\10gen\mongodb-win32-x86_64-2010-07-17\bin>type c:\data\logs\mongo.log
Sun Jul 18 01:12:12 MongoDB starting : pid=11724 port=27017 dbpath=/data/db/ 64-bit
Sun Jul 18 01:12:12 db version v1.5.6-pre-, pdfile version 4.5
Sun Jul 18 01:12:12 git version: 2d0ed7733a13646d9f644aac0adcdccbfbf6ce1a
Sun Jul 18 01:12:12 sys info: windows (6, 1, 7600, 2, '') BOOST_LIB_VERSION=1_42
[initandlisten] Sun Jul 18 01:12:13 waiting for connections on port 27017
[websvr] Sun Jul 18 01:12:13 web admin interface listening on port 28017
Sun Jul 18 01:12:18 shutdown: going to close listening sockets...
Sun Jul 18 01:12:18 going to close listening socket: 272
Sun Jul 18 01:12:18 going to close listening socket: 284
Sun Jul 18 01:12:18 shutdown: going to flush oplog...
Sun Jul 18 01:12:18 shutdown: going to close sockets...
Sun Jul 18 01:12:18 shutdown: waiting for fs preallocator...
Sun Jul 18 01:12:18 shutdown: closing all files...
[initandlisten] Sun Jul 18 01:12:18 Listener: accept() returns -1 errno:10038 An operation was attempted on something that is not a socket.

[initandlisten] Sun Jul 18 01:12:18 select() failure: ret=-1 errno:10038 An operation was attempted on something that is not a socket.

[initandlisten] Sun Jul 18 01:12:18 now exiting
[initandlisten] Sun Jul 18 01:12:18 shutdown: going to close listening sockets...
[initandlisten] Sun Jul 18 01:12:18 shutdown: going to flush oplog...
[initandlisten] Sun Jul 18 01:12:18 shutdown: going to close sockets...
[initandlisten] Sun Jul 18 01:12:18 shutdown: waiting for fs preallocator...
[initandlisten] Sun Jul 18 01:12:18 shutdown: closing all files...
[websvr] Sun Jul 18 01:12:18 Listener: accept() returns -1 errno:10038 An operation was attempted on something that is not a socket.

C:\Program Files\10gen\mongodb-win32-x86_64-2010-07-17\bin>



 Comments   
Comment by Michael Luo [X] [ 10/Jun/14 ]

i'm seeing this error on 2.6.1 on Windows 2008R2.

Comment by Jason R. Coombs [ 24/May/13 ]

I'm seeing this error on 2.4.3 on Windows 8 64-bit.

Comment by Tad Marshall [ 28/Aug/12 ]

It's not exactly "still outstanding" because it was working fine in 2.1.0; later changes broke it again. But yes, you get this error message in the current code.

The explanation is that mongod.exe is exiting from a callback thread created by the Windows Service Control Manager when it calls us due to "net stop mongodb" and this breaks the RPC pipe it used to create the callback thread. We need to reorganize our exit logic to avoid doing this.

The error message is the only real effect of this issue; we exit on command, cleanly, and inform the Windows Service Control Manager that we are stopped, but then the "net" command displays an error message because we didn't return from the RPC call they way it expected us to.

Comment by John A [ 28/Aug/12 ]

This looks to still be outstanding as of v2.2.0 RC3 https://jira.mongodb.org/browse/SERVER-6771

Comment by Zeng Jie [ 16/Jan/12 ]

This bug has been fixed as SERVER-2833.

Comment by Zeng Jie [ 16/Jan/12 ]

MongoDB 1.8.0 and 1.9.0 also have this problem. It seems that the two github commits above failed to fix the bug.

Comment by Zeng Jie [ 16/Jan/12 ]

I can reproduce this bug easily with MongoDB 2.0.2 on Windows 7 64bit or Windows 2008 R2 64bit.
The key point is to shutdown MongoDB when reading or writing is in process.

Log file:
------
Mon Jan 16 14:50:52 [initandlisten] MongoDB starting : pid=222000 port=27017 dbpath=e:\tmp\data 64-bit
Mon Jan 16 14:50:52 [initandlisten] db version v1.8.2, pdfile version 4.5
Mon Jan 16 14:50:52 [initandlisten] git version: 433bbaa14aaba6860da15bd4de8edf600f56501b
Mon Jan 16 14:50:52 [initandlisten] build sys info: windows (6, 1, 7600, 2, '') BOOST_LIB_VERSION=1_42
Mon Jan 16 14:50:52 [initandlisten] waiting for connections on port 27017
Mon Jan 16 14:50:52 [websvr] web admin interface listening on port 28017
Mon Jan 16 14:51:06 shutdown: going to close listening sockets...
Mon Jan 16 14:51:06 closing listening socket: 284
Mon Jan 16 14:51:06 closing listening socket: 292
Mon Jan 16 14:51:06 shutdown: going to flush diaglog...
Mon Jan 16 14:51:06 shutdown: going to close sockets...
Mon Jan 16 14:51:06 shutdown: waiting for fs preallocator...
Mon Jan 16 14:51:06 shutdown: closing all files...
Mon Jan 16 14:51:06 closeAllFiles() finished
Mon Jan 16 14:51:06 shutdown: removing fs lock...
Mon Jan 16 14:51:06 [initandlisten] Listener: accept() returns -1 errno:10038 在一个非套接字上尝试了一个操作。
Mon Jan 16 14:51:06 [initandlisten] select() failure: ret=-1 errno:10038 在一个非套接字上尝试了一个操作。
Mon Jan 16 14:51:06 [initandlisten] now exiting
Mon Jan 16 14:51:06 dbexit:
Mon Jan 16 14:51:06 [initandlisten] shutdown: going to close listening sockets...
Mon Jan 16 14:51:06 [initandlisten] shutdown: going to flush diaglog...
Mon Jan 16 14:51:06 [initandlisten] shutdown: going to close sockets...
Mon Jan 16 14:51:06 [initandlisten] shutdown: waiting for fs preallocator...
Mon Jan 16 14:51:06 [initandlisten] shutdown: closing all files...
Mon Jan 16 14:51:06 closeAllFiles() finished
Mon Jan 16 14:51:06 [initandlisten] shutdown: removing fs lock...
Mon Jan 16 14:51:06 [initandlisten] couldn't remove fs lock 0
Mon Jan 16 14:51:06 dbexit: really exiting now

Comment by auto [ 16/Mar/11 ]

Author:

{u'login': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}

Message: Fixed SERVER-2719, SERVER-1680 and SERVER-1434 (all had the same underlying cause).
https://github.com/mongodb/mongo/commit/e4df10c2e034e9cb25e0f8de13b5c5e9b00283a9

Comment by auto [ 15/Mar/11 ]

Author:

{u'login': u'rstam', u'name': u'rstam', u'email': u'robert@10gen.com'}

Message: Fixed SERVER-2719, SERVER-1680 and SERVER-1434 (all had the same underlying cause).
https://github.com/mongodb/mongo/commit/6ebf0c03153113927cf28dd5151bdd0cc9a2eead

Comment by Brian Clark [ 07/Feb/11 ]

I can confirm that this same error exists on Windows 2008 R2 64-bit edition.

Comment by Justin Dearing [ 25/Sep/10 ]

Still busted:

C:\src\mongo>net start mongodb

The Mongo DB service was started successfully.

C:\src\mongo>net stop mongodb
System error 109 has occurred.

The pipe has been ended.

C:\src\mongo>'

                                                        • Logged into the mongo shell did some inserts and updates ********************************

C:\src\mongo>type c:\data\logs\mongo.log
Sat Sep 25 08:43:24 MongoDB starting : pid=10528 port=27017 dbpath=/data/db/ 32-bit
Sat Sep 25 08:43:24 db version v1.7.1-pre-, pdfile version 4.5
Sat Sep 25 08:43:24 git version: e8f0119c5546f9133709ef82b42a1947f66aa494
Sat Sep 25 08:43:24 sys info: windows (6, 1, 7600, 2, '') BOOST_LIB_VERSION=1_42
Sat Sep 25 08:43:24 [initandlisten] waiting for connections on port 27017
Sat Sep 25 08:43:24 [websvr] web admin interface listening on port 28017
Sat Sep 25 08:44:36 [initandlisten] connection accepted from 127.0.0.1:33381 #1
Sat Sep 25 08:44:39 [conn1] query admin.$cmd ntoreturn:1 command:

{ listDatabases: 1.0 }

reslen:398 629ms
Sat Sep 25 09:00:11 [conn1] end connection 127.0.0.1:33381
Sat Sep 25 09:00:17 shutdown: going to close listening sockets...
Sat Sep 25 09:00:17 closing listening socket: 320
Sat Sep 25 09:00:17 closing listening socket: 324
Sat Sep 25 09:00:17 shutdown: going to flush oplog...
Sat Sep 25 09:00:17 shutdown: going to close sockets...
Sat Sep 25 09:00:17 shutdown: waiting for fs preallocator...
Sat Sep 25 09:00:17 [initandlisten] Listener: accept() returns -1 errno:10038 An operation was attempted on something th
at is not a socket.
Sat Sep 25 09:00:17 [initandlisten] select() failure: ret=-1 errno:10038 An operation was attempted on something that is
not a socket.
Sat Sep 25 09:00:17 [initandlisten] now exiting
Sat Sep 25 09:00:17 dbexit:
Sat Sep 25 09:00:17 [websvr] Listener: accept() returns -1 errno:10038 An operation was attempted on something that is n
ot a socket.
Sat Sep 25 09:00:17 [initandlisten] shutdown: going to close listening sockets...
Sat Sep 25 09:00:17 [initandlisten] shutdown: going to flush oplog...
Sat Sep 25 09:00:17 [initandlisten] shutdown: going to close sockets...
Sat Sep 25 09:00:17 shutdown: closing all files...
Sat Sep 25 09:00:17 [initandlisten] shutdown: waiting for fs preallocator...
Sat Sep 25 09:00:17 [initandlisten] shutdown: closing all files...
Sat Sep 25 09:00:17 warning closingAllFiles=1

Sat Sep 25 09:00:17 dbexit: really exiting now

C:\src\mongo>

Comment by Eliot Horowitz (Inactive) [ 25/Sep/10 ]

Can you try this on master?

Comment by Justin Dearing [ 04/Sep/10 ]

http://github.com/zippy1981/mongo/commit/e01584f27e6de929777a859db637c41b2782bfa1

That seems to fix this 109 error, but not the errors in the log.

Generated at Thu Feb 08 02:57:00 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.