Comments (11)
Hello @LucioFranco
Most likely yes, I haven't tried with a python client, but the issue you describe is the one I had with nginx.
Only RST_STREAM(NO_ERROR) is allowed on early server response.
I was planning to open an issue in tonic to ask to bump h2 version, once a new release is made, but seems you are ahead of me
from h2.
Thanks again for the excellent work! If you're ever interested in helping on other aspects of h2
, we'd welcome your work gladly! <3
from h2.
Yes, I believe we've discussed before that there are cases that this should send NO_ERROR
instead of CANCEL
. Probably only in this specific case:
The full response has been sent (or scheduled to send), and any option DATA and trailers. Basically, that an end-of-stream frame is going out.
I think CANCEL
is still correct in the general case, where the user has dropped all handles but never triggered end-of-stream, and also if the client drops handle waiting for the response.
from h2.
Hello, thanks for the answer !
So I am at the right place 🎆
Is changing the maybe_cancel code by something like this would feel right to you ?
Or is there some other cases to handle ?
fn maybe_cancel(stream: &mut store::Ptr, actions: &mut Actions, counts: &mut Counts) {
if stream.is_canceled_interest() {
+ // To match HalfClosedLocal(Streaming) state
+ let reason = if stream.state.is_send_closed() && stream.state.is_recv_streaming() {
+ Reason::NO_ERROR
+ } else {
+ Reason::CANCEL
+ };
actions
.send
.schedule_implicit_reset(stream, reason, counts, &mut actions.task);
actions.recv.enqueue_reset_expiration(stream, counts);
}
}
from h2.
Ummmm, hard for me to remember. I imagine if you changed that function without the conditional, some unit test would complain? That might show which unit test needs to be updated, or maybe we dont have this specific case as a test...
from h2.
Ok, so I am impressed by the quality of your tests ...
Would dream to have those mock in my projects.
Regarding the issue, by adding an is_server()
check in the condition and adapting 1 test that seems to match my case.
Everything is green with a cargo test --all-features --all
diff --git a/src/proto/streams/streams.rs b/src/proto/streams/streams.rs
index f11ee08..bfce840 100644
--- a/src/proto/streams/streams.rs
+++ b/src/proto/streams/streams.rs
@@ -1461,9 +1461,16 @@ fn drop_stream_ref(inner: &Mutex<Inner>, key: store::Key) {
fn maybe_cancel(stream: &mut store::Ptr, actions: &mut Actions, counts: &mut Counts) {
if stream.is_canceled_interest() {
+ // To match HalfClosedLocal(Streaming) state
+ let reason = if counts.peer().is_server() && stream.state.is_send_closed() && stream.state.is_recv_streaming() {
+ Reason::NO_ERROR
+ } else {
+ Reason::CANCEL
+ };
+
actions
.send
- .schedule_implicit_reset(stream, Reason::CANCEL, counts, &mut actions.task);
+ .schedule_implicit_reset(stream, reason, counts, &mut actions.task);
actions.recv.enqueue_reset_expiration(stream, counts);
}
}
diff --git a/tests/h2-tests/tests/server.rs b/tests/h2-tests/tests/server.rs
index b3bf1a2..e61fd3b 100644
--- a/tests/h2-tests/tests/server.rs
+++ b/tests/h2-tests/tests/server.rs
@@ -566,7 +566,7 @@ async fn sends_reset_cancel_when_req_body_is_dropped() {
client
.recv_frame(frames::headers(1).response(200).eos())
.await;
- client.recv_frame(frames::reset(1).cancel()).await;
+ client.recv_frame(frames::reset(1).reason(Reason::NO_ERROR)).await;
};
let srv = async move {
If this seems good to you, I can go forward and make a PR next week.
If you require some other things before, let me know
from h2.
Nice, looks good to me!
from h2.
Here we are #634 :)
It needs some approval to run the github actions
from h2.
Thank you for the kind words and your reactivity ^^
By any chances, do you plan to make a new release soonish ?
from h2.
This feels related to hyperium/tonic#992, right?
from h2.
Thank you @seanmonstar and @LucioFranco , I am closing the issue as it is resolved and released 👍
from h2.
Related Issues (20)
- Panicking following 0.3.17 HOT 1
- Unable to send response. HOT 3
- assertion failed: self.num_remote_reset_streams > 0 HOT 1
- How to set frame priority / Weight ? HOT 4
- Request processing always times out, HOT 1
- Handling of RFC7540 8.1.2.5 HOT 5
- Panic due to the max headers capacity HOT 1
- `h2spec 2.6.0` tests are failling against `h2` HOT 3
- Settings frames are not applied correctly HOT 12
- Sending data frame results in transmission of more tcp segments than needed HOT 11
- Make tracing an optional feature
- Modifying the `akamai` example to send to `www.google.com` and adding a `host` header and errors HOT 2
- `max_send_buffer_size` documentation states default is 400 MB. It is 400 KB. HOT 2
- Remove tokio I/O traits from dependencies HOT 4
- http2 error: stream error received: unspecific protocol error detected HOT 4
- custom SETTINGS settings
- Proposal: change the default value of `initial_max_send_streams` to 100 HOT 7
- Documentation: How to handle GOAWAY HOT 2
- Respond with an HTTP 4xx than only a `RST_STREAM` to malformed requests HOT 2
- Default server configuration prevents the use of server pushes HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from h2.