Skip to content

http2: empty DATA frame used instead of END_STREAM on last DATA frame #33891

Closed
@clshortfuse

Description

@clshortfuse
  • Version: v14.3.0
  • Platform: Mac OS X
  • Subsystem: http2

What steps will reproduce the bug?

Http2Stream.end('data');

How often does it reproduce? Is there a required condition?

It occurs as long as there are no trailers (which means always on ClientHttp2Stream)

What is the expected behavior?

The DATA frame with the last piece of data should have the END_STREAM flag.

What do you see instead?

node/src/node_http2.cc

Lines 2319 to 2326 in f46ca0f

if (stream->available_outbound_length_ == 0 && !stream->is_writable()) {
Debug(session, "no more data for stream %d", id);
*flags |= NGHTTP2_DATA_FLAG_EOF;
if (stream->has_trailers()) {
*flags |= NGHTTP2_DATA_FLAG_NO_END_STREAM;
stream->OnTrailers();
}
}

The NGHTTP2_DATA_FLAG_EOF is only set if the outbound stream is no long writable (eg: on shutdown), but not if the internal (Writable) stream has ended.

Additional information

This is how curl, Chrome, and Safari send DATA frames, wherein the last DATA frame contains the END_STREAM flag, instead of sending an empty frame. It makes it more difficult to test http2 if nodeJS applies different logic. Performance-wise, it's a wasted packet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    http2Issues or PRs related to the http2 subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions