-->
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.  [ 5 posts ] 
Author Message
 Post subject: Database loss behavior
PostPosted: Sat Jan 06, 2007 5:14 pm 
Newbie

Joined: Sat Jan 06, 2007 4:37 pm
Posts: 3
I have been testing how hibernate behavies during a LAN failure. My test is simply pull the LAN cable from the database machine and try to do a transaction. However I have not been successful in getting Hibernate to bail out and throw an exception in a timely manner. My requirement is for it to wait a maximum of 2 minutes but all of my configuration changes seem to make no difference. It doesn't seem to do anything at all until the DB is reconnected to the network. I have waited upwards of 10 minutes for any sign and it just sits there. I have attached my current config files and the stack trace of the thread that is waiting on the DB. Is there something that i am missing?

Any help would be greatly appreciated,
Kirk


Hibernate version:
3.2.0
Mapping documents:
contents of the hibernate.cfg.xml file
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.c3p0.acquire_increment">1</property>
<property name="hibernate.c3p0.idle_test_period">30</property>
<property name="hibernate.c3p0.timeout">60</property>
<property name="hibernate.c3p0.max_size">5</property>
<property name="hibernate.c3p0.max_statements">10</property>
<property name="hibernate.c3p0.min_size">3</property>
<property name="hibernate.c3p0.validate">false</property>

additionally iI have set the following parameters in the c3p0.properties file
c3p0.acquireRetryAttempts=1
c3p0.acquireRetryDelay=1000
c3p0.breakAfterAcquireFailure=false

Code between sessionFactory.openSession() and session.close():
Code:
public CSUser getUser(String aLoginId) throws DataAccessException {
   Session session = OpenHibernateSession();
   try {
      CSUser csUser = (CSUser) session.createQuery(
            "from CSUser csuser where csuser.loginID = :arg0")
            .setString("arg0", aLoginId)               
            .uniqueResult();

      return csUser;
   } catch (HibernateException e) {
      sLog.error(method + e.getMessage());
      throw new DataAccessException(e.toString());
   } finally {
      CloseHibernateSession();
   }
}

Full stack trace of any exception that occurs:
Thread [Thread-2] (Suspended)
SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int) line: not available [native method]
SocketInputStream.read(byte[], int, int) line: not available
DataPacket(Packet).receive() line: not available
DataPacket.receive() line: not available
NetInputStream.getNextPacket() line: not available
NetInputStream.read(byte[], int, int) line: not available
NetInputStream.read(byte[]) line: not available
NetInputStream.read() line: not available
T4CMAREngine.unmarshalUB1() line: 971
T4CMAREngine.unmarshalSB1() line: 941
T4C8Oall.receive() line: 432
T4CPreparedStatement.doOall8(boolean, boolean, boolean, boolean) line: 181
T4CPreparedStatement.execute_for_describe() line: 420
T4CPreparedStatement(OracleStatement).execute_maybe_describe() line: 896
T4CPreparedStatement.execute_maybe_describe() line: 452
T4CPreparedStatement(OracleStatement).doExecuteWithTimeout() line: 986
T4CPreparedStatement(OraclePreparedStatement).executeInternal() line: 2888
T4CPreparedStatement(OraclePreparedStatement).executeQuery() line: 2929
NewProxyPreparedStatement.executeQuery() line: 76
BatchingBatcher(AbstractBatcher).getResultSet(PreparedStatement) line: 186
QueryLoader(Loader).getResultSet(PreparedStatement, boolean, boolean, RowSelection, SessionImplementor) line: 1668
QueryLoader(Loader).doQuery(SessionImplementor, QueryParameters, boolean) line: 662
QueryLoader(Loader).doQueryAndInitializeNonLazyCollections(SessionImplementor, QueryParameters, boolean) line: 224
QueryLoader(Loader).doList(SessionImplementor, QueryParameters) line: 2144
QueryLoader(Loader).listIgnoreQueryCache(SessionImplementor, QueryParameters) line: 2028
QueryLoader(Loader).list(SessionImplementor, QueryParameters, Set, Type[]) line: 2023
QueryLoader.list(SessionImplementor, QueryParameters) line: 393
QueryTranslatorImpl.list(SessionImplementor, QueryParameters) line: 338
HQLQueryPlan.performList(QueryParameters, SessionImplementor) line: 172
SessionImpl.list(String, QueryParameters) line: 1121
QueryImpl.list() line: 79
QueryImpl(AbstractQueryImpl).uniqueResult() line: 780
HibernateTest.getUser(String) line: 141
HibernateTest.run() line: 74

Name and version of the database you are using:
oracle 10g
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 06, 2007 9:24 pm 
C3P0 Developer
C3P0 Developer

Joined: Tue Jan 06, 2004 8:58 pm
Posts: 145
hi... i'm on the road 'n on the run, so this is half-baked. but you might try adding c3p0.checkoutTimeout to your c3p0 config, to force cxn checkout attempts to fail if they don't succeed quickly.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 07, 2007 1:19 pm 
Newbie

Joined: Sat Jan 06, 2007 4:37 pm
Posts: 3
Thanks for the suggestion. I have tried that but my problem seems to be that the connection pool is already created and it thinks the connections are all ok. So it gets the connection successfully but when it tries to perform a transaction on that connection it just hangs there. I even tried to set the verifyOnCheckout (sp?) and the same behavior exists. It tries to validate the connection but just hangs there.

Additionally, i have tried setting timeout values for the session object and for the query object. I was certain that one of these changes would work but still I have seen no change in behavior.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 07, 2007 1:29 pm 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
I'm not sure this problem is one of Hibernate's concern. Did you try using direct jdbc with the same connection pool (c3p0 here) to see if there's a difference in behaviour?

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 07, 2007 2:13 pm 
Newbie

Joined: Sat Jan 06, 2007 4:37 pm
Posts: 3
No, I have not done that yet. It looks like that is going to have to be my next step.

Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.