You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by la...@apache.org on 2021/04/01 09:12:21 UTC

[impala] branch master updated: IMPALA-10596: De-flake teardown in TestAdmissionControllerStress

This is an automated email from the ASF dual-hosted git repository.

laszlog pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git


The following commit(s) were added to refs/heads/master by this push:
     new 96e7f85  IMPALA-10596: De-flake teardown in TestAdmissionControllerStress
96e7f85 is described below

commit 96e7f85275056dd4ec1460ec8df3afb86d401e43
Author: Bikramjeet Vig <bi...@gmail.com>
AuthorDate: Wed Mar 31 12:45:33 2021 -0700

    IMPALA-10596: De-flake teardown in TestAdmissionControllerStress
    
    Currently if the threads running queries in
    TestAdmissionControllerStress hit an error, they close their client
    which ultimately closes the query that it was running. If teardown()
    runs after the client is closed, it tries to cancel the query that
    the thread was running and hits an exception trying to cancel an
    already closed query. This results in the pytest throws the exception
    encountered in teardown() instead of the original exception that
    caused the test to fail in the first place. This patch fixes this by
    removing the query handle from the thread if the client is closed.
    
    Testing:
    Simulated hitting an error condition in the main thread that
    initially triggered this condition.
    
    Change-Id: I8aa8315d9f598ba80d13cd2091e3cc743c64ba77
    Reviewed-on: http://gerrit.cloudera.org:8080/17256
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 tests/custom_cluster/test_admission_controller.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/custom_cluster/test_admission_controller.py b/tests/custom_cluster/test_admission_controller.py
index c445e0f..1f21f7b 100644
--- a/tests/custom_cluster/test_admission_controller.py
+++ b/tests/custom_cluster/test_admission_controller.py
@@ -1759,7 +1759,13 @@ class TestAdmissionControllerStress(TestAdmissionControllerBase):
       finally:
         LOG.info("Thread terminating in state=%s", self.query_state)
         if client is not None:
-          client.close()
+          try:
+            self.lock.acquire()
+            client.close()
+            # Closing the client closes the query as well
+            self.query_handle = None
+          finally:
+            self.lock.release()
 
     def _end_query(self, client, query):
       """Bring the query to the appropriate end state defined by self.query_end_behaviour.