-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Communication link failure: java.net.SocketException
PostPosted: Wed Jan 21, 2004 4:17 am 
Beginner
Beginner

Joined: Wed Aug 27, 2003 5:03 am
Posts: 34
Hello,

i'm having a strange problem, my application with Hibernate works great, but after a few days (say 4), it crashes. Before taht no problems, but then it goes wrong.

Ik get this exception: Communication link failure: java.net.SocketException.

I have no idea how to solve or worse no idea what it is, is there someone who can give me some information on this topic?


Top
 Profile  
 
 Post subject: Re:
PostPosted: Wed Jan 21, 2004 4:42 am 
Newbie

Joined: Thu Sep 18, 2003 1:50 am
Posts: 17
http://www.hibernate.org/117.html#A11

_________________
- Jeevan (G1)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 21, 2004 5:15 am 
Beginner
Beginner

Joined: Wed Aug 27, 2003 5:03 am
Posts: 34
Ok i tried to use both of them, i started with C3P0 and now i'm using DBCP, but still the same problem. Any other suggestions.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 21, 2004 5:17 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Have you activated connection validation for the pool? Or set ?autoReconnect=true in your JDBC URL


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 21, 2004 5:41 am 
Beginner
Beginner

Joined: Wed Aug 27, 2003 5:03 am
Posts: 34
-these are my settings, the first part of your question is not quiet clear.
i can't find that option in my settings, maybe i just searched not good enough.

###################################
### Apache DBCP Connection Pool ###
###################################

# connection pool

hibernate.dbcp.maxActive 100
hibernate.dbcp.whenExhaustedAction 1
hibernate.dbcp.maxWait 120000
hibernate.dbcp.maxIdle 10

## prepared statement cache

hibernate.dbcp.ps.maxActive 100
hibernate.dbcp.ps.whenExhaustedAction 1
hibernate.dbcp.ps.maxWait 120000
hibernate.dbcp.ps.maxIdle 100

# optional query to validate pooled connections:

#hibernate.dbcp.validationQuery select 1 from dual
#hibernate.dbcp.testOnBorrow true
#hibernate.dbcp.testOnReturn false

-your second thought:
hibernate.connection.url jdbc:mysql://localhost/mydbname?autoReconnect=true


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 21, 2004 5:46 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Comment out the


# optional query to validate pooled connections:

part


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 21, 2004 6:22 am 
Beginner
Beginner

Joined: Wed Aug 27, 2003 5:03 am
Posts: 34
Ok , i will try that ... let's see what it brings, thanks for the advise.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 4:37 am 
Beginner
Beginner

Joined: Wed Aug 27, 2003 5:03 am
Posts: 34
This didn't seems to help. Another error occurred:

2004-01-22 09:03:08,725 [EnergyAlert] ERROR [Thread-3] (JDBCExceptionReporter.java:46) - Communication link failure: java.io.IOException
2004-01-22 09:03:08,726 [EnergyAlert] ERROR [Thread-3] (JDBCException.java:37) - Cannot open connection

Yesterday i had a "couldn't execute query", instead of the "cannot open connection", is there somone that still have thoughts or ideas to solve this, i'm getting pretty hopeless this way.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 4:58 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
I am sure this is the classic mysql connection closing problem - this should definately solve it. Are you using a recent driver?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 5:05 am 
Beginner
Beginner

Joined: Wed Aug 27, 2003 5:03 am
Posts: 34
Yes, the most recent there is: mysql-connector-java-3.1.0-alpha-bin.jar. I started with a older version and then to this one. It was my thought as well in first, but it didn't seems to help.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 26, 2004 8:28 am 
Beginner
Beginner

Joined: Wed Aug 27, 2003 5:03 am
Posts: 34
I've seem to have found a temporarily solution to the problem.

I just made a cron job that does a request to a page where some data is requested from the database. This seems to work. I no longer loose my connection to the database. Still, this is not the final solution to the problem, it's just a work-a-round.

Another thing i discoverd is that the problem doesn't occur on my development machine (win xp pro), but only on the server where the application runs (redhat).

So this seems to be really a problem in my configuration and not in my code. I still gladly want to solve the problem, so any help is still appreciated and when i find the solution myself i'ill post it here.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 29, 2004 9:49 am 
Beginner
Beginner

Joined: Wed Aug 27, 2003 5:03 am
Posts: 34
I was talking about a temporarily solution, but after three days i can conclude this isn't also a temporarily solution, it just takes a little longer for the error occurs.

Still not someone who can help me with this ..., please.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 29, 2004 11:26 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Note that, as per the Hibernate documentation you should NEVER be using the HIbernate built-in connection pool in a production environment!


Top
 Profile  
 
 Post subject: SAme problem - Implementation
PostPosted: Thu Feb 05, 2004 12:22 pm 
Newbie

Joined: Thu Feb 05, 2004 12:02 pm
Posts: 2
Hello, i've got same problem, but i use the Thread Local Session mecanism: http://www.hibernate.org/42.html (Example #2: ThreadLocalSession). I've tansformed the example into a singleton pattern to centralize Session distribution. So my SessionFactory is created once for application's life. But when my database (mysql) restart, sessions which are in my SessionFactory's session cache is obsolete...

Trace:
Code:
2004-02-05 16:57:48,395 [JDBCExceptionReporter.http8080-Processor4] WARN - SQL Error: 0, SQLState: 08S01
2004-02-05 16:57:48,405 [JDBCExceptionReporter.http8080-Processor4] ERROR - Communication link failure: java.net.SocketException, underlying cause: Software caused connection abort: recv failed

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: Software caused connection abort: recv failed

STACKTRACE:

java.net.SocketException: Software caused connection abort: recv failed
   at java.net.SocketInputStream.socketRead0(Native Method)
   at java.net.SocketInputStream.read(SocketInputStream.java:129)
   at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
   at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
   at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1449)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1826)
   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1098)
   at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1192)
   at com.mysql.jdbc.Connection.execSQL(Connection.java:2051)
   at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1496)
   at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:62)
   at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:537)
   at net.sf.hibernate.loader.Loader.doFind(Loader.java:140)
   at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:571)
   at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42)
   at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:392)
   at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1901)
   at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1769)
   at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1700)
   at com.bzh.dlsite.metier.MetierGeneric.getItem(MetierGeneric.java:208)
   at com.bzh.dlsite.actions.AccountAction.inspect(AccountAction.java:75)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:324)
   at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
   at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:220)
   at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:446)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
   at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
   at com.bzh.dlsite.filter.AuthentificationFilter.doFilter(AuthentificationFilter.java:158)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(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.java:191)
   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(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:2417)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
   at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
   at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(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.invokeNext(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:193)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
   at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666)
   at java.lang.Thread.run(Thread.java:536)


** END NESTED EXCEPTION **


to be continued....


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 05, 2004 12:43 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
As said in this thread, use a coonection pool with validation.

And (always good to remind) note that, as per the Hibernate documentation you should NEVER be using the HIbernate built-in connection pool in a production environment!

There is no session caching in Hibernate

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.