TransientTransactionError. connection 4 to 127.0.0.1:[RANDOM_PORT] closed

Artem Kostiuk shared this problem 5 years ago
Cannot Reproduce

Hi there,

I've been using nosqlbooster for quite a long time with a lot of machines and basic mongodb installation on aws. Everything has been working just fine always.

My main use case is to connect to a mongodb server via ssh tunnel.

Suddenly I've encountered a problem on a freshly installed ubuntu 18.04 + mongodb v4.0.6: I can't connect to it from nosqlbooster.

The error I'm getting is:

{"errorLabels":["TransientTransactionError"],"message":"connection 4 to 127.0.0.1:50634 closed","name":"MongoNetworkError","stack":"Error: connection 4 to 127.0.0.1:50634 closed\n at Socket.<anonymous> (/Applications/NoSQLBooster for MongoDB.app/Contents/Resources/app.asar/node_modules/qh-mongodb/node_modules/mongodb-core/lib/connection/connection.js:276:9)\n at Object.onceWrapper (events.js:316:30)\n at emitOne (events.js:115:13)\n at Socket.emit (events.js:210:7)\n at TCP._handle.close [as _] (net.js:549:12)"}


Two questions here:

1. Why it tries to connect via random port every time? Has it always been like this? Should I fixed anything in mongod.conf on the sever?

2. Why it suddenly stopped working? I have a couple of machines with exactly same config, the only difference is pretty much an ssh host and they are working just fine.


Thanks in advance for your reply!

Replies (6)

photo
1

Which NoSQLBooster version are you using? Which platform MacOS, windows or ubuntu?


1. Random port?

A: We use random unoccupied ports (_.random(30000, 60000)) to avoid conflicts with local services

2. Why it suddenly stopped working?

A: I have no idea about the issue. There are no retro steps, and it is difficult to guess the specific reasons for this type of problem.

You can try using a separate ssh tunneling. refer to : https://www.ssh.com/ssh/tunneling/example#sec-What-Is-SSH-Port-Forwarding-aka-SSH-Tunneling

photo
1

Hi, we are experiencing the same error. Recently NoSQLBooster stopped to connect to our MongoDB instance running behind a bastion server (AWS EC2).


Those are the connection settings we are using:

Basic:

- Type: Direct Connection

- Server: mongodb://MONGO_DB_IP_ADDRESS:27017

Authentication: - none (we don't need one right now)

SSL: - none

SSH:

- Address: BASTION_SERVER_IP:22

- User Name: USER_NAME

- Auth Mode: Private Key

- Private Key: PATH_TO_ID_RSA

- Passphrase: PW

Default Database:

- We tried with and without one

Other Options:

- none


Now we were able to to connect to the db previously (using older versions of NoSQLBooster), and actually we are still able to connect to it using other clients like TablePlus.


Regarding the random port, If you check the logs, you will find something like: "uri":"mongodb://localhost:39009/"...

Now every time we try to connect it uses a different port.

NoSQLBooster version: 5.1.4 on macOS.


Please have a look:

13:24:45.610  *** Starting "Connect to SSH Server" ***
{"askForPassword":false,"authMode":2,"keyPath":"/USER_PATH/.ssh/id_rsa","passphrase":"XXX","port":22,"server":"BASTION_SERVER_IP","username":"USER_NAME"} 

13:24:45.890  *** Finished "Connect to SSH Server" 280 ms***
{"askForPassword":false,"authMode":2,"keyPath":"/USER_PATH/.ssh/id_rsa","passphrase":"XXX","port":22,"server":"BASTION_SERVER_IP","username":"USER_NAME"} 

13:24:45.891  *** Starting MongoClient.connect ***
{"options":{"appname":"NoSQLBoosterV5_11013.879","autoReconnect":true,"keepAlive":60000,"minSize":0,"poolSize":0,"promoteLongs":false,"promoteValues":false,"reconnectTries":172800,"socketTimeoutMS":0,"sslValidate":false,"useNewUrlParser":false},"uri":"mongodb://localhost:39009/"} 

13:24:46.921  *** Connect Error ***
{"errorLabels":["TransientTransactionError"],"message":"connection 15 to localhost:39009 closed","name":"MongoNetworkError","stack":"MongoNetworkError: connection 15 to localhost:39009 closed\n    at Socket.<anonymous> (/Applications/NoSQLBooster for MongoDB.app/Contents/Resources/app.asar/node_modules/mongodb-core/lib/connection/connection.js:276:9)\n    at Object.onceWrapper (events.js:273:13)\n    at Socket.emit (events.js:182:13)\n    at TCP._handle.close [as _] (net.js:596:12)"} 
Thanks

photo
1

Thank you for your feedback.

I still can't reproduce the problem locally, I tried to update the tunnel module to the latest version, and worked out a new build, can you try it again?

MacOS: https://s3.mongobooster.com/download/releasesv5/nosqlbooster4mongo-5.1.5-beta.4.dmg

And, is there anything special about your ssh key? Ed25519 is not supported.

photo
1

Hi, thanks for your reply.


We've tried the beta but unfortunately not luck. The ssh key is not an Ed25519 one.


The things that sound fishy are still those random generated ports.


I'm copying and pasting some screen-shots about them.


/cbfee66928089a1a09f1f8eaa45cb808

/b55781c75e8cf188814a66706601d079

/7c90ff3d650b3964071d62d1921cff5c

Thanks

photo
1

I have exactly the same problem with 5.1.8. And it's on a macOS 10.14.5

photo
1

Same problem on 5.1.14, it's connecting to some random localhost port through SSH.

"message" : "failed to connect to server [localhost:56031] on first connect [MongoNetworkError: connection 2 to localhost:56031 timed out]",
	"stack" : "MongoNetworkError: failed to connect to server [localhost:56031] on first connect [MongoNetworkError: connection 2 to localhost:56031 timed out]" +

Leave a Comment
 
Attach a file