I'm working on an Application running on Weblogic Server 11g. This app executes a query on an Oracle 11g database ...
The problem is that this query returns millions of records ... and the app fetches the results during tens of minutes.
We would like to set a timeout, wich will abandon the transaction, hang the database connection, destroy the socket ... or anything else ...
This timeout will prevent the thread to become in STUCK state and stucking the weblogic managed server.
Is this possible ?
Thank's for your answers.
Edited by: 966918 on 10 avr. 2013 07:18
Is there something you can do for the architecture of the application,
so it doesn't do that?
The quickest way to handle this is to configure the WebLogic DataSource
with a query timeout value. Every statement made from a WLS datasource
connection will become subject to that (via the Statement.setQueryTimeout()
call). If a statement goes over the limit, it should stop and throw an exception,
which will usually result in ending the transaction.
Thank's ... But
We tried to set the statement timeout, but it seems it's a timeout for the execution of the query ... not for the fetching of the results.
We also tried to set oracle.jdbc.readtimeout=50000 but this timeout occurs only if there's no data transfered through the socket during 50s.
Our problem is that there are data transfered through the socket, millions of records ... we want to break this processing when it spend more of 50s for example ...
I see. You can set a JTA transaction timeout, if this is a WebLogic-mediated transaction, and
whatever the application is doing, it will be interrupted and the result set processing should
be halted as well. Do you have any means to alter the JDBC code?
We set the the JTA transaction timeout to 30s ... but it had no effect.
There's another timeout named "Abandon timeout" ... now, it's set to 24 hours ... Does setting this timeout to 50s will solve my problem ?
Edited by: 966918 on 11 avr. 2013 00:50
Abandon timeout will not help. That is only used if a database crashes during the second phase of commit. It specifies how long the transaction manager should keep trying to complete the transaction.
JTA timeout will only work if you are using XA datasources and two-phase commit transactions. When the timeout occurs, it guarantees that the transaction cannot be committed. Eventually, all of the participant resources will be notified and will not allow any more work to take place on the transaction. It does not stop the threads and the application must be written to handle exceptions appropriately.
Edited by: Steve Felts on Apr 17, 2013 8:32 AM