Friday, April 23, 2010

Infinite Getting "Cannot open connection" error, high CPU%

I met one exception on our env recently:
2010-04-22 00:20:44,836 ERROR (WorkManager(4)-1767:)[org.hibernate.event.def.AbstractFlushingEventListener] Could not synchronize database state with session
org.hibernate.exception.JDBCConnectionException: Could not execute JDBC batch update
......
Caused by: java.sql.BatchUpdateException: I/O Error: Read timed out
at net.sourceforge.jtds.jdbc.JtdsStatement.executeBatch(JtdsStatement.java:966)


And this will cause infinite loop to get a connection, taking over 90% CPU time:
....
org.hibernate.exception.GenericJDBCException: Cannot open connection
....


after looking around the jtds site,it quoted "jTDS 1.2.3 has fixed this issue" from its release notes:

[1843801] infinite loop if DB connection dies during a batch

Seems it is exactly the bug I met!

Did not have chance to evaluate this fix, however, jtds-1.2.3 is a 2-year release after all since jtds-1.2.2.

Upgrade to latest version maybe a great choice if you met same problem.

No comments:

Post a Comment