Skip to content

Handle closed report channel without panic#885

Open
tyr1k wants to merge 1 commit into
hatoo:masterfrom
tyr1k:fix-report-channel-panic
Open

Handle closed report channel without panic#885
tyr1k wants to merge 1 commit into
hatoo:masterfrom
tyr1k:fix-report-channel-panic

Conversation

@tyr1k

@tyr1k tyr1k commented Jun 5, 2026

Copy link
Copy Markdown

Workers can outlive the report receiver during early shutdown/deadline paths.
When the receiver is closed, kanal returns ReceiveClosed. This is expected
during shutdown and should stop the worker instead of panicking via unwrap().

When the report receiver is closed, workers stop as if cancellation was requested.

Fixes #883

Comment thread src/client.rs
set_start_latency_correction(&mut res, start_latency_correction);
}
report_tx.send(res).unwrap();
if !try_send_report(report_tx, res) {

@ahmed-mekky ahmed-mekky Jun 18, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why didn't you just do

if !report_tx.send(res).is_ok() {

the function looks like an unneeded layer of abstraction here

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panic: Unwrapping send on closed report channel causes ReceiveClosed in worker tasks under load

2 participants