添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account SpringBoot throws exception when connecting to MongoDB connection pool background maintenance task #38180 SpringBoot throws exception when connecting to MongoDB connection pool background maintenance task #38180 shaxiaozz opened this issue Nov 2, 2023 · 7 comments

This is my environment:
Spring Boot:2.2.9.RELEASE
spring-boot-starter-data-mongodb:2.2.13.RELEASE

Problems I've had:
I am using springboot built-in mongodb driver to connect my mongodb.

My mongodb is deployed in K8s, so for one mongodb instance I can have multiple addresses.

I have found that when I link the mongodb using two addresses (both will point to the same mongodb pod), the application throws a WARN error:
Exception thrown during connection pool background maintenance task
com.mongodb.MongoSocketOpenException: Exception opening socket

I'm absolutely sure that my network is reachable and communicable, so it's not a network or firewall problem!!!!

However, when I link using a single address (10.82.107.128:3600), I don't get this error. So I have to wonder if mongodb has some kind of limitation when initializing the connection pool?

Here are the application startup logs when I connect to two addresses (10.82.107.120:3448, 10.82.107.128:3600), but both point to the same mongodb pod:

Environment variable SW_AGENT_INSTANCE_NAME has an empty value,set it to the pod hostname now
+ test -z ''
+ export HEAPDUMP_DIR=/tmp
+ HEAPDUMP_DIR=/tmp
+ set +x
+ exec java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap '-Dspring.data.mongodb.uri=mongodb://root:[email protected]:3600,10.82.107.120:3448/?connectTimeoutMS=30000&minpoolsize=100&maxpoolsize=200' -jar //consumer-0.0.1-SNAPSHOT.jar
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.9.RELEASE)
2023-11-02 09:43:50.227  INFO 1 --- [           main] c.example.consumer.ConsumerApplication   : Starting ConsumerApplication v0.0.1-SNAPSHOT on mongodb-cj-test-77b98c88c6-m7886 with PID 1 (/consumer-0.0.1-SNAPSHOT.jar started by root in /)
2023-11-02 09:43:50.230  INFO 1 --- [           main] c.example.consumer.ConsumerApplication   : No active profile set, falling back to default profiles: default
2023-11-02 09:43:52.116  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data MongoDB repositories in DEFAULT mode.
2023-11-02 09:43:52.137  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 16ms. Found 0 MongoDB repository interfaces.
2023-11-02 09:43:53.526  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2023-11-02 09:43:53.594  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-11-02 09:43:53.603  INFO 1 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.37]
2023-11-02 09:43:53.733  INFO 1 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-11-02 09:43:53.734  INFO 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 3310 ms
2023-11-02 09:43:55.901  INFO 1 --- [lientSelector_1] RocketmqRemoting                         : closeChannel: close the connection to remote address[] result: true
2023-11-02 09:43:55.901  INFO 1 --- [lientSelector_1] RocketmqRemoting                         : closeChannel: close the connection to remote address[] result: true
2023-11-02 09:43:56.804  INFO 1 --- [           main] org.mongodb.driver.cluster               : Cluster created with settings {hosts=[10.82.107.120:3448, 10.82.107.128:3600], mode=MULTIPLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=1000}
2023-11-02 09:43:56.804  INFO 1 --- [           main] org.mongodb.driver.cluster               : Adding discovered server 10.82.107.120:3448 to client view of cluster
2023-11-02 09:43:56.905  INFO 1 --- [           main] org.mongodb.driver.cluster               : Adding discovered server 10.82.107.128:3600 to client view of cluster
2023-11-02 09:43:57.115  INFO 1 --- [82.107.128:3600] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:4, serverValue:7902}] to 10.82.107.128:3600
2023-11-02 09:43:57.191  INFO 1 --- [82.107.120:3448] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:2, serverValue:7901}] to 10.82.107.120:3448
2023-11-02 09:43:57.192  INFO 1 --- [82.107.128:3600] org.mongodb.driver.cluster               : Monitor thread successfully connected to server with description ServerDescription{address=10.82.107.128:3600, type=SHARD_ROUTER, state=CONNECTED, ok=true, version=ServerVersion{versionList=[4, 4, 8]}, minWireVersion=0, maxWireVersion=9, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=74274003}
2023-11-02 09:43:57.193  INFO 1 --- [82.107.128:3600] org.mongodb.driver.cluster               : Discovered cluster type of SHARDED
2023-11-02 09:43:57.198  INFO 1 --- [82.107.120:3448] org.mongodb.driver.cluster               : Monitor thread successfully connected to server with description ServerDescription{address=10.82.107.120:3448, type=SHARD_ROUTER, state=CONNECTED, ok=true, version=ServerVersion{versionList=[4, 4, 8]}, minWireVersion=0, maxWireVersion=9, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=6951785}
2023-11-02 09:43:59.397  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:3, serverValue:7903}] to 10.82.107.128:3600
2023-11-02 09:43:59.410  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:1, serverValue:7904}] to 10.82.107.120:3448
2023-11-02 09:43:59.416  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:5, serverValue:7905}] to 10.82.107.128:3600
2023-11-02 09:43:59.496  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:6, serverValue:7906}] to 10.82.107.120:3448
2023-11-02 09:43:59.499  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:7, serverValue:7907}] to 10.82.107.128:3600
2023-11-02 09:43:59.504  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:8, serverValue:7908}] to 10.82.107.120:3448
2023-11-02 09:43:59.509  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:9, serverValue:7909}] to 10.82.107.128:3600
2023-11-02 09:43:59.510  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:10, serverValue:7910}] to 10.82.107.120:3448
2023-11-02 09:43:59.601  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:12, serverValue:7912}] to 10.82.107.120:3448
2023-11-02 09:43:59.601  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:11, serverValue:7911}] to 10.82.107.128:3600
2023-11-02 09:43:59.608  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:13, serverValue:7913}] to 10.82.107.120:3448
2023-11-02 09:43:59.609  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:14, serverValue:7914}] to 10.82.107.128:3600
2023-11-02 09:43:59.614  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:15, serverValue:7915}] to 10.82.107.120:3448
2023-11-02 09:43:59.617  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:16, serverValue:7916}] to 10.82.107.128:3600
2023-11-02 09:43:59.694  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:17, serverValue:7917}] to 10.82.107.120:3448
2023-11-02 09:43:59.695  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:18, serverValue:7918}] to 10.82.107.128:3600
2023-11-02 09:43:59.702  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:19, serverValue:7919}] to 10.82.107.120:3448
2023-11-02 09:43:59.702  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:20, serverValue:7920}] to 10.82.107.128:3600
2023-11-02 09:43:59.708  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:21, serverValue:7921}] to 10.82.107.120:3448
2023-11-02 09:43:59.709  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:22, serverValue:7922}] to 10.82.107.128:3600
2023-11-02 09:43:59.720  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:23, serverValue:7923}] to 10.82.107.120:3448
2023-11-02 09:43:59.721  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:24, serverValue:7924}] to 10.82.107.128:3600
2023-11-02 09:43:59.791  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:26, serverValue:7926}] to 10.82.107.128:3600
2023-11-02 09:43:59.792  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:25, serverValue:7925}] to 10.82.107.120:3448
2023-11-02 09:43:59.797  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:27, serverValue:7927}] to 10.82.107.128:3600
2023-11-02 09:43:59.798  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:28, serverValue:7928}] to 10.82.107.120:3448
2023-11-02 09:43:59.803  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:29, serverValue:7929}] to 10.82.107.128:3600
2023-11-02 09:43:59.805  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:30, serverValue:7930}] to 10.82.107.120:3448
2023-11-02 09:43:59.810  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:31, serverValue:7931}] to 10.82.107.128:3600
2023-11-02 09:43:59.811  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:32, serverValue:7932}] to 10.82.107.120:3448
2023-11-02 09:43:59.891  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:34, serverValue:7934}] to 10.82.107.120:3448
2023-11-02 09:43:59.893  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:33, serverValue:7933}] to 10.82.107.128:3600
2023-11-02 09:43:59.899  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:35, serverValue:7935}] to 10.82.107.120:3448
2023-11-02 09:43:59.901  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:36, serverValue:7936}] to 10.82.107.128:3600
2023-11-02 09:43:59.915  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:37, serverValue:7937}] to 10.82.107.120:3448
2023-11-02 09:43:59.917  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:38, serverValue:7938}] to 10.82.107.128:3600
2023-11-02 09:43:59.990  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:39, serverValue:7939}] to 10.82.107.120:3448
2023-11-02 09:43:59.997  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:40, serverValue:7940}] to 10.82.107.128:3600
2023-11-02 09:43:59.998  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:41, serverValue:7941}] to 10.82.107.120:3448
2023-11-02 09:44:00.004  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:42, serverValue:7942}] to 10.82.107.128:3600
2023-11-02 09:44:00.005  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:43, serverValue:7943}] to 10.82.107.120:3448
2023-11-02 09:44:00.011  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:44, serverValue:7944}] to 10.82.107.128:3600
2023-11-02 09:44:00.017  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:46, serverValue:7945}] to 10.82.107.128:3600
2023-11-02 09:44:00.095  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:47, serverValue:7946}] to 10.82.107.128:3600
2023-11-02 09:44:00.102  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:48, serverValue:7947}] to 10.82.107.128:3600
2023-11-02 09:44:00.108  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:49, serverValue:7948}] to 10.82.107.128:3600
2023-11-02 09:44:00.118  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:50, serverValue:7949}] to 10.82.107.128:3600
2023-11-02 09:44:00.192  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:51, serverValue:7950}] to 10.82.107.128:3600
2023-11-02 09:44:00.307  INFO 1 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2023-11-02 09:44:01.201  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2023-11-02 09:44:01.204  INFO 1 --- [           main] c.example.consumer.ConsumerApplication   : Started ConsumerApplication in 12.103 seconds (JVM running for 14.533)
2023-11-02 09:44:15.045  WARN 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Exception thrown during connection pool background maintenance task
com.mongodb.MongoSocketOpenException: Exception opening socket
	at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:128) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.UsageTrackingInternalConnection.open(UsageTrackingInternalConnection.java:50) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.DefaultConnectionPool$UsageTrackingInternalConnectionItemFactory.create(DefaultConnectionPool.java:530) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.DefaultConnectionPool$UsageTrackingInternalConnectionItemFactory.create(DefaultConnectionPool.java:518) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.ConcurrentPool.createNewAndReleasePermitIfFailure(ConcurrentPool.java:181) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.ConcurrentPool.ensureMinSize(ConcurrentPool.java:175) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.DefaultConnectionPool$3.run(DefaultConnectionPool.java:317) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_333]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_333]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_333]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_333]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_333]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_333]
	at java.lang.Thread.run(Thread.java:750) [na:1.8.0_333]
