summaryrefslogtreecommitdiff
path: root/src/tox/session
diff options
context:
space:
mode:
authorBernát Gábor <gaborjbernat@gmail.com>2021-09-24 07:27:38 +0100
committerBernát Gábor <gaborjbernat@gmail.com>2021-09-24 07:37:32 +0100
commita44eca3919e96e9e536a42e4b59197343cf25775 (patch)
tree34bfb8696d5aa1c3502233fef86067c4a19afeaa /src/tox/session
parente5d1a439be0790c8104d4caf943b3d82f23a0039 (diff)
downloadtox-git-a44eca3919e96e9e536a42e4b59197343cf25775.tar.gz
Fix the interrupt thread is deadlocking when receiving an interrupt
Diffstat (limited to 'src/tox/session')
-rw-r--r--src/tox/session/cmd/run/common.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tox/session/cmd/run/common.py b/src/tox/session/cmd/run/common.py
index 0c4e958c..79cd3e61 100644
--- a/src/tox/session/cmd/run/common.py
+++ b/src/tox/session/cmd/run/common.py
@@ -211,6 +211,12 @@ def execute(state: State, max_workers: Optional[int], has_spinner: bool, live: b
if cancelled is False and not future.done(): # pragma: no branch
tox_env.interrupt()
done.wait()
+ # workaround for https://bugs.python.org/issue45274
+ lock = getattr(thread, "_tstate_lock", None)
+ if lock is not None and lock.locked():
+ lock.release()
+ thread._stop() # type: ignore # we must call this private method to fix the thread state
+ thread.join()
finally:
ordered_results: List[ToxEnvRunResult] = []
name_to_run = {r.name: r for r in results}