MariaDB fails to work after being idle for a period(MariaDB 闲置一段时间后无法工作)
问题描述
在我的 webapp 上,我经常遇到以下异常:java.sql.SQLNonTransientConnectionException:无法发送查询:最后一个数据包未完成它通常在系统空闲很长时间后发生.重启 tomcat 暂时解决了这个问题.
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.
我最近在生产服务器上迁移到 RHEL7(运行 tomcat7 和 mariaDB 5.5).旧服务器上没有发生此错误(使用 mySQL 运行 RHEL5).我将 java 数据库驱动程序从旧服务器上使用的 mysql 驱动程序更新为最新的稳定 mariadb 连接器:mariadb-java-client-1.1.7.jar.
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 消息:Content.getData 尝试执行时出错:SELECT * FROM prefixes where prefix ='l'java.sql.SQLNonTransientConnectionException:无法发送查询:最后一个数据包未完成在 org.mariadb.jdbc.internal.SQLExceptionMapper.get(SQLExceptionMapper.java:136)在 org.mariadb.jdbc.internal.SQLExceptionMapper.throwException(SQLExceptionMapper.java:106)在 org.mariadb.jdbc.MySQLStatement.executeQueryEpilog(MySQLStatement.java:264)在 org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:288)在 org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:338)在 snaq.db.CachedStatement.execute(CachedStatement.java:339)在 mila.lexicon.dbUtils.Connected.getData(Connected.java:257)在 mila.lexicon.dbUtils.Prefixes.get(Prefixes.java:29)在 mila.lexicon.analysis.Data.getPrefixes(Data.java:446)在 mila.HMM.HMM2Morph.handlePrefixProperNameAnalysis(HMM2Morph.java:1196)在 mila.HMM.HMM2Morph.parseXML(HMM2Morph.java:1791)在 mila.HMM.HMM2Morph.process(HMM2Morph.java:2337)在 org.apache.jsp.processAnalyzerXML_jsp._jspService(processAnalyzerXML_jsp.java:187)在 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)在 javax.servlet.http.HttpServlet.service(HttpServlet.java:728)在 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)在 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)在 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)在 javax.servlet.http.HttpServlet.service(HttpServlet.java:728)在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)在 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)在 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)在 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)在 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)在 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)在 org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)在 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)在 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)在 org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1024)在 org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)在 org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)在 java.lang.Thread.run(Thread.java:745)原因:org.mariadb.jdbc.internal.common.QueryException:无法发送查询:最后一个数据包未完成在 org.mariadb.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:984)在 org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:281)... 31 更多原因:java.io.IOException:最后一个数据包未完成在 org.mariadb.jdbc.internal.common.packet.PacketOutputStream.startPacket(PacketOutputStream.java:38)在 org.mariadb.jdbc.internal.common.packet.commands.StreamedQueryPacket.send(StreamedQueryPacket.java:76)在 org.mariadb.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:982)... 32 更多
推荐答案
我们没有足够的信息,但我在 mysql 服务器上遇到了类似的问题.在 my.cnf
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 秒 - 8 小时
28800 secons - 8 hours
重新启动服务器以应用更改
Restart your server to apply the changes
这篇关于MariaDB 闲置一段时间后无法工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MariaDB 闲置一段时间后无法工作
基础教程推荐
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- 降序排序:Java Map 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- Java:带有char数组的println给出乱码 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01