Derby
  1. Derby
  2. DERBY-5705

Authorization decorators don't null out connections when done

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.9.1.0
    • Fix Version/s: 10.9.1.0
    • Component/s: Test
    • Labels:
      None

      Description

      Some decorators used to test authorization don't close and null out references to Connection objects when they have completed. Since these tests often create/boot single-use databases, and the Connection objects have references to the database instance and, directly or indirectly, many of its modules, this prevents much garbage from being removed from the heap after the tests have completed and shut down their single-use databases. We should close the default connection and clear the reference to it when tearing down these decorators, so the space is released for subsequent tests to use.

      This problem affects decorators returned by the following methods:

      DatabasePropertyTestSetup.builtinAuthenticationNoTeardown()
      TestConfiguration.sqlAuthorizationDecorator()
      TestConfiguration.sqlAuthorizationDecoratorSingleUse()

      These methods return modified versions of DatabasePropertyTestSetup where the tearDown() method is a no-op.

      1. d5705-1a.diff
        4 kB
        Knut Anders Hatlen

        Activity

        Knut Anders Hatlen created issue -
        Knut Anders Hatlen made changes -
        Field Original Value New Value
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Knut Anders Hatlen added a comment -

        Attaching a patch that makes the following changes:

        • Use the (already existing) method DatabasePropertyTestSetup.getNoTeardownInstance() instead of having many DatabasePropertyTestSetup classes that override tearDown() with an empty method. (To make it possible to have the new logic that releases the resources at just one location.)
        • Make the tearDown() method in the decorator returned by DatabasePropertyTestSetup.getNoTeardownInstance() close and null out the default connection.

        These changes preserve the main purpose of these decorators, which is that they shouldn't reset the properties in tearDown(), and at the same time allows the connection and its resources to be garbage collected once they're no longer used.

        suites.All ran successfully with the patch.

        I also verified that the patch reduced the number of BasicDatabase instances still held on the heap after running RolesTest and DboPowersTest. The numbers were reduced from 8 to 4, and from 50 to 36, respectively. (I had expected that the numbers would go down to one or two (wombat + dbsqlauth), so there may still be some other related bugs.)

        Show
        Knut Anders Hatlen added a comment - Attaching a patch that makes the following changes: Use the (already existing) method DatabasePropertyTestSetup.getNoTeardownInstance() instead of having many DatabasePropertyTestSetup classes that override tearDown() with an empty method. (To make it possible to have the new logic that releases the resources at just one location.) Make the tearDown() method in the decorator returned by DatabasePropertyTestSetup.getNoTeardownInstance() close and null out the default connection. These changes preserve the main purpose of these decorators, which is that they shouldn't reset the properties in tearDown(), and at the same time allows the connection and its resources to be garbage collected once they're no longer used. suites.All ran successfully with the patch. I also verified that the patch reduced the number of BasicDatabase instances still held on the heap after running RolesTest and DboPowersTest. The numbers were reduced from 8 to 4, and from 50 to 36, respectively. (I had expected that the numbers would go down to one or two (wombat + dbsqlauth), so there may still be some other related bugs.)
        Knut Anders Hatlen made changes -
        Attachment d5705-1a.diff [ 12523948 ]
        Knut Anders Hatlen made changes -
        Issue & fix info Patch Available [ 10102 ]
        Hide
        Knut Anders Hatlen added a comment -

        Committed revision 1330196.

        Show
        Knut Anders Hatlen added a comment - Committed revision 1330196.
        Knut Anders Hatlen made changes -
        Status In Progress [ 3 ] Closed [ 6 ]
        Issue & fix info Patch Available [ 10102 ]
        Fix Version/s 10.9.0.0 [ 12316344 ]
        Resolution Fixed [ 1 ]
        Gavin made changes -
        Workflow jira [ 12663785 ] Default workflow, editable Closed status [ 12796693 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        4s 1 Knut Anders Hatlen 24/Apr/12 09:55
        In Progress In Progress Closed Closed
        1d 2h 24m 1 Knut Anders Hatlen 25/Apr/12 12:20

          People

          • Assignee:
            Knut Anders Hatlen
            Reporter:
            Knut Anders Hatlen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development