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

AbandonedTrace.getTrace() contains race condition

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3.0
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: