-
Bug
-
Resolution: Done
-
Major
-
None
-
WildFly/IronJacamar 1.3.2.Final
-
None
-
None
Using a PostgreSQL XA datasource with statistics enabled we get a NullPointerException if the connection fails temporarily.
With JDBC driver 9.4.1208 Wildfly never reconnects to the PostgreSQL server with the next request and Wildfly must be restarted. With JDBC driver 42.0.0 it does reconnect on next request.
If statistics are disabled, the NPE does not occur and both drivers reconnect on the next request as expected.
Specific location of NPE:
https://github.com/ironjacamar/ironjacamar/blob/ironjacamar-1.3.2.Final/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/SemaphoreConcurrentLinkedDequeManagedConnectionPool.java#L441
Note there is similar code on line 461 of the same class (in the exception handler)
Example configuration follows
With a PostgreSQL datasource configured in Wildfly as:
<xa-datasource jndi-name="java:/DS.people" pool-name="DS.people" enabled="true" spy="true" statistics-enabled="true" use-java-context="true" use-ccm="true"> <driver>postgresql</driver> <xa-datasource-property name="ServerName">localhost</xa-datasource-property> <xa-datasource-property name="PortNumber">5432</xa-datasource-property> <xa-datasource-property name="DatabaseName">peopleviewstore</xa-datasource-property> <xa-datasource-property name="ApplicationName">people</xa-datasource-property> <xa-datasource-property name="assumeMinServerVersion">9.5</xa-datasource-property> <xa-datasource-property name="connectTimeout">10</xa-datasource-property> <xa-datasource-property name="currentSchema">public</xa-datasource-property> <xa-datasource-property name="hostRecheckSeconds">10</xa-datasource-property> <xa-datasource-property name="loginTimeout">10</xa-datasource-property> <xa-datasource-property name="logUnclosedConnections">true</xa-datasource-property> <xa-datasource-property name="socketTimeout">30</xa-datasource-property> <xa-datasource-property name="targetServerType">master</xa-datasource-property> <xa-datasource-property name="tcpKeepAlive">true</xa-datasource-property> <xa-pool> <min-pool-size>0</min-pool-size> <initial-pool-size>0</initial-pool-size> <max-pool-size>10</max-pool-size> <allow-multiple-users>false</allow-multiple-users> </xa-pool> <timeout> <xa-resource-timeout>0</xa-resource-timeout> </timeout> <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> <statement> <track-statements>true</track-statements> </statement> <security> <user-name></user-name> <password></password> </security> <validation> <validate-on-match>true</validate-on-match> <use-fast-fail>true</use-fast-fail> <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/> <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/> </validation> </xa-datasource>
And corresponding driver configuration:
<driver name="postgresql" module="org.postgresql"> <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class> </driver>
we have deployed the JDBC driver as a module, module.xml looks like:
<?xml version="1.0" ?> <module xmlns="urn:jboss:module:1.3" name="org.postgresql" slot="main"> <resources> <resource-root path="postgresql-42.0.0.jar"/> </resources> <dependencies> <module name="javax.api"/> <module name="javax.transaction.api"/> </dependencies> </module>
- duplicates
-
JBJCA-1310 NPE when validating database connection (and the validation failed) if connection pool statistics is enabled
- Closed