[jboss-jira] [JBoss JIRA] (JBJCA-1347) NullPointerException in SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:441

Brett Delle Grazie (JIRA) issues at jboss.org
Thu Apr 20 17:46:00 EDT 2017


Brett Delle Grazie created JBJCA-1347:
-----------------------------------------

             Summary: NullPointerException in SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:441
                 Key: JBJCA-1347
                 URL: https://issues.jboss.org/browse/JBJCA-1347
             Project: IronJacamar
          Issue Type: Bug
    Affects Versions: WildFly/IronJacamar 1.3.2.Final
         Environment: CentOS 6
Wildfly 10.0.0.Final (Iron Jacamar 1.3.2.Final)
PostgreSQL Server 9.5.5
PostgreSQL JDBC driver 9.4.1208 and tried with 42.0.0
Oracle Java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)

            Reporter: Brett Delle Grazie


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:
{code:xml}
<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>
{code}

And corresponding driver configuration:
{code:xml}
<driver name="postgresql" module="org.postgresql">
  <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
{code}

we have deployed the JDBC driver as a module, module.xml looks like:
{code:xml}
<?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>
{code}



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list