Subject Re: [Firebird-Java] Invalid connection after JBoss IdleRemover-Action (NPE)
Author Uno Engborg
Josef Gschwendtner wrote:

>Hi,
>
>one of our customers is getting sporadically NullPointerExceptions
>(which last for a certain period).
>
>To avoid the great number of NPE's we have changed methode
>isc_start_transaction in Jaybird to log a message on db.out == null and
>throw an exception afterwards. This has improved the situation because
>instead of many NPE's we get one exception and afterwards the program
>works as expected, again.
>
>One of our customers had this fault-situation (db.out == null) 5 times
>last week. We found out, that the situation always occures immediately
>after the JBoss IdleRemover-thread was active and probably has freed a
>connection which was used by another thread (also the situation occures
>not each time the IdleRemover-thread was active).
>We think there might be a synchronisation problem.
>
>Another customer runs the same program without any problems.
>Both custumers use RedHat 7.2.
>- Customer with problems uses kernel 2.4.20-28 (the newer one)
>- Customer without problems uses kernel 2.4.7-108
>
>Other Conditions:
>- Software: Java 1.4.2_03, JBoss 3.2.3, Jaybird 1.5.5
>- Hardware: Dual Xeon CPU (3,06 GHz), 2 GB RAM
>
>

At the end of your firebird.ds there is a setting where you make some
simple query to test the connection.
Have you tried that? The connetionion factory would look something like
this with an added
query "select * from testconnection" that should be very fast to perfom


<tx-connection-factory>

<jndi-name>FirebirdDS</jndi-name>

<xa-transaction/>

<rar-name>firebirdsql.rar</rar-name>
<connection-definition>javax.sql.DataSource</connection-definition>

<config-property name="Database"
type="java.lang.String">localhost/3050:/jboss-4.0.0/server/all/data/jbossfirbird.gdb</config-property>

<user-name>sysdba</user-name>

<password>masterkey</password>

<!--additional properties. only use one way of setting tx isolation,
please
<config-property name="TransactionIsolation"></config-property>
<config-property
name="TransactionIsolationName">TRANSACTION_READ_COMMITTED</config-property>
<config-property name="BlobBufferLength"></config-property>
<config-property name="Encoding">UNICODE_FSS</config-property>
-->

<min-pool-size>10</min-pool-size>
<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>
-->

<!-- sql to call on an existing pooled connection when it is
obtained from pool
<check-valid-connection-sql>some arbitrary
sql</check-valid-connection-sql>
-->
<check-valid-connection-sql>select * from
testconnection</check-valid-connection-sql>

<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml
(optional) -->
<metadata>
<type-mapping>Firebird</type-mapping>
</metadata>
</tx-connection-factory>

Regards
Uno Engborg



[Non-text portions of this message have been removed]