|
| 1 | +From 0fb7a71435f88b50258d4d3a11055a4c95b14baf Mon Sep 17 00:00:00 2001 |
| 2 | +From: Ludovic Henry <git@ludovic.dev> |
| 3 | +Date: Fri, 28 Aug 2026 05:11:21 +0200 |
| 4 | +Subject: [PATCH] tests: give the completion wait a budget slower machines can |
| 5 | + meet |
| 6 | + |
| 7 | +test_payload_access_is_safe_while_worker_publishes_completion allows 30 |
| 8 | +seconds for the worker to drain every queued operation. The heaviest |
| 9 | +parametrisation makes that a tight budget on its own: 2000 write callbacks |
| 10 | +each sleep 1ms before taking the counter lock, so two of those seconds are |
| 11 | +spent sleeping in a single worker thread, while 16 observer threads scan the |
| 12 | +same 2000-element list without yielding. With the GIL disabled on a |
| 13 | +four-core machine the observers starve the worker badly enough that the |
| 14 | +drain does not finish in time. |
| 15 | + |
| 16 | +Only [caio.thread_aio-observers=16-completions=2000] is affected; every |
| 17 | +lighter combination of the same test passes, as do the other 740 tests. The |
| 18 | +suite takes 700s on the riscv64 runner against 117s in the same container |
| 19 | +image on aarch64, so the ceiling is raised by roughly that factor. |
| 20 | +Event.wait returns as soon as the event is set, so faster hardware pays |
| 21 | +nothing for the larger budget. |
| 22 | + |
| 23 | +Upstream-Status: To upstream [not yet submitted; found porting caio to riscv64] |
| 24 | +--- |
| 25 | + tests/test_free_threading.py | 2 +- |
| 26 | + 1 file changed, 1 insertion(+), 1 deletion(-) |
| 27 | + |
| 28 | +diff --git a/tests/test_free_threading.py b/tests/test_free_threading.py |
| 29 | +index f50518f..115f508 100644 |
| 30 | +--- a/tests/test_free_threading.py |
| 31 | ++++ b/tests/test_free_threading.py |
| 32 | +@@ -618,7 +618,7 @@ def test_payload_access_is_safe_while_worker_publishes_completion( |
| 33 | + workers.start_many(observe, (() for _ in range(observer_count))) |
| 34 | + observer_start.wait() |
| 35 | + blocker_release.set() |
| 36 | +- assert all_completed.wait(30), "worker did not finish queued operations" |
| 37 | ++ assert all_completed.wait(180), "worker did not finish queued operations" |
| 38 | + workers.join(timeout=10) |
| 39 | + |
| 40 | + assert completed_count[0] == operation_count |
0 commit comments