Merge pull request #29452 from azat/clickhouse-test-fix-term

clickhouse-test: fix shared list object (by fixing manager lifetime)
This commit is contained in:
tavplubix 2021-09-28 22:34:21 +03:00 committed by GitHub
commit 75be60ff22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,11 +65,20 @@ def signal_handler(sig, frame):
def stop_tests(): def stop_tests():
global stop_tests_triggered_lock global stop_tests_triggered_lock
global stop_tests_triggered global stop_tests_triggered
global restarted_tests
with stop_tests_triggered_lock: with stop_tests_triggered_lock:
if not stop_tests_triggered.is_set(): if not stop_tests_triggered.is_set():
stop_tests_triggered.set() stop_tests_triggered.set()
# materialize multiprocessing.Manager().list() object before
# sending SIGTERM since this object is a proxy, that requires
# communicating with manager thread, but after SIGTERM will be
# send, this thread will die, and you will get
# ConnectionRefusedError error for any access to "restarted_tests"
# variable.
restarted_tests = [*restarted_tests]
# send signal to all processes in group to avoid hung check triggering # send signal to all processes in group to avoid hung check triggering
# (to avoid terminating clickhouse-test itself, the signal should be ignored) # (to avoid terminating clickhouse-test itself, the signal should be ignored)
signal.signal(signal.SIGTERM, signal.SIG_IGN) signal.signal(signal.SIGTERM, signal.SIG_IGN)