Caused by: java.net.ConnectException: Connection timed out (Connection timed out)
	at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_333]
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:476) ~[na:1.8.0_333]
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:218) ~[na:1.8.0_333]
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:200) ~[na:1.8.0_333]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:394) ~[na:1.8.0_333]
	at java.net.Socket.connect(Socket.java:606) ~[na:1.8.0_333]
	at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:64) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:79) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:65) ~[mongodb-driver-core-3.11.2.jar!/:na]
	... 14 common frames omitted
2023-11-02 09:44:15.226  WARN 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Exception thrown during connection pool background maintenance task
com.mongodb.MongoSocketOpenException: Exception opening socket
	at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:128) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.UsageTrackingInternalConnection.open(UsageTrackingInternalConnection.java:50) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.DefaultConnectionPool$UsageTrackingInternalConnectionItemFactory.create(DefaultConnectionPool.java:530) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.DefaultConnectionPool$UsageTrackingInternalConnectionItemFactory.create(DefaultConnectionPool.java:518) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.ConcurrentPool.createNewAndReleasePermitIfFailure(ConcurrentPool.java:181) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.ConcurrentPool.ensureMinSize(ConcurrentPool.java:175) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.DefaultConnectionPool$3.run(DefaultConnectionPool.java:317) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_333]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_333]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_333]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_333]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_333]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_333]
	at java.lang.Thread.run(Thread.java:750) [na:1.8.0_333]
Caused by: java.net.ConnectException: Connection timed out (Connection timed out)
	at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_333]
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:476) ~[na:1.8.0_333]
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:218) ~[na:1.8.0_333]
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:200) ~[na:1.8.0_333]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:394) ~[na:1.8.0_333]
	at java.net.Socket.connect(Socket.java:606) ~[na:1.8.0_333]
	at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:64) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:79) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:65) ~[mongodb-driver-core-3.11.2.jar!/:na]
	... 14 common frames omitted
