Skip to content

Handle HTTP/2 data on ignored streams after GOAWAY - #1174

Open
sainadh777 wants to merge 1 commit into
apache:mainfrom
sainadh777:test/http2-goaway-ignored-streams
Open

sainadh777 wants to merge 1 commit into
apache:mainfrom
sainadh777:test/http2-goaway-ignored-streams

Conversation

@sainadh777

Copy link
Copy Markdown
Contributor

Summary

  • keep HTTP/2 HPACK state synchronized by continuing to decode header blocks for streams ignored after GOAWAY
  • count ignored DATA payloads against the connection flow-control window without creating a new stream
  • replace the checked-in Section 6.8 TODO with regression coverage for both behaviors

Rationale and impact

RFC 9113 section 6.8 requires an endpoint that ignores newer streams after sending GOAWAY to perform enough processing to maintain HPACK and connection flow-control state. Tomcat already decoded ignored header blocks, but DATA on those streams was rejected as a connection error. This narrowly changes that path to swallow the payload while preserving connection-level accounting; normal stream processing is unchanged.

Validation

  • Regression proof before the handler change: ant -Dtest.entry=org.apache.coyote.http2.TestHttp2Section_6_8 test failed both sync and async variants with PROTOCOL_ERROR for stream 5.
  • ant -Dexecute.validate=true validate — passed (Checkstyle 14.4.0).
  • ant clean — passed.
  • ant -Dexecute.validate=true — passed (clean source build).
  • ant -Dtest.entry=org.apache.coyote.http2.TestHttp2Section_6_8 test — passed, 6 tests, 0 failures, 0 errors, 0 skipped.
  • ant -Dtest.openssl.path=/opt/homebrew/opt/openssl@3/bin/openssl test — passed, 43,125 tests, 0 failures, 0 errors, 496 platform/native-capability skips; BUILD SUCCESSFUL in 24m49s.
  • Generated-distribution smoke test — started output/build with an isolated CATALINA_BASE, received HTTP 200 from http://127.0.0.1:18080/, stopped cleanly, and found no severe/error/exception markers in catalina.out.

The first full-suite attempt selected macOS /usr/bin/openssl (LibreSSL 3.3.6) and failed only the two OpenSSL cipher parser suites because LibreSSL does not support -ciphersuites. Those suites passed individually and the complete unfiltered suite passed after setting Tomcat's test.openssl.path property to Homebrew OpenSSL 3.6.3 as recorded above.

@sainadh777

Copy link
Copy Markdown
Contributor Author

@markt-asf, this updates the GOAWAY ignored-stream handling and the Section 6.8 test you last changed; a review would be appreciated.

@arturobernalg

Copy link
Copy Markdown
Member

I don't think this should be merged as is.

I tested this with a running Tomcat and a raw HTTP/2 client. The change correctly handles DATA on streams ignored after GOAWAY, but it also silently accepts invalid DATA frames.

When the connection is PAUSED, unknown streams are treated as ignorable regardless of their IDs. As a result, DATA on idle streams at or below the GOAWAY Last-Stream-ID, even-numbered stream IDs and previously closed streams that have been pruned is ignored instead of causing a connection error, as it does on main.

RFC 9113 section 5.1 requires a PROTOCOL_ERROR for DATA on idle streams. Section 6.8 permits discarding frames on peer-initiated streams above the GOAWAY Last-Stream-ID, but this should not bypass normal validation for other streams.

Please restrict the handling to streams that can legitimately be ignored after GOAWAY and add regression tests for the invalid cases.

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.

2 participants