Ensure python test suite properly cleans up when reassigning variables

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Test Python
    • None
    • Storage Engines - Foundations
    • SE Foundations - Q4+ Backlog
    • 5

      Python tests can inadvertently leak WT sessions when reassigning session variables without explicitly closing the previous session.

      This was discovered when I encountered EBUSY errors during ops requiring exclusive access (i.e. verify).

      For example:

      session2 = conn.open_session()
      cursor2 = session2.open_session()
      
      session2.begin_transaction()
      ...
      # do some operations
      session2.rollback_transaction()
      
      # Note we have not closed session2 or cursor2
      
      session2 = conn.open_session() # We have a resource leak
      # the original session2 is lost but still open
      
      cursor2 = session2.open_cursor(uri) # Double check if we get a leak here
      # is the first cursor2 also lost but still open?

      The first session2 remains open with active resources, which had prevented subsequent verify calls and resulted in the following errors:

        File "/home/ubuntu/wiredtiger/test/suite/wttest.py", line 929, in <lambda>
          return self.retryEBUSY(session, lambda: session.verify(uri, config), **kwargs)
      _wiredtiger.WiredTigerError: Device or resource busy 

      and also this error when calling verify through wttest.py teardown function:

      __conn_single, 1859: WiredTiger database is already being managed by another thread in this process: Device or resource busy 

       

      Definition of done:

      • Consider design changes to the test framework API to prevent resource leaks from variable reassignment.
      • Ensure this change is properly communicated/documented.
      • Write a python test ensuring this is now working as expected.

            Assignee:
            [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            Mariam Mojid
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: