Skip to content

quiche: implement stream idle timeout in codec#17674

Merged
alyssawilk merged 17 commits intoenvoyproxy:mainfrom
danzh2010:idlestream
Aug 17, 2021
Merged

quiche: implement stream idle timeout in codec#17674
alyssawilk merged 17 commits intoenvoyproxy:mainfrom
danzh2010:idlestream

Conversation

@danzh2010
Copy link
Copy Markdown
Contributor

Additional Description: refactor out MultiplexedStreamImplBase from http2 codec for code sharing with quic codec
Risk Level: low
Testing: enabled Http2IntegrationTest::CodecStreamIdleTimeout for Http3
Fixes #17654
Part of #16652

danzh1989 added 13 commits July 29, 2021 18:14
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
@alyssawilk
Copy link
Copy Markdown
Contributor

@yanavlasov would you be willing to do first pass on this one?

::Envoy::Http2::Utility::initializeAndValidateOptions(
envoy::config::core::v3::Http2ProtocolOptions());
http2_options.mutable_initial_stream_window_size()->set_value(65535);
http2_options.mutable_initial_stream_window_size()->set_value(32 * 1024);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for H/2 the 64K is the minimum. The 32K will be ignored in this case and 64K is applied.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! In fact, the test still pass with H2. After looking to the log, it seems that before 64k flow control limit kicks in, socket already couldn't send all the data after sending ~32kB. I guess it passes because H2 hit congestion control window with a 32k payload. This is about the same for H3. If the test runs H3 with 64k flow control window, it will be blocked at ~32kB because of CC. As QUICHE needs to ACK packets by itself, not running the event loop of client connection in this test will cause the connection stuck. That's why I uses a smaller flow control window for H3.

To rule out the impact of CC window, I alter the test to still use 64k flow control window for H2 but use 32k for Quic.

@yanavlasov
Copy link
Copy Markdown
Contributor

/wait

Signed-off-by: Dan Zhang <danzh@google.com>
Signed-off-by: Dan Zhang <danzh@google.com>
yanavlasov
yanavlasov previously approved these changes Aug 16, 2021
@yanavlasov
Copy link
Copy Markdown
Contributor

LGTM from me, @alyssawilk for any additional comments

Copy link
Copy Markdown
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! So good to see this gap closed :-)
/wait

stream_idle_timer_.reset();
}
}
void destroy() override;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally for overrides we comment the class it's from

// Http::MultiplexedStreamImplBase

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

virtual HeaderMapPtr cloneTrailers(const HeaderMap& trailers) PURE;
virtual void createPendingFlushTimer() PURE;
void onPendingFlushTimer();
void onPendingFlushTimer() override;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would then be moved up with destroy()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

std::chrono::milliseconds stream_idle_timeout_{};
Event::TimerPtr stream_idle_timer_;

protected:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto on commenting the override.
alternately I don't see a reason to not have it public and group it - your call.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. It is only used by base class. So I prefer keep it as protected.

}
}

bool EnvoyQuicClientStream::hasPendingData() { return BufferedDataBytes() > 0; }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe comment how this plays with trailers?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. I added comment in server stream to which this interface actually matters.

const quic::QuicHeaderList& header_list) override;

// Http::MultiplexedStreamImplBase
bool hasPendingData() override;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we disable flush timer for client streams as we do for HTTP/2? or maybe since we have separate classes only inherit for the server stream?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is disabled via overriding setFlushTimeout() to no-op a few lines above.
hasPendingData() is implemented here just because it is pure method in the base class.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I missed it as it wasn't part of the diff, my bad!

Signed-off-by: Dan Zhang <danzh@google.com>
@alyssawilk alyssawilk merged commit 744b7bf into envoyproxy:main Aug 17, 2021
mpuncel added a commit to mpuncel/envoy that referenced this pull request Aug 19, 2021
* main:
  Fix for fuzz tests failing due to invalid corpus paths (envoyproxy#17767)
  kafka: fix integration test (envoyproxy#17764)
  Fix typo in cluster.proto (envoyproxy#17755)
  cluster manager: add drainConnections() API (envoyproxy#17747)
  kafka broker filter: move to contrib (envoyproxy#17750)
  quiche: switch external dependency to github (envoyproxy#17732)
  quiche: implement stream idle timeout in codec (envoyproxy#17674)
  Update c-ares to 1.17.2 (envoyproxy#17704)
  Fix dns resolve fuzz bug (envoyproxy#17107)
  Remove members that shadow members of the base class (envoyproxy#17713)
  thrift proxy: missing parts from the previous PR (envoyproxy#17668)
  thrift-proxy: cleanup ConnectionManager::ActiveRpc (envoyproxy#17734)
  listener: extra warning for deprecated use_proxy_proto field (envoyproxy#17736)
  kafka: add support for metadata request in mesh-filter (envoyproxy#17597)
  upstream: add all host map to priority set for fast host searching (envoyproxy#17290)
  Remove the support for `hidden_envoy_deprecated_per_filter_config` (envoyproxy#17725)
  tls: SDS support for private key providers (envoyproxy#16737)
  bazel: update rules_foreign_cc (envoyproxy#17445)

Signed-off-by: Michael Puncel <mpuncel@squareup.com>
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.

quic flush timer

5 participants