Oracle Streams AQ. session.getQueue throwing AQOracleSQLException: Exhausted Resultset
Using Oracle Streams AQ in a multithreaded/multi-app environment I received an AQOracleSQLException
: Exhausted Resultset after about 10 minutes of operation in one thread only.
oracle.AQ.AQOracleSQLException: Exhausted Resultset
at oracle.AQ.AQOracleSession.getQueue(AQOracleSession.java:751)
at au.com.xxx.queue.OracleQueue$$anonfun$2.apply(OracleQueue.scala:53)
The AQOracleSession
is pooled via Spring as follows:
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jdbc/MessageManagerDB"/>
</bean>
<bean id="aqSessionFactory" class="au.com.xxx.queue.AQSessionFactory">
<constructor-arg ref="dataSource"/>
</bean>
<bean id="aqSessionTarget" factory-bean="aqSessionFactory"
factory-method="createAQSession" scope="prototype"/>
<bean id="aqSessionPoolTargetSource"
class="org.springframework.aop.target.CommonsPoolTargetSource">
<property name="targetBeanName" value="aqSessionTarget"/>
<property name="maxSize" value="25"/>
</bean>
<bean id="aqSession" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="targetSource" ref="aqSessionPoolTargetSource"/>
</bean>
With the factory method createAQSession
being (in Scala):
def createAQSession = {
val wasConnection = dataSource.getConnection.asInstanceOf[WSJdbcConnection]
val connection = WSCallHelper.getNativeConnection(wasConnection).asInstanceOf[Connection]
SessionWithConnection(AQDriverManager.createAQSession(connection), connection)
// SessionWithConnection is just a case class akin to
// Tuple2[AQOracleSession, Connection]
}
The exception was thrown from the final line of the this block:
def sessionAndConnection = {
applicationContext.getBean("aqSession").asInstanceOf[SessionWithConnectionI]
}
def write(category: String, relatedId: Option[String], payload: String): Array[Byte] = {
val (session, conn) = {
val sc = sessionAndConnection
(sc.session, sc.connection)
}
val queueDef = dao.queueForWriting(category, relatedId).map{_.name}
val queue = queueDef.map{name => session.getQueue("QUSR", name)}
Obviously, I am not directly handling the ResultSet
used within AQOracleSession
.
I am using the Connection
associated with the Session
, but this is not until later in the same method, and so can't be at fault here:
val clob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION)
Is it possible that the pooling config is not correct and there was some concurrent operations on the sa开发者_JS百科me session? There was nothing unusual in the other logs at all.
This is a defect with the v10 driver, which I was using by mistake. v11 RDBMS driver does not have this problem.
精彩评论