You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alex Burton <al...@e-plus.com.au> on 2003/06/03 08:21:40 UTC

RE: IOException: failed to communicate with MySQL

a couple of days ago a post went by talking about MySQL default timeout
being set to 8 hrs for connections... betting this might be your problem...

-----Original Message-----
From: Mindaugas Genutis [mailto:mindaugas@elinara.ktu.lt]
Sent: Tuesday, 3 June 2003 5:26 PM
To: tomcat-user@jakarta.apache.org
Subject: IOException: failed to communicate with MySQL



Hello,

My JSP application very often after night, in the morning stops
communicating with MySQL database. I get an exception each morning (the
exception body goes below). The application starts to work again after I
restart it from the Tomcat Manager.

Maybe someone else also had this same problem? My server configuration:
Linux Redhat, Tomcat 4.1.24, Java 1.4.1.

My assumptions where the problem might be: the MySQL connections are
"eaten" by another application or they are "eaten" by my application
somewhere inside and never closed. Or maybe during the night when no one
is working with my application it somehow "frozes"? Can anyone give me a
clue how to start debugging these early morning crashes?

Another clue: Connections to the database are made through an SQLManager
which is a class written by another programmer. The class is a singleton.
Could it be that I have to reset it more often?

The exception body goes here:

java.sql.SQLException: Communication link failure: java.io.IOException
	at com.mysql.jdbc.MysqlIO.clearAllReceive(Unknown Source)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(Unknown Source)
	at com.mysql.jdbc.MysqlIO.sqlQuery(Unknown Source)
	at com.mysql.jdbc.Connection.execSQL(Unknown Source)
	at com.mysql.jdbc.Connection.execSQL(Unknown Source)
	at com.mysql.jdbc.Statement.executeQuery(Unknown Source)
	at com.mysql.jdbc.jdbc2.Statement.executeQuery(Unknown Source)
	at
lt.ktu.distance.sql.mysql.MySQLGUILanguageManagerHelper.loadGUILanguages(MyS
QLGUILanguageManagerHelper.java:48)
	at
lt.ktu.distance.sql.GUILanguageManager.loadGUILanguages(GUILanguageManager.j
ava:55)
	at org.apache.jsp.index_jsp._jspService(index_jsp.java:155)
	at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
10)
	at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:256)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:171)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
	at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:392)
	at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:619)
	at java.lang.Thread.run(Thread.java:536)

Thanks,

--
Kaunas Regional Distance Education Center
Programmer
Phone: +370 674 05232
WWW: http://distance.ktu.lt


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: IOException: failed to communicate with MySQL

Posted by Martin Jacobson <ma...@libero.it>.
Mindaugas Genutis wrote:
>>a couple of days ago a post went by talking about MySQL default timeout
>>being set to 8 hrs for connections... betting this might be your problem...
> 
> 
> Thanks for pointing this out. I've read the thread "Tomcat problems every 
> morning". However, no solution was suggested in that thread. One can 
> assume the solution implicitly: increase default MySQL timeout from 8 
> hours to say 48 hours. However, if my application stays idle for 48 hours 
> during holidays, it will disconnect after that.
> 
> Does anyone else have a suggestion on how to improve on this?
> 

Yes,

add ?autoReconnect=true to the connection url.

Martin


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: IOException: failed to communicate with MySQL

Posted by Kwok Peng Tuck <pe...@makmal.net>.
Write a dbkeep-alive, schedule it to run say every 15 minutes. Works for 
me.
I use jcrontab.sourceforge.net to schedule this.
I think DBCP also does something like this, you might want to look at 
their docs as well.

Mindaugas Genutis wrote:

>>a couple of days ago a post went by talking about MySQL default timeout
>>being set to 8 hrs for connections... betting this might be your problem...
>>    
>>
>
>Thanks for pointing this out. I've read the thread "Tomcat problems every 
>morning". However, no solution was suggested in that thread. One can 
>assume the solution implicitly: increase default MySQL timeout from 8 
>hours to say 48 hours. However, if my application stays idle for 48 hours 
>during holidays, it will disconnect after that.
>
>Does anyone else have a suggestion on how to improve on this?
>
>
>  
>
>>Hello,
>>
>>My JSP application very often after night, in the morning stops
>>communicating with MySQL database. I get an exception each morning (the
>>exception body goes below). The application starts to work again after I
>>restart it from the Tomcat Manager.
>>
>>Maybe someone else also had this same problem? My server configuration:
>>Linux Redhat, Tomcat 4.1.24, Java 1.4.1.
>>
>>My assumptions where the problem might be: the MySQL connections are
>>"eaten" by another application or they are "eaten" by my application
>>somewhere inside and never closed. Or maybe during the night when no one
>>is working with my application it somehow "frozes"? Can anyone give me a
>>clue how to start debugging these early morning crashes?
>>
>>Another clue: Connections to the database are made through an SQLManager
>>which is a class written by another programmer. The class is a singleton.
>>Could it be that I have to reset it more often?
>>    
>>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: IOException: failed to communicate with MySQL

Posted by Mindaugas Genutis <mi...@elinara.ktu.lt>.
> a couple of days ago a post went by talking about MySQL default timeout
> being set to 8 hrs for connections... betting this might be your problem...

Thanks for pointing this out. I've read the thread "Tomcat problems every 
morning". However, no solution was suggested in that thread. One can 
assume the solution implicitly: increase default MySQL timeout from 8 
hours to say 48 hours. However, if my application stays idle for 48 hours 
during holidays, it will disconnect after that.

Does anyone else have a suggestion on how to improve on this?


> Hello,
> 
> My JSP application very often after night, in the morning stops
> communicating with MySQL database. I get an exception each morning (the
> exception body goes below). The application starts to work again after I
> restart it from the Tomcat Manager.
> 
> Maybe someone else also had this same problem? My server configuration:
> Linux Redhat, Tomcat 4.1.24, Java 1.4.1.
> 
> My assumptions where the problem might be: the MySQL connections are
> "eaten" by another application or they are "eaten" by my application
> somewhere inside and never closed. Or maybe during the night when no one
> is working with my application it somehow "frozes"? Can anyone give me a
> clue how to start debugging these early morning crashes?
> 
> Another clue: Connections to the database are made through an SQLManager
> which is a class written by another programmer. The class is a singleton.
> Could it be that I have to reset it more often?

-- 
Kaunas Regional Distance Education Center
Programmer
Phone: +370 674 05232
WWW: http://distance.ktu.lt


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org