You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
py_thread_callback_SUITE: concurrent threadpool tests flaky under load #63
py_thread_callback_SUITE intermittently fails on slower CI environments (observed on FreeBSD 14 / Python 3.12 in run 25273995207). A re-run of the same commit passes, so the failures are not deterministic.
The wrong-value lists (e.g. [3,2,3,4,7] where each element should be x + 3 for x ∈ 0..4) are not a simple ordering issue — values themselves are wrong. This looks like cross-call state interference inside the Python concurrent.futures.ThreadPoolExecutor callback path: workers see callbacks delivering arguments or results from the wrong invocation.
Hypothesis
The C-side reentrant-callback machinery (erlang.call(...) from a Python thread that isn't the worker pthread) maintains thread-local request state. When ThreadPoolExecutor runs the lambda on N worker threads simultaneously, each calling erlang.call('add_one', x) for a different x, the result delivery may briefly cross threads on hosts where the callback dispatch is slower than the test's pacing. We see the bad result on the slow FreeBSD VM and never on Linux/macOS runners.
Suggested next steps
Add tracing inside nif_thread_worker_call / the per-thread callback request slot to confirm the suspected cross-thread mix-up.
Consider giving each Python thread its own request slot keyed by pthread_self() rather than by the worker's logical ID.
As an interim, mark the affected cases ?GROUP({thread_callback, [parallel_groups: 1]}) or similar so they don't compete for the executor pool with other suites in the same run — that often masks the race long enough to ship.
Not a release blocker: PR #62 merged after a clean rerun. File follow-up to debug under controlled load.
Activity
Fix py_thread_callback_SUITE flake on slow CI hosts (#63) (#64)
Prepare 3.0.0 release