Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Stale connection exception...  RSS feed

 
Kirk Pattinson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(Thank you in advance to anyone that can help with this problem)

OK - we are currently running our application server environment as follows:
Windows 2000 Server sp3
SQL Server 2000 sp3
Websphere 4.0.4
Data direct JDBC driver version 3.1
Intel hardware platform
We have a number of BMP entity beans within the system.
We have no Session beans, instead we have straight java acting as the client to the entity beans, we also have a number of servlets that act as our entity bean clients.
With a sequential transaction test, the system will stay up for days. Our problems arise when we attempt to test the system with a number of concurrent connections.
The system will start up and continue to run for a length of time (this may be up to an hour for heavy volume testing). Over this time a number of StaleConnectionExceptions can be seen in the stdout trace file of Websphere. These are also picked up and reported by our code at the point when the connection is used for the first time after being got from the pool.
Initially the system recovers from these stale connections with no impact on performance.

Over time the number of stale connection exceptions increases, to a point where the system grinds to a halt.
The only recovery from the system is a restart of SQL Server, MSDTC and Websphere, and on occasion the whole server needs to be restarted.
We have used a number analysis tools, including the IBM performance analyzing tool. We can see that we are returning all connections to the pool, and the data source analysis does not show anything untoward. The memory footprint of the JVM does seem to be increasing - but is not reaching anywhere near a critical level.
We have been chasing our tails on this for some time now - it looks to us as though it is either a Websphere configuration thing, a bug in Websphere or a problem with either the JDBC driver or SQL Server itself.
If anyone can offer any advice - or if anyone else is having a similar problem please let me know,
Many thanks
 
asharaf kk
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Stale connection exception occurs when the connection taken from the pool is not a valid one.link between ur app server and SQL server might have broken due to network problem.ayway websphere will take care of stale connection once its caught.
I guess your problem is due to a dead lock in sql server.ie u may be accessing same resources using different connections. but the isolation level is not allowing them to access others resource. so natuarally the applicaion seems like hanged (but actually its waiting for the resources indefinitely !).
refer ms site for more info on handling deadlocks.
note:
1.use trasaction isolation level according to your need.
2.set querytimeout for the connectin.
HTH,
asharaf
 
David Harbige
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure I agree with you there, Asharaf.
websphere will take care of stale connection once its caught.

Yes, normally WebSphere will catch whatever exception is thrown by the JDBC driver, and if this exception is mapped as recoverable, will re-throw it as a StaleConnectionException. If configured to do so, it will also terminate all other connections in the Connection Pool, and re-create them. This allows an application to recover from a temporary outage of the database server.
However, these StaleConnectionExceptions should not re-occur, and should not occur at all if connections are constantly in use.
I guess your problem is due to a dead lock in sql server

Deadlocks in SQL server are automatically detected by the database, and one of the deadlocked processes is terminated and automatically rolled back. This should not show up as a StaleConnectionException.
Dredging the 'net shows a few questions raised regarding StaleConnections appearing in unusual circumstances. Does anybody know of any known issues with WebSphere's connection pooling implementation, or has anybody else experienced StaleConnections in unexplainable circumstances?
 
Nitzan Levi
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i would check the database driver , or check if the data base is active the all time .
if you can ,install another database db2 for example ,and test if the problem accur , then it would help you to decide if the problem is within the WAS implementation .
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!