2023-11-02 09:44:25.139  INFO 1 --- [lientSelector_1] RocketmqRemoting                         : closeChannel: close the connection to remote address[] result: true
2023-11-02 09:44:25.217  INFO 1 --- [lientSelector_1] RocketmqRemoting                         : closeChannel: close the connection to remote address[] result: true
2023-11-02 09:44:55.135  INFO 1 --- [lientSelector_1] RocketmqRemoting                         : closeChannel: close the connection to remote address[] result: true
2023-11-02 09:44:55.216  INFO 1 --- [lientSelector_1] RocketmqRemoting                         : closeChannel: close the connection to remote address[] result: true
2023-11-02 09:44:56.835  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:53, serverValue:7956}] to 10.82.107.120:3448
2023-11-02 09:44:56.842  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:54, serverValue:7957}] to 10.82.107.120:3448
2023-11-02 09:44:56.847  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:55, serverValue:7958}] to 10.82.107.120:3448
2023-11-02 09:44:56.853  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:56, serverValue:7959}] to 10.82.107.120:3448
2023-11-02 09:44:56.859  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:57, serverValue:7960}] to 10.82.107.120:3448
2023-11-02 09:44:56.866  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:58, serverValue:7961}] to 10.82.107.120:3448
2023-11-02 09:44:56.871  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:59, serverValue:7962}] to 10.82.107.120:3448
2023-11-02 09:44:56.878  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:60, serverValue:7963}] to 10.82.107.120:3448
2023-11-02 09:44:56.884  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:61, serverValue:7964}] to 10.82.107.120:3448
2023-11-02 09:44:56.890  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:62, serverValue:7965}] to 10.82.107.120:3448
2023-11-02 09:44:56.897  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:63, serverValue:7966}] to 10.82.107.120:3448
2023-11-02 09:44:56.904  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:64, serverValue:7967}] to 10.82.107.120:3448
2023-11-02 09:44:56.909  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:65, serverValue:7968}] to 10.82.107.120:3448
2023-11-02 09:44:56.913  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:66, serverValue:7969}] to 10.82.107.128:3600
2023-11-02 09:44:56.916  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:67, serverValue:7970}] to 10.82.107.120:3448
2023-11-02 09:44:56.919  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:68, serverValue:7971}] to 10.82.107.128:3600
2023-11-02 09:44:56.921  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:69, serverValue:7972}] to 10.82.107.120:3448
2023-11-02 09:44:56.925  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:70, serverValue:7973}] to 10.82.107.128:3600
2023-11-02 09:44:56.928  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:71, serverValue:7974}] to 10.82.107.120:3448
2023-11-02 09:44:56.931  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:72, serverValue:7975}] to 10.82.107.128:3600
2023-11-02 09:44:56.933  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:73, serverValue:7976}] to 10.82.107.120:3448
2023-11-02 09:44:56.938  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:74, serverValue:7977}] to 10.82.107.128:3600
2023-11-02 09:44:56.938  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:75, serverValue:7978}] to 10.82.107.120:3448
2023-11-02 09:44:57.010  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:77, serverValue:7980}] to 10.82.107.120:3448
2023-11-02 09:44:57.013  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:76, serverValue:7979}] to 10.82.107.128:3600
2023-11-02 09:44:57.017  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:78, serverValue:7981}] to 10.82.107.120:3448
2023-11-02 09:44:57.018  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:79, serverValue:7982}] to 10.82.107.128:3600
2023-11-02 09:44:57.022  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:80, serverValue:7983}] to 10.82.107.120:3448
2023-11-02 09:44:57.023  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:81, serverValue:7984}] to 10.82.107.128:3600
2023-11-02 09:44:57.027  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:82, serverValue:7985}] to 10.82.107.120:3448
2023-11-02 09:44:57.028  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:83, serverValue:7986}] to 10.82.107.128:3600
2023-11-02 09:44:57.031  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:84, serverValue:7987}] to 10.82.107.120:3448
2023-11-02 09:44:57.033  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:85, serverValue:7988}] to 10.82.107.128:3600
2023-11-02 09:44:57.036  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:86, serverValue:7989}] to 10.82.107.120:3448
2023-11-02 09:44:57.038  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:87, serverValue:7990}] to 10.82.107.128:3600
2023-11-02 09:44:57.041  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:88, serverValue:7991}] to 10.82.107.120:3448
2023-11-02 09:44:57.043  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:89, serverValue:7992}] to 10.82.107.128:3600
2023-11-02 09:44:57.047  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:90, serverValue:7993}] to 10.82.107.120:3448
2023-11-02 09:44:57.048  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:91, serverValue:7994}] to 10.82.107.128:3600
2023-11-02 09:44:57.053  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:92, serverValue:7995}] to 10.82.107.120:3448
2023-11-02 09:44:57.053  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:93, serverValue:7996}] to 10.82.107.128:3600
2023-11-02 09:44:57.058  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:94, serverValue:7997}] to 10.82.107.120:3448
2023-11-02 09:44:57.094  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:96, serverValue:7999}] to 10.82.107.120:3448
2023-11-02 09:44:57.104  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:95, serverValue:7998}] to 10.82.107.128:3600
2023-11-02 09:44:57.108  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:97, serverValue:8000}] to 10.82.107.120:3448
2023-11-02 09:44:57.111  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:98, serverValue:8001}] to 10.82.107.128:3600
2023-11-02 09:44:57.114  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:99, serverValue:8002}] to 10.82.107.120:3448
2023-11-02 09:44:57.116  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:100, serverValue:8003}] to 10.82.107.128:3600
2023-11-02 09:44:57.118  INFO 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:101, serverValue:8004}] to 10.82.107.120:3448
2023-11-02 09:44:57.121  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:102, serverValue:8005}] to 10.82.107.128:3600
2023-11-02 09:44:57.125  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:104, serverValue:8006}] to 10.82.107.128:3600
2023-11-02 09:44:57.130  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:105, serverValue:8007}] to 10.82.107.128:3600
2023-11-02 09:44:57.135  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:106, serverValue:8008}] to 10.82.107.128:3600
2023-11-02 09:44:57.140  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:107, serverValue:8009}] to 10.82.107.128:3600
2023-11-02 09:44:57.145  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:108, serverValue:8010}] to 10.82.107.128:3600
2023-11-02 09:44:57.150  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:109, serverValue:8011}] to 10.82.107.128:3600
2023-11-02 09:44:57.155  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:110, serverValue:8012}] to 10.82.107.128:3600
2023-11-02 09:44:57.160  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:111, serverValue:8013}] to 10.82.107.128:3600
2023-11-02 09:44:57.167  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:112, serverValue:8014}] to 10.82.107.128:3600
2023-11-02 09:44:57.191  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:113, serverValue:8015}] to 10.82.107.128:3600
2023-11-02 09:44:57.210  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:114, serverValue:8016}] to 10.82.107.128:3600
2023-11-02 09:44:57.215  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:115, serverValue:8017}] to 10.82.107.128:3600
2023-11-02 09:44:57.220  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:116, serverValue:8018}] to 10.82.107.128:3600
2023-11-02 09:44:57.224  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:117, serverValue:8019}] to 10.82.107.128:3600
2023-11-02 09:44:57.229  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:118, serverValue:8020}] to 10.82.107.128:3600
2023-11-02 09:44:57.238  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:119, serverValue:8021}] to 10.82.107.128:3600
2023-11-02 09:44:57.242  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:120, serverValue:8022}] to 10.82.107.128:3600
2023-11-02 09:44:57.247  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:121, serverValue:8023}] to 10.82.107.128:3600
2023-11-02 09:44:57.252  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:122, serverValue:8024}] to 10.82.107.128:3600
2023-11-02 09:44:57.258  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:123, serverValue:8025}] to 10.82.107.128:3600
2023-11-02 09:44:57.263  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:124, serverValue:8026}] to 10.82.107.128:3600
2023-11-02 09:44:57.269  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:125, serverValue:8027}] to 10.82.107.128:3600
2023-11-02 09:44:57.274  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:126, serverValue:8028}] to 10.82.107.128:3600
2023-11-02 09:44:57.280  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:127, serverValue:8029}] to 10.82.107.128:3600
2023-11-02 09:44:57.308  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:128, serverValue:8030}] to 10.82.107.128:3600
2023-11-02 09:44:57.314  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:129, serverValue:8031}] to 10.82.107.128:3600
2023-11-02 09:44:57.319  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:130, serverValue:8032}] to 10.82.107.128:3600
2023-11-02 09:44:57.323  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:131, serverValue:8033}] to 10.82.107.128:3600
2023-11-02 09:44:57.328  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:132, serverValue:8034}] to 10.82.107.128:3600
2023-11-02 09:44:57.333  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:133, serverValue:8035}] to 10.82.107.128:3600
2023-11-02 09:44:57.338  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:134, serverValue:8036}] to 10.82.107.128:3600
2023-11-02 09:44:57.343  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:135, serverValue:8037}] to 10.82.107.128:3600
2023-11-02 09:44:57.348  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:136, serverValue:8038}] to 10.82.107.128:3600
2023-11-02 09:44:57.353  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:137, serverValue:8039}] to 10.82.107.128:3600
2023-11-02 09:44:57.359  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:138, serverValue:8040}] to 10.82.107.128:3600
2023-11-02 09:44:57.364  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:139, serverValue:8041}] to 10.82.107.128:3600
2023-11-02 09:44:57.369  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:140, serverValue:8042}] to 10.82.107.128:3600
2023-11-02 09:44:57.374  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:141, serverValue:8043}] to 10.82.107.128:3600
2023-11-02 09:44:57.380  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:142, serverValue:8044}] to 10.82.107.128:3600
2023-11-02 09:44:57.385  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:143, serverValue:8045}] to 10.82.107.128:3600
2023-11-02 09:44:57.401  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:144, serverValue:8046}] to 10.82.107.128:3600
2023-11-02 09:44:57.409  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:145, serverValue:8047}] to 10.82.107.128:3600
2023-11-02 09:44:57.414  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:146, serverValue:8048}] to 10.82.107.128:3600
2023-11-02 09:44:57.419  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:147, serverValue:8049}] to 10.82.107.128:3600
2023-11-02 09:44:57.423  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:148, serverValue:8050}] to 10.82.107.128:3600
2023-11-02 09:44:57.427  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:149, serverValue:8051}] to 10.82.107.128:3600
2023-11-02 09:45:12.154  WARN 1 --- [imer-1-thread-1] org.mongodb.driver.connection            : Exception thrown during connection pool background maintenance task
com.mongodb.MongoSocketOpenException: Exception opening socket
	at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:128) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.UsageTrackingInternalConnection.open(UsageTrackingInternalConnection.java:50) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.DefaultConnectionPool$UsageTrackingInternalConnectionItemFactory.create(DefaultConnectionPool.java:530) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.DefaultConnectionPool$UsageTrackingInternalConnectionItemFactory.create(DefaultConnectionPool.java:518) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.ConcurrentPool.createNewAndReleasePermitIfFailure(ConcurrentPool.java:181) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.ConcurrentPool.ensureMinSize(ConcurrentPool.java:175) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.DefaultConnectionPool$3.run(DefaultConnectionPool.java:317) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_333]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_333]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_333]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_333]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_333]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_333]
	at java.lang.Thread.run(Thread.java:750) [na:1.8.0_333]
