You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The default configuration for java mongoDB driver make pooled connections to stay forever alive, and that may lead to SocketException ("Connection timed up") errors when connecting to remote/cloud MongoDB servers. This seems not to be a problem for direct MongoDB connections (DB server in same network).
Remote DB servers (or involved systems/hardware between the application and those servers) may kill the pooled connections after a period of time and the application won't realize until it tries to use the connection. The application will recover from the error as the pool is discarded and new connections will be open, but the operation/call that tried to use the broken connection will fail and get lost in the process.
Using the connection option "maxIdleTimeMS" in the connection uri or the client "options" yaml section will avoid this kind of problems.
URI Example:
mongodb://{{db_mongo_username}}:{{db_mongo_user_password}}@{{db_feedback_host}}:{{db_feedback_port}}/{{db_mongo_database_name}}?maxIdleTimeMS=120000
(120 seconds is recommended in MongoDB documentation for related tcp_keepalive problems so it can be applied to this option also )
The default configuration for java mongoDB driver make pooled connections to stay forever alive, and that may lead to SocketException ("Connection timed up") errors when connecting to remote/cloud MongoDB servers. This seems not to be a problem for direct MongoDB connections (DB server in same network).
Remote DB servers (or involved systems/hardware between the application and those servers) may kill the pooled connections after a period of time and the application won't realize until it tries to use the connection. The application will recover from the error as the pool is discarded and new connections will be open, but the operation/call that tried to use the broken connection will fail and get lost in the process.
Using the connection option "maxIdleTimeMS" in the connection uri or the client "options" yaml section will avoid this kind of problems.
URI Example:
mongodb://{{db_mongo_username}}:{{db_mongo_user_password}}@{{db_feedback_host}}:{{db_feedback_port}}/{{db_mongo_database_name}}?maxIdleTimeMS=120000
(120 seconds is recommended in MongoDB documentation for related tcp_keepalive problems so it can be applied to this option also )
http://docs.mongodb.org/manual/reference/connection-string/#maxIdleTimeMS
The text was updated successfully, but these errors were encountered: