项目开发中,链接mongodb的项目,偶尔报错com.mongodb.MongoSocketReadException: Prematurely reached end of stream
报错的详细信息:
2022-07-11 08:34:00.001 INFO 1 --- [ scheduling-1] o.s.d.mongodb.core.convert.QueryMapper : Could not map 'UsageRecord.processed'. Maybe a fragment in 'Boolean' is considered a simple type. Mapper continues with processed.
2022-07-11 08:34:01.410 INFO 1 --- [ scheduling-1] org.mongodb.driver.connection : Closed connection [connectionId{localValue:60, serverValue:1824}] to 10.100.111.121:27017 because there was a socket exception raised by this connection.
2022-07-11 08:34:01.411 INFO 1 --- [ scheduling-1] org.mongodb.driver.cluster : No server chosen by ReadPreferenceServerSelector{readPreference=primary} from cluster description ClusterDescription{type=REPLICA_SET, connectionMode=MULTIPLE, serverDescriptions=[ServerDescription{address=10.100.111.121:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Prematurely reached end of stream}}, ServerDescription{address=10.100.15.147:27017, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=9, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=904746, setName='rs0', canonicalAddress=10.100.15.147:27017, hosts=[10.100.15.147:27017, 10.100.73.126:27017, 10.100.111.121:27017], passives=[], arbiters=[], primary='10.100.111.121:27017', tagSet=TagSet{[Tag{name='serviceName', value='mongodb'}]}, electionId=null, setVersion=5209130, topologyVersion=TopologyVersion{processId=62cbdcb123f4ce1a82a43f54, counter=4}, lastWriteDate=Mon Jul 11 08:33:45 GMT 2022, lastUpdateTimeNanos=19883840756252}, ServerDescription{address=10.100.73.126:27017, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=9, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=897679, setName='rs0', canonicalAddress=10.100.73.126:27017, hosts=[10.100.15.147:27017, 10.100.73.126:27017, 10.100.111.121:27017], passives=[], arbiters=[], primary='10.100.111.121:27017', tagSet=TagSet{[Tag{name='serviceName', value='mongodb'}]}, electionId=null, setVersion=5209130, topologyVersion=TopologyVersion{processId=62cbdee0732609efe7dccae6, counter=4}, lastWriteDate=Mon Jul 11 08:33:45 GMT 2022, lastUpdateTimeNanos=19884448424902}]}. Waiting for 30000 ms before timing out
2022-07-11 08:34:01.412 INFO 1 --- [nio-5010-exec-2] org.mongodb.driver.connection : Closed connection [connectionId{localValue:57, serverValue:1386}] to 10.100.111.121:27017 because there was a socket exception raised by this connection.
2022-07-11 08:34:01.412 INFO 1 --- [0.111.121:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server 10.100.111.121:27017com.mongodb.MongoSocketReadException: Prematurely reached end of streamat com.mongodb.internal.connection.SocketStream.read(SocketStream.java:112) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.SocketStream.read(SocketStream.java:131) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.InternalStreamConnection.receiveResponseBuffers(InternalStreamConnection.java:647) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.InternalStreamConnection.receiveMessageWithAdditionalTimeout(InternalStreamConnection.java:512) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:355) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.InternalStreamConnection.receive(InternalStreamConnection.java:315) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:215) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:144) ~[mongodb-driver-core-4.2.3.jar:na]at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]2022-07-11 08:34:01.413 INFO 1 --- [0.111.121:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server 10.100.111.121:27017com.mongodb.MongoSocketOpenException: Exception opening socketat com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:143) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:188) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:144) ~[mongodb-driver-core-4.2.3.jar:na]at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]
Caused by: java.net.ConnectException: Connection refused (Connection refused)at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:na]at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) ~[na:na]at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) ~[na:na]at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) ~[na:na]at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:na]at java.base/java.net.Socket.connect(Socket.java:609) ~[na:na]at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:107) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:79) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:65) ~[mongodb-driver-core-4.2.3.jar:na]... 4 common frames omitted2022-07-11 08:34:01.414 INFO 1 --- [nio-5010-exec-2] org.mongodb.driver.connection : Closed connection [connectionId{localValue:61}] to 10.100.111.121:27017 because there was a socket exception raised by this connection.
2022-07-11 08:34:01.426 ERROR 1 --- [nio-5010-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.DataAccessResourceFailureException: Prematurely reached end of stream; nested exception is com.mongodb.MongoSocketReadException: Prematurely reached end of stream] with root causecom.mongodb.MongoSocketReadException: Prematurely reached end of streamat com.mongodb.internal.connection.SocketStream.read(SocketStream.java:112) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.SocketStream.read(SocketStream.java:131) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.InternalStreamConnection.receiveResponseBuffers(InternalStreamConnection.java:647) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.InternalStreamConnection.receiveMessageWithAdditionalTimeout(InternalStreamConnection.java:512) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:355) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:279) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.UsageTrackingInternalConnection.sendAndReceive(UsageTrackingInternalConnection.java:100) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.sendAndReceive(DefaultConnectionPool.java:490) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.CommandProtocolImpl.execute(CommandProtocolImpl.java:71) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:253) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:202) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.DefaultServerConnection.command(DefaultServerConnection.java:118) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.connection.DefaultServerConnection.command(DefaultServerConnection.java:110) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.operation.QueryBatchCursor.getMore(QueryBatchCursor.java:268) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.internal.operation.QueryBatchCursor.hasNext(QueryBatchCursor.java:141) ~[mongodb-driver-core-4.2.3.jar:na]at com.mongodb.client.internal.MongoBatchCursorAdapter.hasNext(MongoBatchCursorAdapter.java:54) ~[mongodb-driver-sync-4.2.3.jar:na]at org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:2811) ~[spring-data-mongodb-3.2.3.jar:3.2.3]at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:2543) ~[spring-data-mongodb-3.2.3.jar:3.2.3]at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:2525) ~[spring-data-mongodb-3.2.3.jar:3.2.3]at org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:847) ~[spring-data-mongodb-3.2.3.jar:3.2.3]at org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:833) ~[spring-data-mongodb-3.2.3.jar:3.2.3]at com.fastonetech.billing.service.v1.BillV1Service.create(BillV1Service.kt:41) ~[classes/:na]at com.fastonetech.billing.controller.BillController.getByMonth(BillController.kt:65) ~[classes/:na]at jdk.internal.reflect.GeneratedMethodAccessor129.invoke(Unknown Source) ~[na:na]at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197) ~[spring-web-5.3.9.jar:5.3.9]at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141) ~[spring-web-5.3.9.jar:5.3.9]at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) ~[spring-webmvc-5.3.9.jar:5.3.9]at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.3.9.jar:5.3.9]at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.9.jar:5.3.9]at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.9.jar:5.3.9]at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1064) ~[spring-webmvc-5.3.9.jar:5.3.9]at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) ~[spring-webmvc-5.3.9.jar:5.3.9]at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.9.jar:5.3.9]at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.9.jar:5.3.9]at javax.servlet.http.HttpServlet.service(HttpServlet.java:655) ~[tomcat-embed-core-9.0.50.jar:4.0.FR]at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.9.jar:5.3.9]at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) ~[tomcat-embed-core-9.0.50.jar:4.0.FR]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:228) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.50.jar:9.0.50]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.9.jar:5.3.9]at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.9.jar:5.3.9]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.9.jar:5.3.9]at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.9.jar:5.3.9]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.9.jar:5.3.9]at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.9.jar:5.3.9]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:769) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1723) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.50.jar:9.0.50]at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]2022-07-11 08:34:01.440 INFO 1 --- [00.15.147:27017] org.mongodb.driver.cluster : Monitor thread successfully connected to server with description ServerDescription{address=10.100.15.147:27017, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=9, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=885369, setName='rs0', canonicalAddress=10.100.15.147:27017, hosts=[10.100.15.147:27017, 10.100.73.126:27017, 10.100.111.121:27017], passives=[], arbiters=[], primary='null', tagSet=TagSet{[Tag{name='serviceName', value='mongodb'}]}, electionId=null, setVersion=5209130, topologyVersion=TopologyVersion{processId=62cbdcb123f4ce1a82a43f54, counter=4}, lastWriteDate=Mon Jul 11 08:33:58 GMT 2022, lastUpdateTimeNanos=19893848661980}
2022-07-11 08:34:02.048 INFO 1 --- [00.73.126:27017] org.mongodb.driver.cluster : Monitor thread successfully connected to server with description ServerDescription{address=10.100.73.126:27017, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=9, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=859001, setName='rs0', canonicalAddress=10.100.73.126:27017, hosts=[10.100.15.147:27017, 10.100.73.126:27017, 10.100.111.121:27017], passives=[], arbiters=[], primary='null', tagSet=TagSet{[Tag{name='serviceName', value='mongodb'}]}, electionId=null, setVersion=5209130, topologyVersion=TopologyVersion{processId=62cbdee0732609efe7dccae6, counter=4}, lastWriteDate=Mon Jul 11 08:33:58 GMT 2022, lastUpdateTimeNanos=19894456486754}
2022-07-11 08:34:09.519 INFO 1 --- [00.73.126:27017] org.mongodb.driver.cluster : Monitor thread successfully connected to server with description ServerDescription{address=10.100.73.126:27017, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=9, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=829781, setName='rs0', canonicalAddress=10.100.73.126:27017, hosts=[10.100.15.147:27017, 10.100.73.126:27017, 10.100.111.121:27017], passives=[], arbiters=[], primary='10.100.73.126:27017', tagSet=TagSet{[Tag{name='serviceName', value='mongodb'}]}, electionId=7fffffff000000000000042e, setVersion=5209130, topologyVersion=TopologyVersion{processId=62cbdee0732609efe7dccae6, counter=5}, lastWriteDate=Mon Jul 11 08:33:58 GMT 2022, lastUpdateTimeNanos=19901926859608}
2022-07-11 08:34:10.535 INFO 1 --- [00.73.126:27017] org.mongodb.driver.cluster : Monitor thread successfully connected to server with description ServerDescription{address=10.100.73.126:27017, type=REPLICA_SET_PRIMARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=9, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=829781, setName='rs0', canonicalAddress=10.100.73.126:27017, hosts=[10.100.15.147:27017, 10.100.73.126:27017, 10.100.111.121:27017], passives=[], arbiters=[], primary='10.100.73.126:27017', tagSet=TagSet{[Tag{name='serviceName', value='mongodb'}]}, electionId=7fffffff000000000000042e, setVersion=5209130, topologyVersion=TopologyVersion{processId=62cbdee0732609efe7dccae6, counter=6}, lastWriteDate=Mon Jul 11 08:34:10 GMT 2022, lastUpdateTimeNanos=19902943021680}
2022-07-11 08:34:10.535 INFO 1 --- [00.73.126:27017] org.mongodb.driver.cluster : Setting max election id to 7fffffff000000000000042e from replica set primary 10.100.73.126:27017
2022-07-11 08:34:10.535 INFO 1 --- [00.73.126:27017] org.mongodb.driver.cluster : Discovered replica set primary 10.100.73.126:27017
2022-07-11 08:34:10.552 INFO 1 --- [ scheduling-1] org.mongodb.driver.connection : Opened connection [connectionId{localValue:70, serverValue:410}] to 10.100.73.126:27017
2022-07-11 08:34:11.448 INFO 1 --- [00.15.147:27017] org.mongodb.driver.cluster : Monitor thread successfully connected to server with description ServerDescription{address=10.100.15.147:27017, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=9, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=875959, setName='rs0', canonicalAddress=10.100.15.147:27017, hosts=[10.100.15.147:27017, 10.100.73.126:27017, 10.100.111.121:27017], passives=[], arbiters=[], primary='10.100.73.126:27017', tagSet=TagSet{[Tag{name='serviceName', value='mongodb'}]}, electionId=null, setVersion=5209130, topologyVersion=TopologyVersion{processId=62cbdcb123f4ce1a82a43f54, counter=4}, lastWriteDate=Mon Jul 11 08:34:10 GMT 2022, lastUpdateTimeNanos=19903856653811}
2022-07-11 08:34:16.523 INFO 1 --- [0.111.121:27017] org.mongodb.driver.connection : Opened connection [connectionId{localValue:71, serverValue:24}] to 10.100.111.121:27017
从保存的信息看,应该是链接问题,经过查找,加了一些参数:
&maxIdleTimeMS=1500000&maxWaitTime=120000&connectTimeout=60000&socketTimeout=60000&socketKeepAlive=true&readPreference=primary&retryWrites=true
但是还是有这个错误,没法做到根除异常信息。
后来排查发现,是mongodb集群节点频繁重启,造成链接点断开造成的。查看mongodb的状态数据
mongodb的节点服务已经宕机,出现OOM的问题。
升级mongoDB的内存,随这个问题也就解决了。