Caused by: java.net.ConnectException: Connection timed out (Connection timed out)
	at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_333]
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:476) ~[na:1.8.0_333]
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:218) ~[na:1.8.0_333]
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:200) ~[na:1.8.0_333]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:394) ~[na:1.8.0_333]
	at java.net.Socket.connect(Socket.java:606) ~[na:1.8.0_333]
	at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:64) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:79) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:65) ~[mongodb-driver-core-3.11.2.jar!/:na]
	... 14 common frames omitted
2023-11-02 09:45:12.458  WARN 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Exception thrown during connection pool background maintenance task
com.mongodb.MongoSocketOpenException: Exception opening socket
	at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:128) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.UsageTrackingInternalConnection.open(UsageTrackingInternalConnection.java:50) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.DefaultConnectionPool$UsageTrackingInternalConnectionItemFactory.create(DefaultConnectionPool.java:530) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.DefaultConnectionPool$UsageTrackingInternalConnectionItemFactory.create(DefaultConnectionPool.java:518) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.ConcurrentPool.createNewAndReleasePermitIfFailure(ConcurrentPool.java:181) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.ConcurrentPool.ensureMinSize(ConcurrentPool.java:175) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.DefaultConnectionPool$3.run(DefaultConnectionPool.java:317) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_333]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [na:1.8.0_333]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_333]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [na:1.8.0_333]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_333]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_333]
	at java.lang.Thread.run(Thread.java:750) [na:1.8.0_333]
