TransientTransactionError. connection 4 to[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 closed","name":"MongoNetworkError","stack":"Error: connection 4 to closed\n at Socket.<anonymous> (/Applications/NoSQLBooster for\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 _onclose] (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)


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 :


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:


- Type: Direct Connection

- Server: mongodb://MONGO_DB_IP_ADDRESS:27017

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

SSL: - none



- 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" ***

13:24:45.890  *** Finished "Connect to SSH Server" 280 ms***

13:24:45.891  *** Starting MongoClient.connect ***

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\n    at Object.onceWrapper (events.js:273:13)\n    at Socket.emit (events.js:182:13)\n    at TCP._handle.close [as _onclose] (net.js:596:12)"} 


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?


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


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.






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


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