-->
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.  [ 3 posts ] 
Author Message
 Post subject: java.net.SocketException: Connection reset exception
PostPosted: Fri Aug 28, 2009 6:07 am 
Regular
Regular

Joined: Fri May 22, 2009 4:50 am
Posts: 59
hi,

I'm using Spring managed Hibernate session in my application and I am using Postgres database. Under load testing, often I get the java.net.SocketException: Connection reset exception as shown below.
Exception in not very consistent. Sometimes I get it after 50 inserts and sometimes I get it after 500 inserts.

I googled lot about the following exception. One of the concerns raised was, if the connections opened were closed as leaving many open connectios will also lead to such an exception.
but since I am using Spring managed Hibernate session, I dont open or close any connection explicitly. So i am unaware of the status of connections.
Also from stacktrace I don't see any particular reason which might lead to this exception.
Does any one know the answer for this?

------------------------------------------------
11:37:20.358 [QFJ Message Processor] WARN o.h.util.JDBCExceptionReporter SQL Error: 0, SQLState: 08001
11:37:20.358 [QFJ Message Processor] ERROR o.h.util.JDBCExceptionReporter The connection attempt failed.
11:37:20.360 [QFJ Message Processor] WARN o.h.util.JDBCExceptionReporter SQL Error: 0, SQLState: 08001
11:37:20.360 [QFJ Message Processor] ERROR o.h.util.JDBCExceptionReporter The connection attempt failed.
11:37:20.366 [QFJ Message Processor] ERROR o.h.e.d.AbstractFlushingEventListener Could not synchronize database state with session
org.hibernate.exception.JDBCConnectionException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:97) [hibernate-3.3.1.GA.jar:na]
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) [hibernate-3.3.1.GA.jar:na]
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52) [hibernate-3.3.1.GA.jar:na]
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449) [hibernate-3.3.1.GA.jar:na]
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167) [hibernate-3.3.1.GA.jar:na]
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:116) [hibernate-3.3.1.GA.jar:na]
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:109) [hibernate-3.3.1.GA.jar:na]
at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:244) [hibernate-3.3.1.GA.jar:na]
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2252) [hibernate-3.3.1.GA.jar:na]
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2688) [hibernate-3.3.1.GA.jar:na]
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79) [hibernate-3.3.1.GA.jar:na]
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279) [hibernate-3.3.1.GA.jar:na]
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263) [hibernate-3.3.1.GA.jar:na]
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167) [hibernate-3.3.1.GA.jar:na]
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) [hibernate-3.3.1.GA.jar:na]
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50) [hibernate-3.3.1.GA.jar:na]
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027) [hibernate-3.3.1.GA.jar:na]
at org.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:390) [spring-2.5.4.jar:2.5.4]
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:420) [spring-2.5.4.jar:2.5.4]
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374) [spring-2.5.4.jar:2.5.4]
at org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:744) [spring-2.5.4.jar:2.5.4]
at com.tsdevelopment.fmk.persist.hibernate.dao.impl.ExecutionReportDaoImpl.storeExecutionReport(ExecutionReportDaoImpl.java:18) [fi-link-fix-1.0.jar:na]
at com.tsdevelopment.fmk.fix.ExecutionReportHandler.persistExecutionReport(ExecutionReportHandler.java:23) [fi-link-fix-1.0.jar:na]
at com.tsdevelopment.fmk.fix42.ExecutionReportHandler.processExecutionReportMessage(ExecutionReportHandler.java:63) [fi-link-fix-1.0.jar:na]
at com.tsdevelopment.fmk.fix42.ExecutionReportHandler.access$0(ExecutionReportHandler.java:41) [fi-link-fix-1.0.jar:na]
at com.tsdevelopment.fmk.fix42.ExecutionReportHandler$MessageHandler.onMessage(ExecutionReportHandler.java:122) [fi-link-fix-1.0.jar:na]
at quickfix.fix42.MessageCracker.crack42(MessageCracker.java:326) [quickfixj-1.4.0.jar:1.4.0]
at quickfix.fix42.MessageCracker.crack(MessageCracker.java:259) [quickfixj-1.4.0.jar:1.4.0]
at com.tsdevelopment.fmk.fix42.ExecutionReportHandler.$(ExecutionReportHandler.java:104) [fi-link-fix-1.0.jar:na]
at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source) [na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [na:1.6.0_13]
at java.lang.reflect.Method.invoke(Method.java:597) [na:1.6.0_13]
at com.miriamlaurel.pms.listeners.dispatch.DispatchListener.invoke(DispatchListener.java:171) [miriamlaurel-pms-1.0.jar:na]
at com.miriamlaurel.pms.listeners.dispatch.DispatchListener.processMessage(DispatchListener.java:111) [miriamlaurel-pms-1.0.jar:na]
at com.tsdevelopment.fmk.fix42.ExecutionReportHandler.processMessage(ExecutionReportHandler.java:36) [fi-link-fix-1.0.jar:na]
at com.miriamlaurel.pms.listeners.MessageListenerDelegate.processMessage(MessageListenerDelegate.java:40) [miriamlaurel-pms-1.0.jar:na]
at com.tsdevelopment.fmk.fix42.SessionManager.fromApp(SessionManager.java:164) [fi-link-fix-1.0.jar:na]
at quickfix.Session.fromCallback(Session.java:1361) [quickfixj-1.4.0.jar:1.4.0]
at quickfix.Session.verify(Session.java:1314) [quickfixj-1.4.0.jar:1.4.0]
at quickfix.Session.verify(Session.java:1390) [quickfixj-1.4.0.jar:1.4.0]
at quickfix.Session.next(Session.java:796) [quickfixj-1.4.0.jar:1.4.0]
at quickfix.mina.SingleThreadedEventHandlingStrategy$SessionMessageEvent.processMessage(SingleThreadedEventHandlingStrategy.java:107) [quickfixj-1.4.0.jar:1.4.0]
at quickfix.mina.SingleThreadedEventHandlingStrategy.block(SingleThreadedEventHandlingStrategy.java:70) [quickfixj-1.4.0.jar:1.4.0]
at quickfix.mina.SingleThreadedEventHandlingStrategy$1.run(SingleThreadedEventHandlingStrategy.java:87) [quickfixj-1.4.0.jar:1.4.0]
at java.lang.Thread.run(Thread.java:619) [na:1.6.0_13]
Caused by: org.postgresql.util.PSQLException: The connection attempt failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:137) [postgresql-8.3-603.jdbc3.jar:na]
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66) [postgresql-8.3-603.jdbc3.jar:na]
at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:124) [postgresql-8.3-603.jdbc3.jar:na]
at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30) [postgresql-8.3-603.jdbc3.jar:na]
at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24) [postgresql-8.3-603.jdbc3.jar:na]
at org.postgresql.Driver.makeConnection(Driver.java:386) [postgresql-8.3-603.jdbc3.jar:na]
at org.postgresql.Driver.connect(Driver.java:260) [postgresql-8.3-603.jdbc3.jar:na]
at java.sql.DriverManager.getConnection(DriverManager.java:582) [na:1.6.0_13]
at java.sql.DriverManager.getConnection(DriverManager.java:154) [na:1.6.0_13]
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:281) [spring-2.5.4.jar:2.5.4]
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:269) [spring-2.5.4.jar:2.5.4]
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:253) [spring-2.5.4.jar:2.5.4]
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:234) [spring-2.5.4.jar:2.5.4]
at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:82) [spring-2.5.4.jar:2.5.4]
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446) [hibernate-3.3.1.GA.jar:na]
... 41 common frames omitted
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168) [na:1.6.0_13]
at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:135) [postgresql-8.3-603.jdbc3.jar:na]
at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:104) [postgresql-8.3-603.jdbc3.jar:na]
at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73) [postgresql-8.3-603.jdbc3.jar:na]
at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:259) [postgresql-8.3-603.jdbc3.jar:na]
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:254) [postgresql-8.3-603.jdbc3.jar:na]
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:95) [postgresql-8.3-603.jdbc3.jar:na]
... 55 common frames omitted

Any comments are welcomed..

Cheers!


Top
 Profile  
 
 Post subject: Re: java.net.SocketException: Connection reset exception
PostPosted: Tue Jul 12, 2011 4:38 pm 
Newbie

Joined: Tue Jul 12, 2011 4:36 pm
Posts: 2
I have the same error.

Does anyone knows the solution?


Top
 Profile  
 
 Post subject: Re: java.net.SocketException: Connection reset exception
PostPosted: Wed Feb 18, 2015 3:03 pm 
Newbie

Joined: Wed Feb 18, 2015 3:02 pm
Posts: 2
I am having the same issue. Did anyone find out the solution?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

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.