Caused by: java.net.ConnectException: Connection timed out (Connection timed out)
	at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_333]
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:476) ~[na:1.8.0_333]
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:218) ~[na:1.8.0_333]
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:200) ~[na:1.8.0_333]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:394) ~[na:1.8.0_333]
	at java.net.Socket.connect(Socket.java:606) ~[na:1.8.0_333]
	at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:64) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:79) ~[mongodb-driver-core-3.11.2.jar!/:na]
	at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:65) ~[mongodb-driver-core-3.11.2.jar!/:na]
	... 14 common frames omitted
2023-11-02 09:45:25.135  INFO 1 --- [lientSelector_1] RocketmqRemoting                         : closeChannel: close the connection to remote address[] result: true
2023-11-02 09:45:25.214  INFO 1 --- [lientSelector_1] RocketmqRemoting                         : closeChannel: close the connection to remote address[] result: true
2023-11-02 09:45:55.135  INFO 1 --- [lientSelector_1] RocketmqRemoting                         : closeChannel: close the connection to remote address[] result: true
2023-11-02 09:45:55.217  INFO 1 --- [lientSelector_1] RocketmqRemoting                         : closeChannel: close the connection to remote address[] result: true
      changed the title
SpringBott throws exception when connecting to MongoDB connection pool background maintenance task
SpringBoot throws exception when connecting to MongoDB connection pool background maintenance task
    Nov 2, 2023
          

Spring Boot 2.2 has been out of OSS support for 3 years. If you see this with a supported version of Spring Boot (2.7 or later) please let us know and we can re-open the issue and take another look. You may also want to try debugging your application and checking that the correct connection details are being used in com.mongodb.internal.connection.SocketStream.open.

@wilkinsona I am using springboot v2.7.0 with this issue as well, here is the runtime logs,Thank you.

