Skip to content

Occasional test timeout #205

@rwb27

Description

@rwb27

tests/test_invocation_contexts.py:261 failed in CI, but was fine when I re-ran it.

This suggests there's the possibility of some sort of race condition.

Looking at the code, I strongly suspect it's a race condition in the test code: the test starts two threads, and cancels one: the cancellation should then propagate to a thread that it spawned. It's possible we send the cancellation signal too early, and it gets lost, causing a 1s timeout. Certainly, there's no guarantee the second thread has started by the time we send the cancellation event.

We probably need more test code, so the inner function sets an event that indicates it's listening for cancellation - we should cancel only after that's set.

I think this is quite low priority, because I don't think it would affect any real code: the issue is only if threads are cancelled before they've properly started, which isn't practical except when writing test code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions