Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(s2n-quic-dc): handle spurious TCP acceptor worker wakeups #2434

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions dc/s2n-quic-dc/src/stream/server/tokio/tcp/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,13 @@ where
let mut cf = ControlFlow::Continue(());

let entry = &mut self.workers[idx];

// Only poll the worker if it's active. We can end up here if we've pruned a worker right before
// the tokio runtime notifies us the stream is ready.
if !entry.worker.is_active() {
return cf;
}

let mut task_cx = task::Context::from_waker(&entry.waker);
let Poll::Ready(res) = entry.worker.poll(&mut task_cx, cx, publisher, clock) else {
debug_assert!(entry.worker.is_active());
Expand Down
5 changes: 2 additions & 3 deletions dc/s2n-quic-dc/src/stream/server/tokio/tcp/manager/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,8 @@ impl Harness {
let Entry { worker, waker, .. } = &mut self.manager.inner.workers[idx];
let is_active = worker.is_active();

if is_active {
waker.wake_by_ref();
}
// wake the worker even if it's not active so we can test more paths
waker.wake_by_ref();

is_active
}
Expand Down
Loading