Environment variable SW_AGENT_INSTANCE_NAME has an empty value,set it to the pod hostname now
+ test -z ''
+ export HEAPDUMP_DIR=/tmp
+ HEAPDUMP_DIR=/tmp
+ set +x
+ exec java -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap '-Dspring.data.mongodb.uri=mongodb://root:[email protected]:3600,10.82.107.120:3448/?connectTimeoutMS=30000&minpoolsize=100&maxpoolsize=200' -jar //consumer-0.0.1-2.7-SNAPSHOT.jar
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.7.0)
2023-11-02 16:17:36.802  INFO 1 --- [           main] c.example.consumer.ConsumerApplication   : Starting ConsumerApplication v0.0.1-SNAPSHOT using Java 1.8.0_333 on mongodb-cj-test-ff948c4f5-cs5zd with PID 1 (/consumer-0.0.1-2.7-SNAPSHOT.jar started by root in /)
2023-11-02 16:17:36.804  INFO 1 --- [           main] c.example.consumer.ConsumerApplication   : No active profile set, falling back to 1 default profile: "default"
2023-11-02 16:17:38.126  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data MongoDB repositories in DEFAULT mode.
2023-11-02 16:17:38.136  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 5 ms. Found 0 MongoDB repository interfaces.
2023-11-02 16:17:39.119  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2023-11-02 16:17:39.129  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-11-02 16:17:39.129  INFO 1 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.63]
2023-11-02 16:17:39.323  INFO 1 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-11-02 16:17:39.323  INFO 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2419 ms
RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.InternalThreadLocalMap).
RocketMQLog:WARN Please initialize the logger system properly.
2023-11-02 16:17:40.700  INFO 1 --- [lientSelector_1] RocketmqRemoting                         : closeChannel: close the connection to remote address[] result: true
2023-11-02 16:17:40.702  INFO 1 --- [           main] org.mongodb.driver.cluster               : Adding discovered server 10.82.107.120:3448 to client view of cluster
2023-11-02 16:17:40.799  INFO 1 --- [           main] org.mongodb.driver.cluster               : Adding discovered server 10.82.107.128:3600 to client view of cluster
2023-11-02 16:17:40.897  INFO 1 --- [           main] org.mongodb.driver.client                : MongoClient with metadata {"driver": {"name": "mongo-java-driver|sync|spring-boot", "version": "4.6.0"}, "os": {"type": "Linux", "name": "Linux", "architecture": "amd64", "version": "3.10.0-1160.el7.x86_64"}, "platform": "Java/Oracle Corporation/1.8.0_333-b02"} created with settings MongoClientSettings{readPreference=primary, writeConcern=WriteConcern{w=null, wTimeout=null ms, journal=null}, retryWrites=true, retryReads=true, readConcern=ReadConcern{level=null}, credential=MongoCredential{mechanism=null, userName='root', source='admin', password=<hidden>, mechanismProperties=<hidden>}, streamFactoryFactory=null, commandListeners=[], codecRegistry=ProvidersCodecRegistry{codecProviders=[ValueCodecProvider{}, BsonValueCodecProvider{}, DBRefCodecProvider{}, DBObjectCodecProvider{}, DocumentCodecProvider{}, IterableCodecProvider{}, MapCodecProvider{}, GeoJsonCodecProvider{}, GridFSFileCodecProvider{}, Jsr310CodecProvider{}, JsonObjectCodecProvider{}, BsonCodecProvider{}, EnumCodecProvider{}, com.mongodb.Jep395RecordCodecProvider@78691363]}, clusterSettings={hosts=[10.82.107.120:3448, 10.82.107.128:3600], srvServiceName=mongodb, mode=MULTIPLE, requiredClusterType=UNKNOWN, requiredReplicaSetName='null', serverSelector='null', clusterListeners='[]', serverSelectionTimeout='30000 ms', localThreshold='30000 ms'}, socketSettings=SocketSettings{connectTimeoutMS=30000, readTimeoutMS=0, receiveBufferSize=0, sendBufferSize=0}, heartbeatSocketSettings=SocketSettings{connectTimeoutMS=30000, readTimeoutMS=30000, receiveBufferSize=0, sendBufferSize=0}, connectionPoolSettings=ConnectionPoolSettings{maxSize=200, minSize=100, maxWaitTimeMS=120000, maxConnectionLifeTimeMS=0, maxConnectionIdleTimeMS=0, maintenanceInitialDelayMS=0, maintenanceFrequencyMS=60000, connectionPoolListeners=[], maxConnecting=2}, serverSettings=ServerSettings{heartbeatFrequencyMS=10000, minHeartbeatFrequencyMS=500, serverListeners='[]', serverMonitorListeners='[]'}, sslSettings=SslSettings{enabled=false, invalidHostNameAllowed=false, context=null}, applicationName='null', compressorList=[], uuidRepresentation=JAVA_LEGACY, serverApi=null, autoEncryptionSettings=null, contextProvider=null}
2023-11-02 16:17:40.908  INFO 1 --- [82.107.120:3448] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:4, serverValue:10157}] to 10.82.107.120:3448
2023-11-02 16:17:40.908  INFO 1 --- [82.107.128:3600] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:2, serverValue:10156}] to 10.82.107.128:3600
2023-11-02 16:17:40.908  INFO 1 --- [82.107.120:3448] org.mongodb.driver.cluster               : Monitor thread successfully connected to server with description ServerDescription{address=10.82.107.120:3448, type=SHARD_ROUTER, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=9, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=96940558}
2023-11-02 16:17:40.911  INFO 1 --- [82.107.120:3448] org.mongodb.driver.cluster               : Discovered cluster type of SHARDED
2023-11-02 16:17:41.417  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:5, serverValue:10158}] to 10.82.107.120:3448
2023-11-02 16:17:41.621  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:6, serverValue:10159}] to 10.82.107.120:3448
2023-11-02 16:17:41.804  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:7, serverValue:10160}] to 10.82.107.120:3448
2023-11-02 16:17:41.826  INFO 1 --- [82.107.128:3600] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:3, serverValue:10161}] to 10.82.107.128:3600
2023-11-02 16:17:41.827  INFO 1 --- [82.107.128:3600] org.mongodb.driver.cluster               : Monitor thread successfully connected to server with description ServerDescription{address=10.82.107.128:3600, type=SHARD_ROUTER, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=9, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=1441596}
2023-11-02 16:17:41.925  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:9, serverValue:10162}] to 10.82.107.128:3600
2023-11-02 16:17:42.030  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:10, serverValue:10163}] to 10.82.107.128:3600
2023-11-02 16:17:42.201  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:11, serverValue:10164}] to 10.82.107.128:3600
2023-11-02 16:17:42.302  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:12, serverValue:10165}] to 10.82.107.128:3600
2023-11-02 16:17:42.401  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:13, serverValue:10166}] to 10.82.107.128:3600
2023-11-02 16:17:42.437  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:14, serverValue:10167}] to 10.82.107.128:3600
2023-11-02 16:17:42.527  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:15, serverValue:10168}] to 10.82.107.128:3600
2023-11-02 16:17:42.627  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:16, serverValue:10169}] to 10.82.107.128:3600
2023-11-02 16:17:42.798  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:17, serverValue:10170}] to 10.82.107.128:3600
2023-11-02 16:17:42.833  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:18, serverValue:10171}] to 10.82.107.128:3600
2023-11-02 16:17:42.923  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:19, serverValue:10172}] to 10.82.107.128:3600
2023-11-02 16:17:43.025  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:20, serverValue:10173}] to 10.82.107.128:3600
2023-11-02 16:17:43.126  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:21, serverValue:10174}] to 10.82.107.128:3600
2023-11-02 16:17:43.299  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:22, serverValue:10175}] to 10.82.107.128:3600
2023-11-02 16:17:43.405  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:23, serverValue:10176}] to 10.82.107.128:3600
2023-11-02 16:17:43.508  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:24, serverValue:10177}] to 10.82.107.128:3600
2023-11-02 16:17:43.608  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:25, serverValue:10178}] to 10.82.107.128:3600
2023-11-02 16:17:43.713  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:26, serverValue:10179}] to 10.82.107.128:3600
2023-11-02 16:17:43.826  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2023-11-02 16:17:43.827  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:27, serverValue:10180}] to 10.82.107.128:3600
2023-11-02 16:17:43.902  INFO 1 --- [           main] c.example.consumer.ConsumerApplication   : Started ConsumerApplication in 7.892 seconds (JVM running for 8.583)
2023-11-02 16:17:43.924  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:28, serverValue:10181}] to 10.82.107.128:3600
2023-11-02 16:17:44.009  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:29, serverValue:10182}] to 10.82.107.128:3600
2023-11-02 16:17:44.039  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:30, serverValue:10183}] to 10.82.107.128:3600
2023-11-02 16:17:44.117  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:31, serverValue:10184}] to 10.82.107.128:3600
2023-11-02 16:17:44.146  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:32, serverValue:10185}] to 10.82.107.128:3600
2023-11-02 16:17:44.224  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:33, serverValue:10186}] to 10.82.107.128:3600
2023-11-02 16:17:44.253  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:34, serverValue:10187}] to 10.82.107.128:3600
2023-11-02 16:17:44.283  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:35, serverValue:10188}] to 10.82.107.128:3600
2023-11-02 16:17:44.322  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:36, serverValue:10189}] to 10.82.107.128:3600
2023-11-02 16:17:44.356  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:37, serverValue:10190}] to 10.82.107.128:3600
2023-11-02 16:17:44.385  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:38, serverValue:10191}] to 10.82.107.128:3600
2023-11-02 16:17:44.423  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:39, serverValue:10192}] to 10.82.107.128:3600
2023-11-02 16:17:44.452  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:40, serverValue:10193}] to 10.82.107.128:3600
2023-11-02 16:17:44.481  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:41, serverValue:10194}] to 10.82.107.128:3600
2023-11-02 16:17:44.513  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:42, serverValue:10195}] to 10.82.107.128:3600
2023-11-02 16:17:44.542  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:43, serverValue:10196}] to 10.82.107.128:3600
2023-11-02 16:17:44.571  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:44, serverValue:10197}] to 10.82.107.128:3600
2023-11-02 16:17:44.606  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:45, serverValue:10198}] to 10.82.107.128:3600
2023-11-02 16:17:44.635  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:46, serverValue:10199}] to 10.82.107.128:3600
2023-11-02 16:17:44.663  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:47, serverValue:10200}] to 10.82.107.128:3600
2023-11-02 16:17:44.696  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:48, serverValue:10201}] to 10.82.107.128:3600
2023-11-02 16:17:44.724  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:49, serverValue:10202}] to 10.82.107.128:3600
2023-11-02 16:17:44.753  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:50, serverValue:10203}] to 10.82.107.128:3600
2023-11-02 16:17:44.782  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:51, serverValue:10204}] to 10.82.107.128:3600
2023-11-02 16:17:44.811  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:52, serverValue:10205}] to 10.82.107.128:3600
2023-11-02 16:17:44.840  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:53, serverValue:10206}] to 10.82.107.128:3600
2023-11-02 16:17:44.869  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:54, serverValue:10207}] to 10.82.107.128:3600
2023-11-02 16:17:44.898  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:55, serverValue:10208}] to 10.82.107.128:3600
2023-11-02 16:17:44.927  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:56, serverValue:10209}] to 10.82.107.128:3600
2023-11-02 16:17:44.956  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:57, serverValue:10210}] to 10.82.107.128:3600
2023-11-02 16:17:44.984  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:58, serverValue:10211}] to 10.82.107.128:3600
2023-11-02 16:17:45.026  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:59, serverValue:10212}] to 10.82.107.128:3600
2023-11-02 16:17:45.054  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:60, serverValue:10213}] to 10.82.107.128:3600
2023-11-02 16:17:45.083  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:61, serverValue:10214}] to 10.82.107.128:3600
2023-11-02 16:17:45.112  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:62, serverValue:10215}] to 10.82.107.128:3600
2023-11-02 16:17:45.140  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:63, serverValue:10216}] to 10.82.107.128:3600
2023-11-02 16:17:45.169  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:64, serverValue:10217}] to 10.82.107.128:3600
2023-11-02 16:17:45.198  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:65, serverValue:10218}] to 10.82.107.128:3600
2023-11-02 16:17:45.226  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:66, serverValue:10219}] to 10.82.107.128:3600
2023-11-02 16:17:45.255  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:67, serverValue:10220}] to 10.82.107.128:3600
2023-11-02 16:17:45.284  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:68, serverValue:10221}] to 10.82.107.128:3600
2023-11-02 16:17:45.312  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:69, serverValue:10222}] to 10.82.107.128:3600
2023-11-02 16:17:45.344  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:70, serverValue:10223}] to 10.82.107.128:3600
2023-11-02 16:17:45.372  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:71, serverValue:10224}] to 10.82.107.128:3600
2023-11-02 16:17:45.400  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:72, serverValue:10225}] to 10.82.107.128:3600
2023-11-02 16:17:45.429  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:73, serverValue:10226}] to 10.82.107.128:3600
2023-11-02 16:17:45.457  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:74, serverValue:10227}] to 10.82.107.128:3600
2023-11-02 16:17:45.486  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:75, serverValue:10228}] to 10.82.107.128:3600
2023-11-02 16:17:45.514  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:76, serverValue:10229}] to 10.82.107.128:3600
2023-11-02 16:17:45.543  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:77, serverValue:10230}] to 10.82.107.128:3600
2023-11-02 16:17:45.571  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:78, serverValue:10231}] to 10.82.107.128:3600
2023-11-02 16:17:45.600  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:79, serverValue:10232}] to 10.82.107.128:3600
2023-11-02 16:17:45.629  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:80, serverValue:10233}] to 10.82.107.128:3600
2023-11-02 16:17:45.661  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:81, serverValue:10234}] to 10.82.107.128:3600
2023-11-02 16:17:45.690  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:82, serverValue:10235}] to 10.82.107.128:3600
2023-11-02 16:17:45.718  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:83, serverValue:10236}] to 10.82.107.128:3600
2023-11-02 16:17:45.747  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:84, serverValue:10237}] to 10.82.107.128:3600
2023-11-02 16:17:45.775  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:85, serverValue:10238}] to 10.82.107.128:3600
2023-11-02 16:17:45.807  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:86, serverValue:10239}] to 10.82.107.128:3600
2023-11-02 16:17:45.836  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:87, serverValue:10240}] to 10.82.107.128:3600
2023-11-02 16:17:45.864  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:88, serverValue:10241}] to 10.82.107.128:3600
2023-11-02 16:17:45.892  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:89, serverValue:10242}] to 10.82.107.128:3600
2023-11-02 16:17:45.921  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:90, serverValue:10243}] to 10.82.107.128:3600
2023-11-02 16:17:45.950  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:91, serverValue:10244}] to 10.82.107.128:3600
2023-11-02 16:17:45.978  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:92, serverValue:10245}] to 10.82.107.128:3600
2023-11-02 16:17:46.009  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:93, serverValue:10246}] to 10.82.107.128:3600
2023-11-02 16:17:46.038  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:94, serverValue:10247}] to 10.82.107.128:3600
2023-11-02 16:17:46.067  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:95, serverValue:10248}] to 10.82.107.128:3600
2023-11-02 16:17:46.096  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:96, serverValue:10249}] to 10.82.107.128:3600
2023-11-02 16:17:46.125  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:97, serverValue:10250}] to 10.82.107.128:3600
2023-11-02 16:17:46.154  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:98, serverValue:10251}] to 10.82.107.128:3600
2023-11-02 16:17:46.184  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:99, serverValue:10252}] to 10.82.107.128:3600
2023-11-02 16:17:46.213  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:100, serverValue:10253}] to 10.82.107.128:3600
2023-11-02 16:17:46.242  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:101, serverValue:10254}] to 10.82.107.128:3600
2023-11-02 16:17:46.270  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:102, serverValue:10255}] to 10.82.107.128:3600
2023-11-02 16:17:46.299  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:103, serverValue:10256}] to 10.82.107.128:3600
2023-11-02 16:17:46.331  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:104, serverValue:10257}] to 10.82.107.128:3600
2023-11-02 16:17:46.359  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:105, serverValue:10258}] to 10.82.107.128:3600
2023-11-02 16:17:46.388  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:106, serverValue:10259}] to 10.82.107.128:3600
2023-11-02 16:17:46.422  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:107, serverValue:10260}] to 10.82.107.128:3600
2023-11-02 16:17:46.450  INFO 1 --- [imer-3-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:108, serverValue:10261}] to 10.82.107.128:3600
2023-11-02 16:17:56.853  WARN 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Exception thrown during connection pool background maintenance task
com.mongodb.MongoSocketOpenException: Exception opening socket
        at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70) ~[mongodb-driver-core-4.6.0.jar!/:na]
        at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:180) ~[mongodb-driver-core-4.6.0.jar!/:na]
        at com.mongodb.internal.connection.UsageTrackingInternalConnection.open(UsageTrackingInternalConnection.java:54) ~[mongodb-driver-core-4.6.0.jar!/:na]
        at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.open(DefaultConnectionPool.java:535) ~[mongodb-driver-core-4.6.0.jar!/:na]
        at com.mongodb.internal.connection.DefaultConnectionPool$OpenConcurrencyLimiter.openWithConcurrencyLimit(DefaultConnectionPool.java:911) ~[mongodb-driver-core-4.6.0.jar!/:na]
        at com.mongodb.internal.connection.DefaultConnectionPool$OpenConcurrencyLimiter.openImmediatelyAndTryHandOverOrRelease(DefaultConnectionPool.java:857) ~[mongodb-driver-core-4.6.0.jar!/:na]
        at com.mongodb.internal.connection.DefaultConnectionPool.lambda$doMaintenance$4(DefaultConnectionPool.java:393) ~[mongodb-driver-core-4.6.0.jar!/:na]
        at com.mongodb.internal.connection.ConcurrentPool.ensureMinSize(ConcurrentPool.java:225) ~[mongodb-driver-core-4.6.0.jar!/:na]
        at com.mongodb.internal.connection.DefaultConnectionPool.doMaintenance(DefaultConnectionPool.java:391) ~[mongodb-driver-core-4.6.0.jar!/:na]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_333]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) ~[na:1.8.0_333]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) ~[na:1.8.0_333]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) ~[na:1.8.0_333]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_333]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_333]
        at java.lang.Thread.run(Thread.java:750) ~[na:1.8.0_333]
