Skip to content

Commit

Permalink
Fix BZ 66842 - include DATA frames in overhead count with async
Browse files Browse the repository at this point in the history
  • Loading branch information
markt-asf committed Aug 6, 2023
1 parent aa77cb2 commit c551eca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ void writeBody(Stream stream, ByteBuffer data, int len, boolean finished) throws
log.debug(sm.getString("upgradeHandler.writeBody", connectionId, stream.getIdAsString(),
Integer.toString(len), Boolean.valueOf(finished)));
}

reduceOverheadCount(FrameType.DATA);

// Need to check this now since sending end of stream will change this.
boolean writable = stream.canWrite();
byte[] header = new byte[9];
Expand Down
2 changes: 1 addition & 1 deletion java/org/apache/coyote/http2/Http2UpgradeHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,7 @@ protected final String getConnectionId() {
}


private void reduceOverheadCount(FrameType frameType) {
void reduceOverheadCount(FrameType frameType) {
// A non-overhead frame reduces the overhead count by
// Http2Protocol.DEFAULT_OVERHEAD_REDUCTION_FACTOR. A simple browser
// request is likely to have one non-overhead frame (HEADERS) and one
Expand Down
5 changes: 5 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@
called after an error during asynchronous processing with HTTP/2.
(markt)
</fix>
<fix>
<bug>66842</bug>: When using asynchronous I/O (the default for NIO and
NIO2), include DATA frames when calculating the HTTP/2 overhead count to
ensure that connections are not prematurely terminated. (markt)
</fix>
</changelog>
</subsection>
<subsection name="WebSocket">
Expand Down

0 comments on commit c551eca

Please sign in to comment.