0

I'm connecting remotely to a MongoDB standalone instance and in my python script am creating/ensuring indexes in the background before doing a bulk_update() operation.

The collection is 90+Million documents and the index creation (if not existing before) takes 20-30 minutes, which is not the issue. I keep track of it on the mongod.log remotely and after each successful build, the script hangs on the local side whereas the server errors with

Error sending response to client: SocketException: Connection timed out. Ending connection from <SERVER IP>

Outside of increasing the connection timeouts to 30-60min, is there any way to ensure I keep the connection to mongo without it stalling my script?

Versions:

Local
Python: 3.6
PyMongo: 3.8.0
OS: Windows Server 2012 R2

Remote
OS: Ubuntu 18.04 LTS
Mongo: 4.0.6-3

  • Do you still get the error if you increase the timeout? – Michael Hampton Jul 22 at 2:54
  • I have tried the various MongoClient options listed here but they don't seem to help as the one I figured as the most relevant socketTimeoutMS defaults to no timeout. Perhaps I'm dealing with native Linux and Windows socket timeouts? – gamesindians Jul 22 at 23:30
  • The default TCP timeouts are measured in hours. Look for a firewall or NAT device that might be interrupting your connection. – Michael Hampton Jul 22 at 23:44
  • Please post TEXT results to pastebin.com (or similar service) from A) SHOW GLOBAL VARIABLES; for your local instance and the REMOTE MONGODB instance for analysis AND B) your python script AND C) last 100 lines of mongod.log. – Wilson Hauck Jul 25 at 0:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.