Skip to content

Commit 5e94c17

Browse files
dhyansrajclaude
andcommitted
test: daemon threads in the eviction-race MeshJob cache test
Matches the two-loop deadlock test: a regression that parks a loop must fail the join-timeout assertion, not wedge pytest at interpreter exit on a surviving non-daemon thread. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GKQG598Ma6EYUrSUjK1LSN
1 parent ffee097 commit 5e94c17

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

‎src/runtime/python/tests/unit/test_meshjob_events.py‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,17 +1119,28 @@ def _target(label: str, keys: list[str]) -> None:
11191119
loop.close()
11201120

11211121
with mock.patch("mcp_mesh_core.JobProxy", _FastFake, create=True):
1122+
# Daemon, as in the deadlock test above: if the hit path ever
1123+
# regresses to a blocking wait, the join below times out and
1124+
# the assertion fails — non-daemon survivors would then hang
1125+
# pytest at interpreter exit instead of reporting that.
11221126
threads = [
11231127
threading.Thread(
1124-
target=_target, args=("shared-A", ["shared"]), name="shared-A"
1128+
target=_target,
1129+
args=("shared-A", ["shared"]),
1130+
name="shared-A",
1131+
daemon=True,
11251132
),
11261133
threading.Thread(
1127-
target=_target, args=("shared-B", ["shared"]), name="shared-B"
1134+
target=_target,
1135+
args=("shared-B", ["shared"]),
1136+
name="shared-B",
1137+
daemon=True,
11281138
),
11291139
threading.Thread(
11301140
target=_target,
11311141
args=("churn", [f"churn-{i}" for i in range(64)]),
11321142
name="churn",
1143+
daemon=True,
11331144
),
11341145
]
11351146
for t in threads:

0 commit comments

Comments
 (0)