Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-476

AbandonedTrace.getTrace() contains race condition

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 2.3.0
    • None

    Description

      The clean up code in AbandonedTrace is subject to the reference being cleared in between the condition being checked and the referent being added to the result.

                  while (iter.hasNext()) {
                      WeakReference<AbandonedTrace> ref = iter.next();
                      if (ref.get() == null) {
                          // Clean-up since we are here anyway
                          iter.remove();
                      } else {
                          result.add(ref.get());
                      }
                  }
      

      This can surface as a NullPointerException, e.g.

      Caused by: java.lang.NullPointerException
      	at org.apache.tomcat.dbcp.dbcp2.DelegatingStatement.close(DelegatingStatement.java:149)
      

      Attachments

        Activity

          People

            pascalschumacher Pascal Schumacher
            rcordova Richard Cordova
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: