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

Thread safety issues in AbandonedTrace class

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.3
    • None

    Description

      DBCP-270 implies that the AbandonedTrace class is called from multiple threads, however it is not thread-safe:

      • SimpleDateFormat is not threadsafe, but it is called without protection.
      • various instance fields need to be made final to ensure that they are published correctly (memory visibility)
      • getLastUsed/setLastUsed need to be synchronized - or better, createdBy made volatile so printStackTrace can access the variable safely
        (createdBy is rewritten, not updated, so lost updates are not important)

      Also, the Javadoc for printStackTrace() is wrong.

      Attachments

        Activity

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: