Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-3401

Removing a ConnectionEventListener from a PooledConnection during its connectionClosed() callback causes other ConnectionEventListener callbacks to be missed

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 10.4.1.3
    • Fix Version/s: 10.4.2.0, 10.5.1.1
    • Component/s: JDBC
    • Labels:
      None

      Description

      A ConnectionEventListener should be able to remove itself as a listener during a callback without affecting any other callbacks.

      DataSourceTest.subtestPooledRemoveListenerOnClose() tests the scenario but calls to it will be commented out in the fixture testPooledReuseOnClose() (using this bug number).

      Issue is that such a remove will modify the eventListener Vector in EmbedPooledConnection while it is being enumerated over.
      An idea for a fix would be to first change the Vector over to a new-style collection, such as an implementation of List, then work off a copy of the collection when calling the callbacks. I don't think eventListener needs to be a synchronized collection, its access should be already synchronized on EmbedPooledConnection.

      I imagine that a similar issue exists for adding a new callback during callback processing, fixing this bug would fix that issue as well though no tests have been written for the add case.

        Attachments

        1. d3401-connection_events.diff
          14 kB
          Knut Anders Hatlen
        2. d3401-connection_events.stat
          0.2 kB
          Knut Anders Hatlen
        3. d3401-statement_events.diff
          23 kB
          Knut Anders Hatlen
        4. d3401-statement_events.stat
          0.4 kB
          Knut Anders Hatlen

          Issue Links

            Activity

              People

              • Assignee:
                knutanders Knut Anders Hatlen
                Reporter:
                djd Daniel John Debrunner
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: