0

I am connecting from a Spring Boot application to a remote Cosmos DB on Azure (using the Mongo DB API). I use spring-boot-starter-data-mongodb to connect to the DB with all default settings.

After a while I regularly see a SocketException being thrown which is leading to all current DB connections being closed by the mongo driver.

I can only reproduce this issue when connecting to the remote Cosmos DB. I have not been able to reproduce the issue when testing against a local MongoDB container.

Ynnckth
  • 95
  • 9
  • Does this answer your question? [Change default Mongo connection pool size in spring-boot](https://stackoverflow.com/questions/47161050/change-default-mongo-connection-pool-size-in-spring-boot) – Simon Martinelli Jun 04 '20 at 09:49

1 Answers1

0

The issue was solved by limiting the maximum connection idle and life time in the mongo configuration of my Spring Boot application.

It seems that CosmosDB (or another Azure mechanism) was abruptly terminating long-living connections to the database.

Ynnckth
  • 95
  • 9