Uploaded image for project: 'IronJacamar'
  1. IronJacamar
  2. JBJCA-1462

NullPointerException in ConnectionValidator

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.0.1.Final
    • 3.0.0
    • Core
    • None
    • Hide

      I managed to reproduce this issue by calling cls.remove(cl) first in debugger in SemaphoreConcurrentLinkedDequeManagedConnectionPool.returnForFrequencyCheck method.

      Show
      I managed to reproduce this issue by calling cls.remove(cl) first in debugger in SemaphoreConcurrentLinkedDequeManagedConnectionPool.returnForFrequencyCheck method.
    • Hide

      Switch to validate-on-match which does not produces such exception.

      Show
      Switch to validate-on-match which does not produces such exception.

      This is a follow-up of JBJCA-1362. Issue was fixed only partially there so I'm creating a new task, since I do not have permission to reopen it and we did not get response there from a few weeks.

      We have configured background-validation and sometimes it produces NPE:

      2022-10-17 15:55:14,007 WARN  [org.jboss.jca.core.connectionmanager.pool.validator.ConnectionValidator] (ConnectionValidator) IJ000602: ConnectionValidator ignored unexpected runtime exception: java.lang.NullPointerException
      	at java.base/java.util.Objects.requireNonNull(Objects.java:221)
      	at java.base/java.util.concurrent.ConcurrentLinkedDeque.linkLast(ConcurrentLinkedDeque.java:347)
      	at java.base/java.util.concurrent.ConcurrentLinkedDeque.addLast(ConcurrentLinkedDeque.java:840)
      	at org.jboss.ironjacamar.impl@1.4.23.Final//org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.returnForFrequencyCheck(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:1580)
      	at org.jboss.ironjacamar.impl@1.4.23.Final//org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.validateConnections(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:1506)
      	at org.jboss.ironjacamar.impl@1.4.23.Final//org.jboss.jca.core.connectionmanager.pool.validator.ConnectionValidator$ConnectionValidatorRunner.run(ConnectionValidator.java:285)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:829) 

      When such thing happens, connection validations breaks and we needed to restart server to make it working again.
      This code when NPE is thrown looks like this:

      private void linkLast(E e) {
          Node<E> newNode = newNode(Objects.requireNonNull(e)); 

      Also, this issue may be a sign of deeper issue, since map does not contain the listener which is still active. There are a few places where the map is updated by removing cl element. See doRemoveConnectionListenerFromPool method. Before NPE occured, I had a couple of situations when invalid connections were removed from pool. See connection-destroyed.log.txt

      Right before NPE, there were more exceptions, see: NullPointerException.log.txt

      There are more places, when NPE can be throw and they are described in comments in task JBJCA-1362 by other developers.

        1. connection-destroyed.log.txt
          4 kB
          Piotr Jówko
        2. NullPointerException.log.txt
          19 kB
          Piotr Jówko

              tadamski@redhat.com Tomasz Adamski
              pjowko Piotr Jówko (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: