book
Article ID: KB0090015
calendar_today
Updated On:
Description
Resolution:
Description:
=========
When the max connection of the JDBC connection resource is set to 1 and one working thread that requires two connections, in this case, there is no available JDBC connection for the working thread will result in the BE engine hanging without throwing any error. Note that when using Oracle as the backing store, it will throw an error like "java.lang.RuntimeException: Connections are unavailable, increase the max pool size or wait timeout Database may be disconnected".
Environment:
==========
TIBCO BusinessEvents - 4.x, 5.x
OS – All
SQL Server Database
Cause:
======
The different behaviours in Oracle and MS SQL are due to the way "connection wait timeout interval" is interpreted by their respective pools. For Oracle the DataSource bound to the pool defaults to 0 (as per the API spec) when no timeout interval is specified. Here 0 is no timeout at all. While the way our implementation of MS SQL server is, it defaults to -1 if no wait timeout is specified. In such a case, we decide to wait forever until a connection is available in the pool.
In the case of Oracle, the 2nd call to create a connection returns back immediately (timeout = 0) but no connection is found since max connection limit is already reached (during the first connection creation). Hence an exception is thrown.
While in case of MS SQL server, the wait for getting the connection is forever (timeout = -1). In this case it's more like a deadlock. Where the 2nd create connection is waiting for a connection to be available the 1st connection can be released only once the RTC completes, which in turn is blocked on the 2nd create connection call.
Resolution:
============
You can use either of the following two solutions:
1). Setting the default timeout for MS SQL server to 0 as well similar to that of Oracle.
2). You can add property "be.dbconcepts.pool.waitTimeout" in your cdd, specify time in seconds. When it cannot get any available connections in the time interval specified, you will catch an exception.
Issue/Introduction
TIBCO BusinessEvents engine hangs without throwing any error if there is no more available JDBC connections for the working thread when using SQL Server database as the backing store.