work in MongoDB 3.0, but MongoDB 3.2 and 3.4 got connection timed out

Author: ma6174Created Apr 24, 2017Updated Oct 8, 2025

socks5 proxy server running at 127.0.0.1:2345

proxychains config:

random_chain
chain_len = 1
remote_dns_subnet 224
tcp_read_time_out 3000
tcp_connect_time_out 1500
[ProxyList]
socks5 127.0.0.1 2345

When deploy MongoDB Replset

1. start a mongod version 3.0 and listen at port 7017

bash
$ mkdir data1
$ proxychains4 /path/to/mongod_3.0 --dbpath ./data1/ --port 7017 --replSet test

2. start another mongod version 3.0 and listen at port 7018

bash
$ mkdir data2
$ proxychains4 /path/to/mongod_3.0 --dbpath ./data2/ --port 7017 --replSet test

3. connect to mongod on port 7017 and do replset initiate

$ /path/to/mongo_3.0 --port 7017
MongoDB shell version: 3.0.5
connecting to: 127.0.0.1:7017/test
> rs.initiate({_id:"test", members:[{_id:0, host: "127.0.0.1:7017"}]})
{ "ok" : 1 }
test:SECONDARY>
test:PRIMARY> rs.add("127.0.0.1:7018")
{ "ok" : 1 }
test:PRIMARY> rs.status()
{
	"set" : "test",
	"date" : ISODate("2017-04-24T06:47:11.922Z"),
	"myState" : 1,
	"members" : [
		{
			"_id" : 0,
			"name" : "127.0.0.1:7017",
			"health" : 1,
			"state" : 1,
			"stateStr" : "PRIMARY",
			"uptime" : 52,
			"optime" : Timestamp(1493016421, 1),
			"optimeDate" : ISODate("2017-04-24T06:47:01Z"),
			"electionTime" : Timestamp(1493016404, 2),
			"electionDate" : ISODate("2017-04-24T06:46:44Z"),
			"configVersion" : 2,
			"self" : true
		},
		{
			"_id" : 1,
			"name" : "127.0.0.1:7018",
			"health" : 1,
			"state" : 2,
			"stateStr" : "SECONDARY",
			"uptime" : 10,
			"optime" : Timestamp(1493016421, 1),
			"optimeDate" : ISODate("2017-04-24T06:47:01Z"),
			"lastHeartbeat" : ISODate("2017-04-24T06:47:11.719Z"),
			"lastHeartbeatRecv" : ISODate("2017-04-24T06:47:11.731Z"),
			"pingMs" : 0,
			"configVersion" : 2
		}
	],
	"ok" : 1
}
test:PRIMARY>

the replset initiate success, one PRIMARY and one SECONDARY.

but when we switch the MongoDB binary to 3.2 or 3.4, rs.add("127.0.0.1:7018") failed :

> rs.initiate({_id:"test", members:[{_id:0, host: "127.0.0.1:7017"}]})
{ "ok" : 1 }
test:SECONDARY>
test:PRIMARY> rs.add("127.0.0.1:7018")
{
	"ok" : 0,
	"errmsg" : "Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: 127.0.0.1:7017; the following nodes did not respond affirmatively: 127.0.0.1:7018 failed with Couldn't get a connection within the time limit",
	"code" : 74,
	"codeName" : "NodeNotFound"
}
test:PRIMARY>

MongoDB log showed connection timed out(both in linux and osx), proxychains no error

2017-04-24T14:53:13.304+0800 I REPL     [conn1] replSetReconfig admin command received from client
[proxychains] Random chain  ...  127.0.0.1:2345  ...  127.0.0.1:7018  ...  OK
2017-04-24T14:53:13.305+0800 I REPL     [conn1] replSetReconfig config object with 2 members parses ok
2017-04-24T14:53:13.306+0800 I ASIO     [NetworkInterfaceASIO-Replication-0] Connecting to 127.0.0.1:7018
[proxychains] Random chain  ...  127.0.0.1:2345  ...  127.0.0.1:7018  ...  OK
2017-04-24T14:53:23.310+0800 W REPL     [ReplicationExecutor] Failed to complete heartbeat request to 127.0.0.1:7018; ExceededTimeLimit: Couldn't get a connection within the time limit
2017-04-24T14:53:23.310+0800 E REPL     [conn1] replSetReconfig failed; NodeNotFound: Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: 127.0.0.1:7017; the following nodes did not respond affirmatively: 127.0.0.1:7018 failed with Couldn't get a connection within the time limit
2017-04-24T14:53:23.310+0800 I COMMAND  [conn1] command admin.$cmd appName: "MongoDB Shell" command: replSetReconfig { replSetReconfig: { _id: "test", version: 2, protocolVersion: 1, members: [ { _id: 0, host: "127.0.0.1:7017", arbiterOnly: false, buildIndexes: true, hidden: false, priority: 1.0, tags: {}, slaveDelay: 0, votes: 1 }, { _id: 1.0, host: "127.0.0.1:7018" } ], settings: { chainingAllowed: true, heartbeatIntervalMillis: 2000, heartbeatTimeoutSecs: 10, electionTimeoutMillis: 10000, catchUpTimeoutMillis: 2000, getLastErrorModes: {}, getLastErrorDefaults: { w: 1, wtimeout: 0 }, replicaSetId: ObjectId('58fda0d040cafa4d11a4960d') } } } numYields:0 reslen:336 locks:{ Global: { acquireCount: { r: 1, W: 1 } } } protocol:op_command 10006ms
2017-04-24T14:53:33.308+0800 I ASIO     [NetworkInterfaceASIO-Replication-0] Failed to connect to 127.0.0.1:7018 - NetworkInterfaceExceededTimeLimit: Operation timed out, request was RemoteCommand 2 -- target:127.0.0.1:7018 db:admin cmd:{ isMaster: 1 }