3

I have a ReactiveMongoRepository with a method that returns Flux whenever the method is called it opens a new connection

Opened connection [connectionId{localValue:118, serverValue:44}]

till it exeeds 100 than it throws

com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=54.37.81.35:58789, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: /54.37.81.35:58789}, caused by {java.net.ConnectException: Connection refused}}]
   at com.mongodb.connection.BaseCluster.getDescription(BaseCluster.java:167) ~[mongodb-driver-core-3.6.3.jar:na]

becouse no pool is available anymore. Any idea how to solve or any suggestion ?

Thanks,

cchantep
  • 9,118
  • 3
  • 30
  • 41
Arsen Cenko
  • 95
  • 1
  • 9
  • can you add this code in your code block. `@Bean public MongoClientOptions mongoOptions() { return MongoClientOptions.builder().threadsAllowedToBlockForConnectionMultiplier(2).maxConnectionIdleTime(1).connectionsPerHost(1).minConnectionsPerHost(1).socketTimeout(2000).build(); }` – Erdem Aydemir Jul 27 '18 at 13:54
  • did you solve this? I also have this problem – Fernando Luiz Feb 17 '20 at 17:21
  • I face the same issue. In an integration test, it opens from 8 up to 40 connections. Just for inserting 200 elements and making some grouping. This is not scalable. – sebge2 Aug 23 '20 at 07:26

0 Answers0