Operational Defect Database

BugZero found this defect 2497 days ago.

MongoDB | 377918

[SERVER-28990] when started with --repair mongod should not try to bind to a port

Last update date:


Affected products:

MongoDB Server

Affected releases:

No affected releases provided.

Fixed releases:





Currently, when started with --repair mongod will exit after attempting to repair the data files, but it still tries to bind to a port: mongod --repair --dbpath /data/test 2017-04-26T16:25:53.745-0400 I CONTROL [initandlisten] MongoDB starting : pid=4805 port=27017 dbpath=/data/test 64-bit host=Asyas-MacBook-Pro.local 2017-04-26T16:25:53.746-0400 I CONTROL [initandlisten] db version v3.5.6 2017-04-26T16:25:53.746-0400 I CONTROL [initandlisten] git version: 6408dcd1b5f4fa1747fa2acac50b8cd004343ca7 2017-04-26T16:25:53.746-0400 I CONTROL [initandlisten] OpenSSL version: OpenSSL 0.9.8zh 14 Jan 2016 2017-04-26T16:25:53.746-0400 I CONTROL [initandlisten] allocator: system 2017-04-26T16:25:53.746-0400 I CONTROL [initandlisten] modules: none 2017-04-26T16:25:53.746-0400 I CONTROL [initandlisten] build environment: 2017-04-26T16:25:53.746-0400 I CONTROL [initandlisten] distarch: x86_64 2017-04-26T16:25:53.746-0400 I CONTROL [initandlisten] target_arch: x86_64 2017-04-26T16:25:53.746-0400 I CONTROL [initandlisten] options: { repair: true, storage: { dbPath: "/data/test" } } 2017-04-26T16:25:53.746-0400 E NETWORK [initandlisten] listen(): bind() failed Address already in use for socket: 2017-04-26T16:25:53.746-0400 E NETWORK [initandlisten] addr already in use 2017-04-26T16:25:53.746-0400 E NETWORK [initandlisten] Failed to set up sockets during startup. 2017-04-26T16:25:53.746-0400 E STORAGE [initandlisten] Failed to set up listener: InternalError: Failed to set up sockets 2017-04-26T16:25:53.746-0400 I NETWORK [initandlisten] shutdown: going to close listening sockets... 2017-04-26T16:25:53.747-0400 I NETWORK [initandlisten] shutdown: going to flush diaglog... 2017-04-26T16:25:53.747-0400 I CONTROL [initandlisten] now exiting 2017-04-26T16:25:53.747-0400 I CONTROL [initandlisten] shutting down with code:48 This happens with all storage engines. After --repair mongod will shut down so it doesn't make sense that it should need to listen to a port since it won't accept any connections anyway.

Top User Comments

xgen-internal-githook commented on Mon, 24 Sep 2018 14:51:27 +0000: Author: {'name': 'Annie Black', 'email': 'annie.black@10gen.com', 'username': 'ablack12'} Message: SERVER-28990 avoid bind on --repair (cherry picked from commit 8084a0ce51f6af543385e9292d11b6943d6b7cd4) Branch: v4.0 https://github.com/mongodb/mongo/commit/4d0d55a29f718a26e6966089654d47af3271dd6b xgen-internal-githook commented on Wed, 12 Sep 2018 15:23:35 +0000: Author: {'name': 'Annie Black', 'email': 'annie.black@10gen.com', 'username': 'ablack12'} Message: SERVER-28990 avoid bind on --repair Branch: master https://github.com/mongodb/mongo/commit/8084a0ce51f6af543385e9292d11b6943d6b7cd4

Additional Resources / Links


BugZero Risk Score

Coming soon



Have you been affected by this bug?


Do you know how much operational outages are costing you?

Understand the cost to your business and how BugZero can help you reduce those costs.


Login to read and write comments.

Have you ever...

had your data corrupted from a