java.sql.SQLNonTransientConnectionException: Could not read resultset: Connection reset

tip

It's possible you're trying to write to a connection that's already closed. Another cause for this is that you closed the socket with unread data in the socket receive buffer.


rafael
tip

This might be caused by unmatching versions of SSL. Java starts normally with SSLv2 and your server might not be able to negotiate. You have to force Java to use SSLv3. See this comment: https://goo.gl/hx0YB3


rafael

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • Configuration to stop mysql sleep
    via Database Administrators by Biscuit128
    ,
  • My JAVA application is run on Tomcat Server with a single MongoDB. This error occurs some times a day. - Here is an exception message. ---------------------------------------------------------------------------------------------------- com.mongodb.DBPortPool gotError WARNING: emptying DBPortPool to /172.20.1.4:27017 b/c of error java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:189) at java.net.SocketInputStream.read(SocketInputStream.java:121) at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) at java.io.BufferedInputStream.read(BufferedInputStream.java:345) at org.bson.io.Bits.readFully(Bits.java:46) at org.bson.io.Bits.readFully(Bits.java:33) at org.bson.io.Bits.readFully(Bits.java:28) at com.mongodb.Response.<init>(Response.java:40) at com.mongodb.DBPort.go(DBPort.java:142) at com.mongodb.DBPort.call(DBPort.java:92) at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:244) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:216) at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:288) at com.mongodb.DB.command(DB.java:262) at com.mongodb.DB.command(DB.java:244) at com.mongodb.DBCollection.getCount(DBCollection.java:985) at com.mongodb.DBCursor.size(DBCursor.java:602) at com.mysema.query.mongodb.MongodbQuery.list(MongodbQuery.java:271) at org.springframework.data.mongodb.repository.support.QueryDslMongoRepository.findAll(QueryDslMongoRepository.java:93) at sun.reflect.GeneratedMethodAccessor6078.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:358) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:343) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy586.findAll(Unknown Source) ---------------------------------------------------------------------------------------------------- - The code about connecting MongoDB is not different. Here is the code. MongoClientOptions options = MongoClientOptions.builder() .connectionsPerHost(50).build(); MongoClient client = new MongoClient(new ServerAddress(dbHost, dbPort), Arrays.asList(credential), options); ---------------------------------------------------------------------------------------------------- I can't even guess whether it's caused by a Network problem or a MongoDB java driver. This issue is really worrying..Please, help me.
    via by Claire Lee,
  • My JAVA application is run on Tomcat Server with a single MongoDB. This error occurs some times a day. - Here is an exception message. ---------------------------------------------------------------------------------------------------- com.mongodb.DBPortPool gotError WARNING: emptying DBPortPool to /172.20.1.4:27017 b/c of error java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:189) at java.net.SocketInputStream.read(SocketInputStream.java:121) at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) at java.io.BufferedInputStream.read(BufferedInputStream.java:345) at org.bson.io.Bits.readFully(Bits.java:46) at org.bson.io.Bits.readFully(Bits.java:33) at org.bson.io.Bits.readFully(Bits.java:28) at com.mongodb.Response.<init>(Response.java:40) at com.mongodb.DBPort.go(DBPort.java:142) at com.mongodb.DBPort.call(DBPort.java:92) at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:244) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:216) at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:288) at com.mongodb.DB.command(DB.java:262) at com.mongodb.DB.command(DB.java:244) at com.mongodb.DBCollection.getCount(DBCollection.java:985) at com.mongodb.DBCursor.size(DBCursor.java:602) at com.mysema.query.mongodb.MongodbQuery.list(MongodbQuery.java:271) at org.springframework.data.mongodb.repository.support.QueryDslMongoRepository.findAll(QueryDslMongoRepository.java:93) at sun.reflect.GeneratedMethodAccessor6078.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:358) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:343) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy586.findAll(Unknown Source) ---------------------------------------------------------------------------------------------------- - The code about connecting MongoDB is not different. Here is the code. MongoClientOptions options = MongoClientOptions.builder() .connectionsPerHost(50).build(); MongoClient client = new MongoClient(new ServerAddress(dbHost, dbPort), Arrays.asList(credential), options); ---------------------------------------------------------------------------------------------------- I can't even guess whether it's caused by a Network problem or a MongoDB java driver. This issue is really worrying..Please, help me.
    via by Claire Lee,
  • My JAVA application is run on Tomcat Server with a single MongoDB. This error occurs some times a day. - Here is an exception message. ---------------------------------------------------------------------------------------------------- com.mongodb.DBPortPool gotError WARNING: emptying DBPortPool to /172.20.1.4:27017 b/c of error java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:189) at java.net.SocketInputStream.read(SocketInputStream.java:121) at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) at java.io.BufferedInputStream.read(BufferedInputStream.java:345) at org.bson.io.Bits.readFully(Bits.java:46) at org.bson.io.Bits.readFully(Bits.java:33) at org.bson.io.Bits.readFully(Bits.java:28) at com.mongodb.Response.<init>(Response.java:40) at com.mongodb.DBPort.go(DBPort.java:142) at com.mongodb.DBPort.call(DBPort.java:92) at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:244) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:216) at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:288) at com.mongodb.DB.command(DB.java:262) at com.mongodb.DB.command(DB.java:244) at com.mongodb.DBCollection.getCount(DBCollection.java:985) at com.mongodb.DBCursor.size(DBCursor.java:602) at com.mysema.query.mongodb.MongodbQuery.list(MongodbQuery.java:271) at org.springframework.data.mongodb.repository.support.QueryDslMongoRepository.findAll(QueryDslMongoRepository.java:93) at sun.reflect.GeneratedMethodAccessor6078.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:358) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:343) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy586.findAll(Unknown Source) ---------------------------------------------------------------------------------------------------- - The code about connecting MongoDB is not different. Here is the code. MongoClientOptions options = MongoClientOptions.builder() .connectionsPerHost(50).build(); MongoClient client = new MongoClient(new ServerAddress(dbHost, dbPort), Arrays.asList(credential), options); ---------------------------------------------------------------------------------------------------- I can't even guess whether it's caused by a Network problem or a MongoDB java driver. This issue is really worrying..Please, help me.
    via by Claire Lee,
  • My JAVA application is run on Tomcat Server with a single MongoDB. This error occurs some times a day. - Here is an exception message. ---------------------------------------------------------------------------------------------------- com.mongodb.DBPortPool gotError WARNING: emptying DBPortPool to /172.20.1.4:27017 b/c of error java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:189) at java.net.SocketInputStream.read(SocketInputStream.java:121) at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) at java.io.BufferedInputStream.read(BufferedInputStream.java:345) at org.bson.io.Bits.readFully(Bits.java:46) at org.bson.io.Bits.readFully(Bits.java:33) at org.bson.io.Bits.readFully(Bits.java:28) at com.mongodb.Response.<init>(Response.java:40) at com.mongodb.DBPort.go(DBPort.java:142) at com.mongodb.DBPort.call(DBPort.java:92) at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:244) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:216) at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:288) at com.mongodb.DB.command(DB.java:262) at com.mongodb.DB.command(DB.java:244) at com.mongodb.DBCollection.getCount(DBCollection.java:985) at com.mongodb.DBCursor.size(DBCursor.java:602) at com.mysema.query.mongodb.MongodbQuery.list(MongodbQuery.java:271) at org.springframework.data.mongodb.repository.support.QueryDslMongoRepository.findAll(QueryDslMongoRepository.java:93) at sun.reflect.GeneratedMethodAccessor6078.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:358) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:343) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy586.findAll(Unknown Source) ---------------------------------------------------------------------------------------------------- - The code about connecting MongoDB is not different. Here is the code. MongoClientOptions options = MongoClientOptions.builder() .connectionsPerHost(50).build(); MongoClient client = new MongoClient(new ServerAddress(dbHost, dbPort), Arrays.asList(credential), options); ---------------------------------------------------------------------------------------------------- I can't even guess whether it's caused by a Network problem or a MongoDB java driver. This issue is really worrying..Please, help me.
    via by Claire Lee,
  • Retry mongodb connection
    via GitHub by j0hnsmith
    ,
    • java.sql.SQLNonTransientConnectionException: Could not read resultset: Connection reset at org.mariadb.jdbc.internal.SQLExceptionMapper.get(SQLExceptionMapper.java:136) at org.mariadb.jdbc.internal.SQLExceptionMapper.throwException(SQLExceptionMapper.java:106) at org.mariadb.jdbc.MySQLStatement.executeQueryEpilog(MySQLStatement.java:264) at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:288) at org.mariadb.jdbc.MySQLStatement.executeQuery(MySQLStatement.java:302) at org.mariadb.jdbc.MySQLStatement.executeQuery(MySQLStatement.java:361) at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208) at com.swifte.database.DBFactory.attemptLoginWithTempPasswordDetails(DBFactory.java:183) at com.swifte.database.DBFactory.authenticate(DBFactory.java:133) at com.swifte.service.ExposedFunctions.login(ExposedFunctions.java:132) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167) at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269) at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227) at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216) at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926) at java.lang.Thread.run(Thread.java:745) Caused by: org.mariadb.jdbc.internal.common.QueryException: Could not read resultset: Connection reset at org.mariadb.jdbc.internal.mysql.MySQLProtocol.getResult(MySQLProtocol.java:926) at org.mariadb.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:991) at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:281) ... 35 more Caused by: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:189) at java.net.SocketInputStream.read(SocketInputStream.java:121) at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) at java.io.BufferedInputStream.read(BufferedInputStream.java:345) at org.mariadb.jdbc.internal.common.packet.buffer.ReadUtil.readFully(ReadUtil.java:82) at org.mariadb.jdbc.internal.common.packet.buffer.ReadUtil.readFully(ReadUtil.java:92) at org.mariadb.jdbc.internal.common.packet.RawPacket.nextPacket(RawPacket.java:77) at org.mariadb.jdbc.internal.common.packet.SyncPacketFetcher.getRawPacket(SyncPacketFetcher.java:67) at org.mariadb.jdbc.internal.mysql.MySQLProtocol.getResult(MySQLProtocol.java:894) ... 37 more

    Users with the same issue

    Nikolay Rybak
    Nikolay Rybak1 times, last one,
    mauritius
    mauritius2 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    195 more bugmates