On my webapp, I often get the following exception: java.sql.SQLNonTransientConnectionException: Could not send query: Last packet not finished it usually happens after a long period of time the system is idle. A restart to the tomcat solves the issue temporarily.
I've recently moved to RHEL7 on my production server (running tomcat7 and mariaDB 5.5). This error hadn't not happened on the old server (ran RHEL5 with mySQL). I updated the java database drivers from mysql drivers that were used on the old server, to the latest stable mariadb connector: mariadb-java-client-1.1.7.jar.
Any ideas how to fix the problem or a workaround?
Here is the full log of this exception:
Lexicon Message: Content.getData Error trying to excute: SELECT * FROM prefixes where prefix ='l'
java.sql.SQLNonTransientConnectionException: Could not send query: Last packet not finished
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.execute(MySQLStatement.java:338)
at snaq.db.CachedStatement.execute(CachedStatement.java:339)
at mila.lexicon.dbUtils.Connected.getData(Connected.java:257)
at mila.lexicon.dbUtils.Prefixes.get(Prefixes.java:29)
at mila.lexicon.analyse.Data.getPrefixes(Data.java:446)
at mila.HMM.HMM2Morph.handlePrefixProperNameAnalysis(HMM2Morph.java:1196)
at mila.HMM.HMM2Morph.parseXML(HMM2Morph.java:1791)
at mila.HMM.HMM2Morph.process(HMM2Morph.java:2337)
at org.apache.jsp.processAnalyzerXML_jsp._jspService(processAnalyzerXML_jsp.java:187)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1024)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.mariadb.jdbc.internal.common.QueryException: Could not send query: Last packet not finished
at org.mariadb.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:984)
at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:281)
... 31 more
Caused by: java.io.IOException: Last packet not finished
at org.mariadb.jdbc.internal.common.packet.PacketOutputStream.startPacket(PacketOutputStream.java:38)
at org.mariadb.jdbc.internal.common.packet.commands.StreamedQueryPacket.send(StreamedQueryPacket.java:76)
at org.mariadb.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:982)
... 32 more
We don't have enough informations but I had the similar issue with mysql server. The problem was solved after changing timeout settings in my.cnf
wait_timeout = 28800
interactive_timeout = 28800
28800 secons - 8 hours
Restart your server to apply the changes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With