Caused by: java.net.ConnectException: Connection timed out (Connection timed out)
        at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_333]
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:476) ~[na:1.8.0_333]
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:218) ~[na:1.8.0_333]
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:200) ~[na:1.8.0_333]
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:394) ~[na:1.8.0_333]
        at java.net.Socket.connect(Socket.java:606) ~[na:1.8.0_333]
        at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:107) ~[mongodb-driver-core-4.6.0.jar!/:na]
        at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:79) ~[mongodb-driver-core-4.6.0.jar!/:na]
        at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:65) ~[mongodb-driver-core-4.6.0.jar!/:na]
        ... 15 common frames omitted
2023-11-02 16:18:05.839  INFO 1 --- [82.107.120:3448] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:109, serverValue:10267}] to 10.82.107.120:3448
2023-11-02 16:18:06.854  INFO 1 --- [82.107.120:3448] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:110, serverValue:10268}] to 10.82.107.120:3448
2023-11-02 16:18:06.854  INFO 1 --- [82.107.120:3448] org.mongodb.driver.cluster               : Monitor thread successfully connected to server with description ServerDescription{address=10.82.107.120:3448, type=SHARD_ROUTER, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=9, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=1519694}
2023-11-02 16:18:06.882  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:111, serverValue:10269}] to 10.82.107.120:3448
2023-11-02 16:18:06.911  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:112, serverValue:10270}] to 10.82.107.120:3448
2023-11-02 16:18:06.942  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:113, serverValue:10271}] to 10.82.107.120:3448
2023-11-02 16:18:06.970  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:114, serverValue:10272}] to 10.82.107.120:3448
2023-11-02 16:18:06.998  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:115, serverValue:10273}] to 10.82.107.120:3448
2023-11-02 16:18:07.027  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:116, serverValue:10274}] to 10.82.107.120:3448
2023-11-02 16:18:07.055  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:117, serverValue:10275}] to 10.82.107.120:3448
2023-11-02 16:18:07.083  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:118, serverValue:10276}] to 10.82.107.120:3448
2023-11-02 16:18:07.112  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:119, serverValue:10277}] to 10.82.107.120:3448
2023-11-02 16:18:07.140  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:120, serverValue:10278}] to 10.82.107.120:3448
2023-11-02 16:18:07.168  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:121, serverValue:10279}] to 10.82.107.120:3448
2023-11-02 16:18:07.197  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:122, serverValue:10280}] to 10.82.107.120:3448
2023-11-02 16:18:07.226  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:123, serverValue:10281}] to 10.82.107.120:3448
2023-11-02 16:18:07.258  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:124, serverValue:10282}] to 10.82.107.120:3448
2023-11-02 16:18:07.286  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:125, serverValue:10283}] to 10.82.107.120:3448
2023-11-02 16:18:07.315  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:126, serverValue:10284}] to 10.82.107.120:3448
2023-11-02 16:18:07.344  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:127, serverValue:10285}] to 10.82.107.120:3448
2023-11-02 16:18:07.373  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:128, serverValue:10286}] to 10.82.107.120:3448
2023-11-02 16:18:07.401  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:129, serverValue:10287}] to 10.82.107.120:3448
2023-11-02 16:18:07.430  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:130, serverValue:10288}] to 10.82.107.120:3448
2023-11-02 16:18:07.459  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:131, serverValue:10289}] to 10.82.107.120:3448
2023-11-02 16:18:07.488  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:132, serverValue:10290}] to 10.82.107.120:3448
2023-11-02 16:18:07.523  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:133, serverValue:10291}] to 10.82.107.120:3448
2023-11-02 16:18:07.551  INFO 1 --- [imer-2-thread-1] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:134, serverValue:10292}] to 10.82.107.120:3448
2023-11-02 16:18:10.353  INFO 1 --- [lientSelector_1] RocketmqRemoting                         : closeChannel: close the connection to remote address[] result: true
          

