1 Reply Latest reply on Feb 23, 2019 4:51 AM by mayerw01

    What exactly does an datasource exception-sorter?

    rsoika

      I have a strange problem with one of my PostgreSQL servers providing datasources for several Web Applications running on Wildfly 13.

      My typical datasource looks like this

       

      ....

      <datasource jta="true" jndi-name="java:/jdbc/office" pool-name="office" enabled="true" use-ccm="true">

          <connection-url>${env.POSTGRES_CONNECTION}</connection-url>

          <driver-class>org.postgresql.Driver</driver-class>

          <driver>postgresql</driver>

          <security>

              <user-name>${env.POSTGRES_USER}</user-name>

              <password>${env.POSTGRES_PASSWORD}</password>

          </security>

           <validation>

              <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>

              <background-validation-millis>60000</background-validation-millis>

          </validation>               

      </datasource> 

      ...

       

      Since I am using this kind of configuration, I recognized a lot of exceptions in my wildfly log files looking like this:

       

      javax.resource.ResourceException: IJ031084: Unable to create connection
      ....
      Caused by: org.postgresql.util.PSQLException: ERROR: pgbouncer cannot connect to server
      ...
      07:39:37,581 ERROR [stderr] (default task-227) javax.ejb.EJBTransactionRolledbackException: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException
      07:39:37,581 ERROR [stderr] (default task-227) Internal Exception: java.sql.SQLException: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/jdbc/office
      07:39:37,581 ERROR [stderr] (default task-227) Error Code: 0
      ........

       

      I figured out, that after I added a 'exception-sorter' into my  validation tag:

       

      <validation>

              <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>

              <background-validation-millis>60000</background-validation-millis>

             <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"></exception-sorter>

      </validation> 

       

      ...no more connection failures are logged by wildfly.

       

      But the problem is not the log file from wildfly, but the PostgreSQL server connected to wildfly. We observe, that on wildfly servers using a datasource connection without the exception-sorter the PostgreSQL server dies after some days. And only a reboot of the postgreSQL Server solves the problem. We do not really find any useful log messages on PostgreSQL. I also do not really know if the datasource configuration is related to the server crash.

       

      So my question is now: What is the exception-sorter good for? And is the behavior of the valid-connection-checker different if a 'exception-sorter' is added or not?

      Is it possible that my wildfly servers, which do not configure an exception-sorter, are sending to much 'pings' to my PostgreSQL server?

       

      I know my error description is a little bit sparsely. But I am open to all kinds of ideas.

       

       

      ===

      Ralph