IBM - Application hangs with previous J2CA0086W warning messages: "Application hangs with previous J2CA0086W warning messages STATE_TRAN_WRAPPER_INUSE
Technote (FAQ)
Problem
An application seems to be in a hang state while trying to connect to database. The logs show several ConnectionWaitTimeoutExceptions as well as other errors referring to problems obtaining free connections from the pool. Before occurrences of hang there are repeated J2CA0086W warning messages and the connection pool is at a maximum.
Cause
A warning message similar to the one below is observed in the logs before the hang occurs:
[8/19/03 21:37:53:366 CST] 1c86bdf0 SharedPool I J2CA0086W: Shareable connection MCWrapper id 686bbdf9 Managed connection com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl@6156bdf9
State:STATE_TRAN_WRAPPER_INUSE
The message reference contains the following explanation of this message:
J2CA0086W: Shareable connection {0} from resource {1} was used within a local transaction containment boundary.
Explanation: Shareable connections are not allowed within a local transaction containment boundary.
User Response: Connection was made non-shareable.
The above scenario suggests a possible problem in the application logic and how it is using the connection code. The J2CA0086 message is telling you that your application is using a shared connection in a LocalTransaction. Since the connection is enlisted in a Local Transaction, and not a Global Transaction, different rules are followed when it comes to connection sharing. The connection usage has to follow the pattern shown below:
get connection,
use connection,
close connection,
commit transaction
then the connection can be used again. If this logic is not followed, a second (or third) connection can be allocated.
For example, if the application calls getConnection() method it gets connection1, uses connection1, then, if it calls getConnection() method again and connection1 is not ready to be reused, connection2 is obtained. Both connections remain in the shared pool and both are associated with the Local Transaction, until the Local Transaction ends (is committed or rolled back, or the method ends).
This can result in more connections being created than is expected, which is why the application is reaching the maximum connections, and getting ConnectionWaitTimeoutExceptions among others). This can cause a hang if the pool is at a maximum, and none of the threads that have connections can complete because they are waiting to get another connection.
Solution
There are two solutions to this problem:
The application must be modified to use serial reuse
or
The maximum number of connections must be increased (you can use 0, which means infinite connections).
In general you will see better performance with a lower number of connections, so the best solution to the problem is to make sure that the application closes its connections when it's done using them If it needs another connection later, it calls getConnection again (the connection pool caches the physical connection and allows it to be reused, so the performance hit is less than leaving the connections open).
STATE_TRAN_WRAPPER_INUSE J2CA0086W
Sunday, January 30, 2005
Subscribe to:
Post Comments (Atom)
Popular Posts
- Linux Forum: Apache, Webmin and Mandrake - Linux Operating System Help
- Yahoo! Mail: Revenge of the Oddpost
- Free AS400 & iSeries Software Tools & Utilities Downloads
- Fast-track your Web apps with Ruby on Rails
- The Laughing Boardroom video...a real world example!
- Basic Requirements of a JavaServer Faces Application
- UDATE and *DATE in AS400 RPG
- IBM eServer iSeries - The Laughing Boardroom
- Creating an as400 Query
- AS400 APIs
No comments:
Post a Comment