Skip to content

Commit

Permalink
Cache execnet gateway rinfo during WorkerController setup
Browse files Browse the repository at this point in the history
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 (#1027)")
  • Loading branch information
zmedico authored and bluetech committed Apr 28, 2024
1 parent c93a106 commit 12b3cce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog/1071.bugfix
@@ -0,0 +1 @@
Add backward compatibility for deadlock issue with the ``execnet`` new ``main_thread_only`` "execmodel" triggered when pytest-cov accesses rinfo.
5 changes: 5 additions & 0 deletions src/xdist/workermanage.py
Expand Up @@ -312,6 +312,11 @@ def shutting_down(self) -> bool:

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

0 comments on commit 12b3cce

Please sign in to comment.