Wednesday, January 15, 2014

"Close Connection" - WsApp Container - First invocation


In my application I encountered one strange issue with the WsApp container. PFB the scenario:
  • WsApp Container is in running state from past few days. However no request has been sent to it.
  • Today, I executed a webservice to get data from the Database (Oracle 10g - JDBC thin driver)
  • Error thrown by the WsApp container "java.lang.NullPointerException" (Complete logs attached)
  • I again executed the same webservice and it was successful.
I found two statement in the logs interesting: 

[Method - getErrorFromSQLException:- Error happened is identified as Connection failure error Closed Connection]

[Method - executeQueryStatement():-  FAILED SQLException is Closed Connection]

I suspect there is some "idle" time settings in WsApp container after which the connection is closed if no request is process for that particular period. 

But my question is why it is not able to re-establish the connection for the first request??

Please guide me on this if you have encountered this kind of issue.

-- Amit Kumar DH

Cordys caches connections using Connection Pool and reuses them.

While executing a query on database, Cordys takes a connection from connection pool and processes it.

1)If a connection is killed by database, Cordys will be able to recognize the connection failure and reconnects to database and process the request.

2)But if connection is killed by firewall, Cordys will not get any exception when used it from pool so the connection will hang.

Default refresh interval rate for clearing the connections is 3600 sec.

Though firewall killed the connection, Cordys will remove the connection from the connection pool only after 3600 sec.

As the point specifies, "If you are using connection caching or connection pooling, then always set the inactivity timeout value on the connection cache to be shorter than the firewall idle timeout value",

If the firewall idle timeout value is set to 3000 sec, after that time, firewall will remove the connection from the connection pool.

And the default database connection refresh interval set at service container is 3600 sec.

So, in between this time, if any new request comes to service container, and if no connections are available, the service container will be in hanging state, which will not respond to the request.

After 3600 sec only, Cordys will remove the connection from the connection pool.

So by setting Connection Cache refresh interval to less than firewall idle timeout will prevent this situation from occuring.

We have suggested you regarding the inactivity timeout. For other points, you need to go as per Oracle suggests.

-- Cordys Support Team

No comments:

Post a Comment