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(client): call stream_close_send after GET #1564

Merged
merged 1 commit into from
Jan 18, 2024

Conversation

mxinden
Copy link
Collaborator

@mxinden mxinden commented Jan 18, 2024

Previously neqo-client would not close the sending side of a stream after sending a GET request. Corresponding section in RFC 9114:

After sending a request, a client MUST close the stream for sending.

https://www.rfc-editor.org/rfc/rfc9114.html#name-http-message-framing


This surfaces in the Quic Interop Runner http3 test. Here the client downloads 3 files from the server.

  1. The client opens stream 0, sends a GET for the first file.

  2. The client opens stream 4, sends a GET for the second file.

  3. The client opens stream 8, sends a GET for the third file.

  4. ...

  5. Eventually the client has read the whole response on stream 0, it removes the corresponding StreamHandler from
    self.url_handler.stream_handlers
    and continues with the remaining requests.

  6. Given that the client did not close the sending side of stream 0 after sending the GET request, it still handles Http3ClientEvent::DataWritable events for stream 0. Given that it previously removed stream 0 from self.url_handler.stream_handlers, it errors and discontinues the process_loop.

  7. The second and third request don't finish and the Quic Interop Runner fails the test given that the second and third file are not fully downloaded.

    File size of /tmp/download_sivy_1mt/cjwxjpvzjr doesn't match. Original: 10240 bytes, downloaded: 4056 bytes.


Needed for quic-interop/quic-interop-runner#344.
Related to #1552.

Previously `neqo-client` would not close the sending side of a stream after
sending a GET request. Corresponding section in RFC 9114:

> After sending a request, a client MUST close the stream for sending.

https://www.rfc-editor.org/rfc/rfc9114.html#name-http-message-framing

This surfaces in the Quic Interop Runner `http3` test. Here the client download
3 files from the server.

