[SERVER-24280] Starting from 3.2.5 if bind_ip is set to 0.0.0.0 it will end up in the replica set config if rs.initiate() is executed with no arguments Created: 25/May/16  Updated: 07/Apr/21  Resolved: 27/May/16

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: 3.2.5
Fix Version/s: 3.3.8

Type: Bug Priority: Major - P3
Reporter: Dmitry Ryabtsev Assignee: Andreas Nilsson
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-3350 Allow 0.0.0.0 as the bind_ip Closed
related to SERVER-22708 Add exposure startup warnings Closed
related to SERVER-23838 Remove startup warnings for no access... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Steps To Reproduce:
  • Start a mongod instance with replSet enabled and bind_ip set to 0.0.0.0
  • In mongo shell execute rs.initiate()
  • Check the rs.config() or rs.status() and check the "name" value - it will be "0.0.0.0:<port>"
Sprint: Security 15 (06/03/16)
Participants:
Case:

 Description   

That must be a regression from SERVER-23838 as pointed by kevin.pulo.

It leads to weird consequnces such as if other replica set members specified with the correct host names, they may consider themselves to be the member with the name that contains "0.0.0.0" and will actually try to heartbeat themselves:

"taken from a remote member"

2016-05-23T15:03:13.588-0700 I REPL     [ReplicationExecutor] New replica set config in use: { _id: "MMS", version: 1, protocolVersion: 1, members: [ { _id: 0, host: "0.0.0.0:28107", arbiterOnly: false, buildIndexes: true, hidden: false, priority: 1.0, tags: {}, slaveDelay: 0, votes: 1 } ], settings: { chainingAllowed: true, heartbeatIntervalMillis: 2000, heartbeatTimeoutSecs: 10, electionTimeoutMillis: 10000, getLastErrorModes: {}, getLastErrorDefaults: { w: 1, wtimeout: 0 }, replicaSetId: ObjectId('57437e1f88f956063b96e00c') } }
2016-05-23T15:03:13.588-0700 I REPL     [ReplicationExecutor] This node is 0.0.0.0:28107 in the config
...
2016-05-23T15:04:29.958-0700 W REPL     [ReplicationExecutor] Got error (BadValue: Received heartbeat from member with the same member ID as ourself: 0) response on heartbeat request to hostnameX:28107; { ok: 1.0, hbmsg: "" }

The workaround is to specify host names or unique IP addresses explicitly:

var cfg = {
      _id: "testRS",
      version: 1,
      members: [
         { _id: 0, host : "host1:27017"},
         { _id: 1, host : "host2:27017"},
         { _id: 2, host : "host3:27017"}
      ]
   };
rs.initiate(cfg);



 Comments   
Comment by Githook User [ 27/May/16 ]

Author:

{u'name': u'Andreas Nilsson', u'email': u'andreas.nilsson@mongodb.com'}

Message: SERVER-24280 Fix bind_ip 0.0.0.0 regression

(cherry picked from commit 1898c4eac3124a6d32de1d2c13d7f6d05b1b538b)
Branch: v3.2
https://github.com/mongodb/mongo/commit/373159b4777068974f75a451b7c7669bc624972f

Comment by Githook User [ 27/May/16 ]

Author:

{u'name': u'Andreas Nilsson', u'email': u'andreas.nilsson@mongodb.com'}

Message: SERVER-24280 Fix bind_ip 0.0.0.0 regression
Branch: master
https://github.com/mongodb/mongo/commit/1898c4eac3124a6d32de1d2c13d7f6d05b1b538b

Comment by Kevin Pulo [ 25/May/16 ]

The behaviour that has regressed is described in SERVER-3350, where an explicit bind_ip of "0.0.0.0" was used by rs.initiate() and so could incorrectly enter the replset config. The code guarding against this (introduced by SERVER-3350, which merely set bind_ip back to an empty string if an explicit "0.0.0.0" was given) was removed by SERVER-22708 (and not replaced by SERVER-23838).

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