In addition to that, the logs suggest that it is a networking issue. They show that the two addresses (10.82.107.128:3600 and 10.82.107.120:3448) have both been used successfully. It looks like connecting to 10.82.107.128:3600 times out (our debugging suggestion will confirm the address that's being used) after many successful connections and Mongo's driver then switches to 10.82.107.120:3448. There doesn't appear to be anything that Boot can do about this.

Thanks for your replies, I can confirm that my two addresses 10.82.107.128:3600 and 10.82.107.120:3448 have no network problems in the past.

Because I have done tests and only specified a single IP address to connect to mongodb, the following configuration:

-Dspring.data.mongodb.uri=mongodb://root:[email protected]:3600/?connectTimeoutMS=30000&minpoolsize=100&maxpoolsize=200
-Dspring.data.mongodb.uri=mongodb://root:[email protected]:3448/?connectTimeoutMS=30000&minpoolsize=100&maxpoolsize=200

At the same time, back to our question, so the traffic of these two 10.82.107.128:3600 and 10.82.107.120:3448 will hit the same mongodb pod, so it means that the application is actually linked to the same mongodb instance.

So I don’t know if springboot has certain restrictions when initializing the mongodb connection pool. For example, will an error occur when the same mongodb instance is initialized multiple times?

So I don’t know if springboot has certain restrictions when initializing the mongodb connection pool

It does not. Spring Boot simply passes the connection details through to Mongo's Java Driver.

will an error occur when the same mongodb instance is initialized multiple times?

I don't know. That's a question for MongoDB.