Skip to content

Commit 12b3cce

Browse files
zmedicobluetech
authored andcommitted
Cache execnet gateway rinfo during WorkerController setup
Cache execnet gateway info during WorkerController setup for backward compatibility, in order to avoid a later main_thread_only deadlock error triggered when pytest-cov calls rinfo after the main thread is already busy. See pytest-dev/execnet#274 for corresponding test case. Fixes: 20e3ac7 ("Use execnet main_thread_only execmodel (pytest-dev#1027)")
1 parent c93a106 commit 12b3cce

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Diff for: changelog/1071.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add backward compatibility for deadlock issue with the ``execnet`` new ``main_thread_only`` "execmodel" triggered when pytest-cov accesses rinfo.

Diff for: src/xdist/workermanage.py

+5
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,11 @@ def shutting_down(self) -> bool:
312312

313313
def setup(self) -> None:
314314
self.log("setting up worker session")
315+
# Cache rinfo for backward compatibility, since pytest-cov
316+
# accesses rinfo while the main thread is busy executing our
317+
# remote_exec call, which triggers a deadlock error for the
318+
# main_thread_only execmodel if the rinfo has not been cached.
319+
self.gateway._rinfo()
315320
spec = self.gateway.spec
316321
args = [str(x) for x in self.config.invocation_params.args or ()]
317322
option_dict = {}

0 commit comments

Comments
 (0)