[SERVER-28990] when started with --repair mongod should not try to bind to a port Created: 26/Apr/17  Updated: 30/Oct/23  Resolved: 17/Sep/18

Status: Closed
Project: Core Server
Component/s: Networking
Affects Version/s: None
Fix Version/s: 4.0.3, 4.1.3

Type: Bug Priority: Minor - P4
Reporter: Asya Kamsky Assignee: Annie Black
Resolution: Fixed Votes: 0
Labels: dev_tools, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Problem/Incident
causes SERVER-38177 Repair with bind_ip results in a null... Closed
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.0
Sprint: Platforms 2018-08-27, Platforms 2018-09-10, Platforms 2018-09-24
Participants:

 Description   

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: 0.0.0.0:27017
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.



 Comments   
Comment by Githook User [ 24/Sep/18 ]

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

Comment by Githook User [ 12/Sep/18 ]

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

Generated at Thu Feb 08 04:19:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.