Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1777

Test failure - test_client.TestClient.test_max_idle_time_reaper RuntimeError: deque changed size during iteration

    • Type: Icon: Build Failure Build Failure
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Tests
    • None

      This failure is caused by the change to use deque instead of set in PYTHON-1663.

       [2019/03/13 16:57:38.157] ERROR [0.553s]: test_max_idle_time_reaper (test_client.TestClient)
       [2019/03/13 16:57:38.158] ----------------------------------------------------------------------
       [2019/03/13 16:57:38.158] Traceback (most recent call last):
       [2019/03/13 16:57:38.158]   File "/data/mci/114a6105b15ee22470f16421396b513f/src/test/test_client.py", line 319, in test_max_idle_time_reaper
       [2019/03/13 16:57:38.158]     wait_until(lambda: sock_info not in server._pool.sockets,
       [2019/03/13 16:57:38.158]   File "/data/mci/114a6105b15ee22470f16421396b513f/src/test/utils.py", line 454, in wait_until
       [2019/03/13 16:57:38.158]     retval = predicate()
       [2019/03/13 16:57:38.158]   File "/data/mci/114a6105b15ee22470f16421396b513f/src/test/test_client.py", line 319, in <lambda>
       [2019/03/13 16:57:38.158]     wait_until(lambda: sock_info not in server._pool.sockets,
       [2019/03/13 16:57:38.158] RuntimeError: deque changed size during iteration
      

      The fix is to hold the pool's lock before checking if the socket is in the deque. deque.__contains__ and deque.copy are not thread safe.

            Assignee:
            Unassigned Unassigned
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: