rofl0r / rofl0r/proxychains-ng

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

Open
#171 32 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
10.7k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

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
$ 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
$ 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 }

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the replica-set setup using proxychains, the shown SOCKS5 configuration, and MongoDB 3.0, 3.2, and 3.4 binaries. Start by comparing the logged connection and heartbeat behavior across versions. Done means identifying the cause of the timeout and demonstrating that the newer MongoDB versions can connect through the proxy successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, mongodb
Domain
databases, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.