uber / tchannel-go

Go implementation of a multiplexing and framing protocol for RPC calls
http://uber.github.io/tchannel/
MIT License
490 stars 84 forks source link

Optionally send cancelled frames when context is canceled #890

Closed prashantv closed 1 year ago

prashantv commented 1 year ago

Replaces https://github.com/uber/tchannel-go/pull/817

Add a new option, SendCancelOnContextCanceled to send cancel frames when a context is detected to be canceled on the request sender side.

Cancellations often happen while waiting to read a response, so we can rely on the reader goroutine waiting on the message exchange to notice the cancellation and send the cancel message to the remote side vs adding a separate goroutine.

Older servers and relays without this change will log Received unexpected frame but otherwise be unaffected by the unknown frame. However, there's no point enabling cancellations if the remote side doesn't support them first.

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 76.71% and project coverage change: +0.02 :tada:

Comparison is base (0c11cc2) 88.78% compared to head (05971e3) 88.81%.

:exclamation: Current head 05971e3 differs from pull request most recent head 99a96e0. Consider uploading reports for the commit 99a96e0 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #890 +/- ## ========================================== + Coverage 88.78% 88.81% +0.02% ========================================== Files 43 43 Lines 4440 4505 +65 ========================================== + Hits 3942 4001 +59 - Misses 379 382 +3 - Partials 119 122 +3 ``` | [Impacted Files](https://codecov.io/gh/uber/tchannel-go/pull/890?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber) | Coverage Δ | | |---|---|---| | [outbound.go](https://codecov.io/gh/uber/tchannel-go/pull/890?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber#diff-b3V0Ym91bmQuZ28=) | `84.97% <33.33%> (-2.17%)` | :arrow_down: | | [messages.go](https://codecov.io/gh/uber/tchannel-go/pull/890?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber#diff-bWVzc2FnZXMuZ28=) | `91.58% <50.00%> (-6.27%)` | :arrow_down: | | [mex.go](https://codecov.io/gh/uber/tchannel-go/pull/890?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber#diff-bWV4Lmdv) | `72.88% <76.00%> (+0.36%)` | :arrow_up: | | [connection.go](https://codecov.io/gh/uber/tchannel-go/pull/890?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber#diff-Y29ubmVjdGlvbi5nbw==) | `88.39% <88.88%> (+3.40%)` | :arrow_up: | | [inbound.go](https://codecov.io/gh/uber/tchannel-go/pull/890?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber#diff-aW5ib3VuZC5nbw==) | `83.00% <100.00%> (+0.61%)` | :arrow_up: | | [relay.go](https://codecov.io/gh/uber/tchannel-go/pull/890?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber#diff-cmVsYXkuZ28=) | `85.77% <100.00%> (+0.06%)` | :arrow_up: | | [relay\_messages.go](https://codecov.io/gh/uber/tchannel-go/pull/890?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber#diff-cmVsYXlfbWVzc2FnZXMuZ28=) | `100.00% <100.00%> (ø)` | | ... and [1 file with indirect coverage changes](https://codecov.io/gh/uber/tchannel-go/pull/890/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber) Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.