Repository navigation
fix(client): handle closed report channel gracefully without panic (fixes #883) - #907
Open
Golopmoui3 wants to merge 2 commits into
Open
Golopmoui3 wants to merge 2 commits into
Golopmoui3 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #883.
This PR fixes a worker panic (
called Result::unwrap() on an Err value: ReceiveClosed) that occurs when runningohaunder high concurrency or when the report receiver channel closes early (e.g., deadline reached, early cancellation, or parent task termination).Problem
In
src/client.rsandsrc/client_h3.rs, worker tasks sent their request results throughreport_txwith an unconditional.unwrap():When the receiver task terminates early or the channel receiver drops before all worker threads complete, subsequent
sendattempts returnErr(ReceiveClosed). Due to.unwrap(), this caused worker tasks to panic and abort unexpectedly.Changes
.unwrap()onreport_tx.send(...)calls acrosssrc/client.rsandsrc/client_h3.rs.report_tx.send(res).is_err(), workers now terminate cleanly by breaking out of their loops or returning early.work_http2_onceandwork_http3_onceto propagate channel disconnection as task cancellation (is_cancel || is_closed).fastmode and deadline handlers where receiver teardown may race with final batch delivery.test_work_does_not_panic_on_closed_receiverinsrc/client.rs. The test drops the receiver immediately before launching workers and verifies they exit cleanly without panicking.Verification
cargo test --bin oha: 42/42 tests passing.cargo clippy -- -D warnings: 0 warnings, clean lint check.