1. The client opens stream `0`, sends a GET for the first file.
2. The client opens stream `4`, sends a GET for the second file.
3. The client opens stream `8`, sends a GET for the third file.
4. ...
5. Eventually the client has read the whole response on stream `0`, [it removes
the corresponding `StreamHandler` from
`self.url_handler.stream_handlers`](https://github.com/mozilla/neqo/blob/64fb41f47cbbbb1101484dcd37533c7b295fa659/neqo-client/src/main.rs#L775-L777)
and continues with the remaining requests.
6. Given that the client did not close the sending side of stream `0` after
sending the GET request, it still handles `Http3ClientEvent::DataWritable`
events for stream `0`. Given that it previously removed stream `0` from
`self.url_handler.stream_handlers`, [it
errors](https://github.com/mozilla/neqo/blob/64fb41f47cbbbb1101484dcd37533c7b295fa659/neqo-client/src/main.rs#L780-L784)
and discontinues the [process_loop](https://github.com/mozilla/neqo/blob/64fb41f47cbbbb1101484dcd37533c7b295fa659/neqo-client/src/main.rs#L472-L474).
7. The second and third request don't finish and the Quic Interop Runner fails
the test given that the second and third file are not fully downloaded.

   > File size of /tmp/download_sivy_1mt/cjwxjpvzjr doesn't match. Original: 10240 bytes, downloaded: 4056 bytes.
@codecov-commenter
Copy link

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (64fb41f) 87.63% compared to head (22730ea) 87.61%.

Files Patch % Lines
neqo-client/src/main.rs 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1564      +/-   ##
==========================================
- Coverage   87.63%   87.61%   -0.03%     
==========================================
  Files         117      117              
  Lines       38323    38328       +5     
==========================================
- Hits        33584    33580       -4     
- Misses       4739     4748       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@martinthomson martinthomson merged commit c567bf4 into mozilla:main Jan 18, 2024
9 checks passed
mxinden added a commit to mxinden/neqo that referenced this pull request May 4, 2024
There are two server implementations based on neqo:

1. https://github.com/mozilla/neqo/tree/main/neqo-bin/src/server
  - http3 and http09 implementation
  - used for manual testing and QUIC Interop

2. https://searchfox.org/mozilla-central/source/netwerk/test/http3server/src/main.rs
  - used to test Firefox

I assume one was once an exact copy of the other. Both implement their own I/O,
event loop, ... Since then, the two implementations diverged significantly.
Especially (1) saw a lot of improvements in recent months:

- mozilla#1564
- mozilla#1569
- mozilla#1578
- mozilla#1581
- mozilla#1604
- mozilla#1612
- mozilla#1676
- mozilla#1692
- mozilla#1707
- mozilla#1708
- mozilla#1727
- mozilla#1753
- mozilla#1756
- mozilla#1766
- mozilla#1772
- mozilla#1786
- mozilla#1787
- mozilla#1788
- mozilla#1794
- mozilla#1806
- mozilla#1808
- mozilla#1848
- mozilla#1866

At this point, bugs in (2) are hard to fix, see e.g.
mozilla#1801.

This commit merges (2) into (1), thus removing all duplicate logic and
having (2) benefit from all the recent improvements to (1).
KershawChang pushed a commit to KershawChang/neqo that referenced this pull request May 7, 2024
There are two server implementations based on neqo:

1. https://github.com/mozilla/neqo/tree/main/neqo-bin/src/server
  - http3 and http09 implementation
  - used for manual testing and QUIC Interop

2. https://searchfox.org/mozilla-central/source/netwerk/test/http3server/src/main.rs
  - used to test Firefox

I assume one was once an exact copy of the other. Both implement their own I/O,
event loop, ... Since then, the two implementations diverged significantly.
Especially (1) saw a lot of improvements in recent months:

- mozilla#1564
- mozilla#1569
- mozilla#1578
- mozilla#1581
- mozilla#1604
- mozilla#1612
- mozilla#1676
- mozilla#1692
- mozilla#1707
- mozilla#1708
- mozilla#1727
- mozilla#1753
- mozilla#1756
- mozilla#1766
- mozilla#1772
- mozilla#1786
- mozilla#1787
- mozilla#1788
- mozilla#1794
- mozilla#1806
- mozilla#1808
- mozilla#1848
- mozilla#1866

At this point, bugs in (2) are hard to fix, see e.g.
mozilla#1801.

This commit merges (2) into (1), thus removing all duplicate logic and
having (2) benefit from all the recent improvements to (1).
github-merge-queue bot pushed a commit that referenced this pull request May 8, 2024
* refactor(bin): introduce server/http3.rs and server/http09.rs

The QUIC Interop Runner requires an http3 and http09 implementation for both
client and server. The client code is already structured into an http3 and an
http09 implementation since #1727.

This commit does the same for the server side, i.e. splits the http3 and http09
implementation into separate Rust modules.

* refactor: merge mozilla-central http3 server into neqo-bin

There are two server implementations based on neqo:

1. https://github.com/mozilla/neqo/tree/main/neqo-bin/src/server
  - http3 and http09 implementation
  - used for manual testing and QUIC Interop

2. https://searchfox.org/mozilla-central/source/netwerk/test/http3server/src/main.rs
  - used to test Firefox

I assume one was once an exact copy of the other. Both implement their own I/O,
event loop, ... Since then, the two implementations diverged significantly.
Especially (1) saw a lot of improvements in recent months:

- #1564
- #1569
- #1578
- #1581
- #1604
- #1612
- #1676
- #1692
- #1707
- #1708
- #1727
- #1753
- #1756
- #1766
- #1772
- #1786
- #1787
- #1788
- #1794
- #1806
- #1808
- #1848
- #1866

At this point, bugs in (2) are hard to fix, see e.g.
#1801.

This commit merges (2) into (1), thus removing all duplicate logic and
having (2) benefit from all the recent improvements to (1).

* Move firefox.rs to mozilla-central

* Reduce HttpServer trait functions

* Extract constructor

* Remove unused deps

* Remove clap color feature

Nice to have. Adds multiple dependencies. Hard to justify for mozilla-central.
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.

4 participants