-
Type: Task
-
Resolution: Won't Do
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Environment:OS: macOS Ventura 13.4.1
node.js / npm versions:
Additional info: Macbook Pro 16-inch, 2021, Apple M1 Pro, 16GB RAM. MongoDB Compass 1.38.2 (but issue has been happening in several past major versions at least as far back as 1.33)
-
3
-
Iteration Fortitudo, Iteration Light Year, Iteration Neptune
-
Not Needed
Problem Statement/Rationale
Experiencing a frequent error when trying to connect to mongos via GCP IAP tunnel:
An error occurred while loading instance info: Connection pool for localhost:27027 was cleared because another operation failed with: "connection <monitor> to 127.0.0.1:27027 closed" * This happens about 9 out of 10 times until it successfully connects.
- Connecting on the command line via mongosh with the same connection string succeeds 100% of the time. Same for Studio 3T and JetBrains Goland (DB plugin).
- Once successfully connected the error does not appear for the duration of the session.
- I've tried changing a bunch of different connection settings to no effect. e.g. direction connection, socket/connect timeouts, wait queue time, heartbeat frequency, etc.
Please be sure to attach relevant logs with any sensitive data redacted.
Compass logs attached.
Steps to Reproduce
- Set up Mongo on a GCP VM such that it's accessible via IAP, mongos is running on port 27018, and LDAP authentication is required.
- Set up the tunnel. I used something like this: gcloud --project my-project compute start-iap-tunnel mongo-vm 27018 --local-host-port=127.0.0.1:27027 --zone=northamerica-northeast1-b
- Use a connection string like the following: mongodb://myusername%40example.com:*****@localhost:27027/?readPreference=primary&ssl=false&authMechanism=PLAIN&authSource=%24external&directConnection=true
- Connect a few times
Expected Results
Successful connection
Actual Results
Most of the time it errors out.
Additional Notes
My workaround right now is to quickly open a bunch of Compass windows and flip through them all, connecting in each one, and then closing any that have errored out. This is annoying enough that most of my team have moved off Compass.
- related to
-
SERVER-61585 Mongosh triggering an okta 2fa on every single command
- Open
-
COMPASS-4527 Multiple mongos connections
- Closed