Skip to content

Remove a flaky got_timeout assert from two channel tests#153534

Open
Zalathar wants to merge 1 commit intorust-lang:mainfrom
Zalathar:flaky-stress
Open

Remove a flaky got_timeout assert from two channel tests#153534
Zalathar wants to merge 1 commit intorust-lang:mainfrom
Zalathar:flaky-stress

Conversation

@Zalathar
Copy link
Member

@Zalathar Zalathar commented Mar 7, 2026

In CI, the receiver thread can be descheduled for a surprisingly long time, so there's no guarantee that a timeout actually occurs.

One of these tests actually failed in #153387 (comment).

Earlier failures:


In CI, the receiver thread can be descheduled for a surprisingly long time, so
there's no guarantee that a timeout actually occurs.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Mar 7, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 7, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 8 candidates

@Zalathar
Copy link
Member Author

Zalathar commented Mar 7, 2026

});

let mut recv_count = 0;
let mut got_timeout = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why not just make the sender thread have a while loop on a shared atomic value (like an Arc<AtomicBool>) that yields itself through thread::yield_now? Or I'm wondering if we could also use a shared Condvar that waits in the sender thread and the receiver thread is the one that sends a notification? That way we can guarantee that our receiver thread experiences a RecvTimeoutError::Timeout error after 10 ms and either set the atomic value to a state that the while loop from the sender thread will stop looping on or the sender thread just resumes its iteration in the for loop upon receiving a notification.

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

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants