Skip to content

TST: make threaded tests fail instead of hanging when a worker raises (#33570) - #33575

Open
ikrommyd wants to merge 1 commit into
numpy:maintenance/2.6.xfrom
ikrommyd:backport-33570
Open

ikrommyd wants to merge 1 commit into
numpy:maintenance/2.6.xfrom
ikrommyd:backport-33570

Conversation

@ikrommyd

@ikrommyd ikrommyd commented Dec 3, 2026

Copy link
Copy Markdown
Member

Backport of #33570.

PR summary

Follow-up to #33551.

This is not critical as my understanding is that these hangs can happen only if an error is raised inside a worker somehow. But it's good to be protected against such a thing.

Some of our threaded tests hang instead of failing when a worker raises or a thread fails to start, because the other workers stay stuck at a barrier or event forever.

run_threaded now aborts the barrier as soon as a worker raises and reports the original exception, not the BrokenBarrierError it causes in the other workers. test_printoptions_thread_safety and test_thread_safe_argparse_cache now use run_threaded instead of raw threads. test_arg_locking stops the mutator with an event once the readers are done instead of using a shared counter, test_thread_locality sets its event in a finally, and the writer in test_read_write_bool_array releases the reader if it fails.

AI Disclosure

I worked on this with an AI model AI and an AI model was used to find these hangs by Nathan.

@ikrommyd ikrommyd added 05 - Testing 08 - Backport Used to tag backport PRs labels Dec 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

05 - Testing 08 - Backport Used to tag backport PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant