Compass 1.29.5 times out connecting to mongodb in container (mongo can connect though)

I have tested access to the host and port using telnet and I can use mongo from the host where I’m running Compass to access the database running on another host in a container, however, Compass fails to connect and times out.

I run the container using:
docker run --name mongodb -v /data/db:/data/db -v /etc/mongo:/etc/mongo -p 27017:27017 -d mongo --config /etc/mongo/mongod.conf

the mongod.conf uses bindIpAll: true

running mongo --host 10.115.255.xx works fine, but trying to access using Compass with:
mongodb://10.115.255.xx:27017 times out. I’ve tried other settings like ssl without validation, and tried turning on/off the SVR Record button.

Since mongo can connect but Compass can’t what is Compass doing that mongo isn’t? Mongo uses a connect string like:
mongodb://10.115.255.xx:27017/?compressors=disabled&gssapiServiceName=mongodb

Trying something similar in compass fails because compressors=disabled is not supported.

@Nathaniel_Mills What error are you getting from Compass? With recent versions of Compass, you can also retrieve a log file (Help → Open Log File → Extract and Save as .txt) that may contain helpful information after a connection failure.

{“t”:{"$date":“2021-12-01T16:13:37.470Z”},“s”:“I”,“c”:“COMPASS-CONNECT-UI”,“id”:1001000004,“ctx”:“Connection UI”,“msg”:“Initiating connection attempt”}
{“t”:{"$date":“2021-12-01T16:13:37.471Z”},“s”:“I”,“c”:“COMPASS-DATA-SERVICE”,“id”:1001000014,“ctx”:“Connection 1”,“msg”:“Connecting”,“attr”:{“url”:“mongodb+srv://10.115.255.xx/waa-xx?readPreference=primary&appname=MongoDB+Compass&directConnection=true&ssl=false”}}
{“t”:{"$date":“2021-12-01T16:13:37.570Z”},“s”:“E”,“c”:“COMPASS-CONNECT”,“id”:1001000011,“ctx”:“Connect”,“msg”:“Resolving SRV record failed”,“attr”:{“from”:“mongodb+srv://10.115.255.xx/waa-txx?readPreference=primary&appname=MongoDB+Compass&directConnection=true&ssl=false”,“error”:“querySrv ENOTFOUND _mongodb._tcp.10.115.255.xx”}}
{“t”:{"$date":“2021-12-01T16:13:51.179Z”},“s”:“I”,“c”:“COMPASS-CONNECT-UI”,“id”:1001000004,“ctx”:“Connection UI”,“msg”:“Initiating connection attempt”}
{“t”:{"$date":“2021-12-01T16:13:51.180Z”},“s”:“I”,“c”:“COMPASS-DATA-SERVICE”,“id”:1001000014,“ctx”:“Connection 2”,“msg”:“Connecting”,“attr”:{“url”:“mongodb://10.115.255.xx:27017/waa-xx?readPreference=primary&appname=MongoDB+Compass&directConnection=true&ssl=false”}}
{“t”:{"$date":“2021-12-01T16:13:51.197Z”},“s”:“I”,“c”:“COMPASS-CONNECT”,“id”:1001000010,“ctx”:“Connect”,“msg”:“Resolved SRV record”,“attr”:{“from”:“mongodb://10.115.255.xx:27017/waa-xx?readPreference=primary&appname=MongoDB+Compass&directConnection=true&ssl=false”,“to”:“mongodb://10.115.255.xx:27017/waa-xx?readPreference=primary&appname=MongoDB+Compass&directConnection=true&ssl=false”}}
{“t”:{"$date":“2021-12-01T16:13:51.197Z”},“s”:“I”,“c”:“COMPASS-CONNECT”,“id”:1001000009,“ctx”:“Connect”,“msg”:“Initiating connection”,“attr”:{“url”:“mongodb://10.115.255.xx:27017/waa-xx?readPreference=primary&appname=MongoDB+Compass&directConnection=true&ssl=false”,“options”:{“monitorCommands”:true}}}
{“t”:{"$date":“2021-12-01T16:13:51.216Z”},“s”:“I”,“c”:“COMPASS-DATA-SERVICE”,“id”:1001000021,“ctx”:“Connection 2”,“msg”:“Topology description changed”,“attr”:{“isWritable”:false,“isMongos”:false,“previousType”:“Unknown”,“newType”:“Single”}}
{“t”:{"$date":“2021-12-01T16:13:51.217Z”},“s”:“I”,“c”:“COMPASS-DATA-SERVICE”,“id”:1001000019,“ctx”:“Connection 2”,“msg”:“Server opening”,“attr”:{“address”:“10.115.255.xx:27017”}}

I modified with xx for obfuscation…

Here is another attempt without SVR…

{“t”:{"$date":“2021-12-01T16:15:09.518Z”},“s”:“I”,“c”:“COMPASS-CONNECT-UI”,“id”:1001000004,“ctx”:“Connection UI”,“msg”:“Initiating connection attempt”}
{“t”:{"$date":“2021-12-01T16:15:09.518Z”},“s”:“I”,“c”:“COMPASS-DATA-SERVICE”,“id”:1001000014,“ctx”:“Connection 3”,“msg”:“Connecting”,“attr”:{“url”:“mongodb://10.115.255.xx:27017/waa-xx?readPreference=primary&appname=MongoDB+Compass&directConnection=true&ssl=false”}}
{“t”:{"$date":“2021-12-01T16:15:09.544Z”},“s”:“I”,“c”:“COMPASS-CONNECT”,“id”:1001000010,“ctx”:“Connect”,“msg”:“Resolved SRV record”,“attr”:{“from”:“mongodb://10.115.255.xx:27017/waa-xx?readPreference=primary&appname=MongoDB+Compass&directConnection=true&ssl=false”,“to”:“mongodb://10.115.255.xx:27017/waa-xx?readPreference=primary&appname=MongoDB+Compass&directConnection=true&ssl=false”}}
{“t”:{"$date":“2021-12-01T16:15:09.544Z”},“s”:“I”,“c”:“COMPASS-CONNECT”,“id”:1001000009,“ctx”:“Connect”,“msg”:“Initiating connection”,“attr”:{“url”:“mongodb://10.115.255.xx:27017/waa-xx?readPreference=primary&appname=MongoDB+Compass&directConnection=true&ssl=false”,“options”:{“monitorCommands”:true}}}
{“t”:{"$date":“2021-12-01T16:15:09.546Z”},“s”:“I”,“c”:“COMPASS-DATA-SERVICE”,“id”:1001000021,“ctx”:“Connection 3”,“msg”:“Topology description changed”,“attr”:{“isWritable”:false,“isMongos”:false,“previousType”:“Unknown”,“newType”:“Single”}}
{“t”:{"$date":“2021-12-01T16:15:09.547Z”},“s”:“I”,“c”:“COMPASS-DATA-SERVICE”,“id”:1001000019,“ctx”:“Connection 3”,“msg”:“Server opening”,“attr”:{“address”:“10.115.255.xx:27017”}}
{“t”:{"$date":“2021-12-01T16:15:39.549Z”},“s”:“W”,“c”:“COMPASS-DATA-SERVICE”,“id”:1001000023,“ctx”:“Connection 3”,“msg”:“Server heartbeat failed”,“attr”:{“connectionId”:“10.115.255.xx:27017”,“duration”:30001,“failure”:“connection establishment was cancelled”}}
{“t”:{"$date":“2021-12-01T16:15:39.549Z”},“s”:“I”,“c”:“COMPASS-DATA-SERVICE”,“id”:1001000020,“ctx”:“Connection 3”,“msg”:“Server closed”,“attr”:{“address”:“10.115.255.xx:27017”}}
{“t”:{"$date":“2021-12-01T16:15:39.549Z”},“s”:“E”,“c”:“COMPASS-CONNECT”,“id”:1001000013,“ctx”:“Connect”,“msg”:“Connection attempt failed”,“attr”:{“error”:“Server selection timed out after 30000 ms”}}
{“t”:{"$date":“2021-12-01T16:19:13.049Z”},“s”:“I”,“c”:“COMPASS-TELEMETRY”,“id”:1001000094,“ctx”:“Telemetry”,“msg”:“Enabling Telemetry reporting”}
{“t”:{"$date":“2021-12-01T16:19:43.082Z”},“s”:“I”,“c”:“COMPASS-MAIN”,“id”:1001000003,“ctx”:“app”,“msg”:“Closing application”}

Sorry, I replied with details in the thread so you can see the log entries there. Thanks for your help. Odd that the mongo client works fine, just not Compass.

Hi

Same for me on Centos / Rocky Linux boxes, since update from 1.28.x to 1.29.x, connections to remote MongoDB instances are often if not always “timed out after 30000ms”

I’ve tried 1.29.0 and 1.29.5 and “remote MongoDB instances” could be WAN and/or LAN.

Local connection on 1.29.5 works fine.
Downgrade to 1.28.4 works fine.

Regards

1 Like