Hibernate ConnectionManager.openConnection() sometimes hangs when using ON_CLOSE release mode
Issue
My application hangs on a query after a certain number of queries have been performed. Before each query I open the session, and close it immediately afterwards. Below is the end of the log. As you will see it appears to be hanging on "ConnectionManager.openConnection(444)". I have looked at the database connections and there is a normal amount (3) when it hangs so it is not as if there are excess connections hanging around. Is there something I need to configure to get hibernate to deal with a large amount of queries? It seems to cope up to a point.
DEBUG - StatefulPersistenceContext.initializeNonLazyCollections(860) | initializing non-lazy collections
DEBUG - ConnectionManager.afterTransaction(325) | transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
DEBUG - ConnectionManager.closeConnection(464) | releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
DEBUG - ConnectionManager.afterTransaction(325) | transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
DEBUG - SessionImpl.<init>(247) | opened session at timestamp: 12749669784
DEBUG - AbstractBatcher.logOpenPreparedStatement(410) | about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
DEBUG - ConnectionManager.openConnection(444) | opening JDBC connection
DEBUG - SQLStatementLogger.logStatement(111) | select ACCT001 from ACCT where ACCT029 = 'L' and ACCT011 <> 'C' and ACCT303 = '130' and ACCT014 like '%Collection%' and ACCT514 <= ? and ACCT003 = ?
Hibernate: select ACCT001 from ACCT where ACCT029 = 'L' and ACCT011 <> 'C' and ACCT303 = '130' and ACCT014 like '%Collection%' and ACCT514 <= ? and ACCT003 = ?
DEBUG - Loader.bindNamedParameters(1768) | bindNamedParameters() java.util.GregorianCalendar[time=1274828400000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/London",offset=0,dstSavings=3600000,useDaylight=true,transitions=242,lastRule=java.util.SimpleTimeZone[id=Europe/London,offset=0,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2010,MONTH=4,WEEK_OF_YEAR=21,WEEK_OF_MONTH=4,DAY_OF_MONTH=26,DAY_OF_YEAR=146,DAY_OF_WEEK=4,DAY_OF_WEEK_IN_MONTH=4,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=0,DST_OFFSET=3600000] -> startDate [1]
DEBUG - Loader.bindNamedParameters(1768) | bindNamedParameters() WF -> portfolio [2]
DEBUG - AbstractBatcher.logOpenResults(426) | about to open ResultSet (open ResultSets: 0, globally: 0)
DEBUG - AbstractBatcher.logCloseResults(433) | about to close ResultSet (open ResultSets: 1, globally: 1)
DEBUG - AbstractBatcher.logClosePreparedStatement(418) | about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
DEBUG - StatefulPersistenceContext.initializeNonLazyCollections(860) | initializing non-lazy collections
DEBUG - ConnectionManager.afterTransaction(325) | transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
Row: 1.006366E7
break
DEBUG - SessionImpl.<init>(247) | opened session at timestamp: 12749669784
DEBUG - AbstractBatcher.logOpenPreparedStatement(410) | about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
DEBUG - ConnectionManager.openConnection(444) | opening JDBC connection
Environment
- Hibernate
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
