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

[http2] Dont drop connections on metadata limit exceeded #32309

Merged
merged 4 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/core/ext/transport/chttp2/transport/hpack_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1227,13 +1227,19 @@ class HPackParser::Parser {
absl::StrCat("; adding ", md.key(), " (length ", md.transport_size(),
"B)", summary.empty() ? "" : " to ", summary);
if (metadata_buffer_ != nullptr) metadata_buffer_->Clear();
// StreamId is used as a signal to skip this stream but keep the connection
// alive
return input_->MaybeSetErrorAndReturn(
[this, summary = std::move(summary)] {
return grpc_error_set_int(
GRPC_ERROR_CREATE(absl::StrCat(
"received initial metadata size exceeds limit (",
*frame_length_, " vs. ", metadata_size_limit_, ")", summary)),
StatusIntProperty::kRpcStatus, GRPC_STATUS_RESOURCE_EXHAUSTED);
grpc_error_set_int(
GRPC_ERROR_CREATE(absl::StrCat(
"received initial metadata size exceeds limit (",
*frame_length_, " vs. ", metadata_size_limit_, ")",
summary)),
StatusIntProperty::kRpcStatus,
GRPC_STATUS_RESOURCE_EXHAUSTED),
StatusIntProperty::kStreamId, 0);
},
false);
}
Expand Down
2 changes: 0 additions & 2 deletions src/core/ext/transport/chttp2/transport/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,6 @@ struct grpc_chttp2_stream {

grpc_core::Timestamp deadline = grpc_core::Timestamp::InfFuture();

/// saw some stream level error
grpc_error_handle forced_close_error;
/// how many header frames have we received?
uint8_t header_frames_received = 0;
/// number of bytes received - reset at end of parse thread execution
Expand Down
7 changes: 3 additions & 4 deletions src/core/ext/transport/chttp2/transport/parsing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "absl/strings/string_view.h"
#include "internal.h"

#include <grpc/slice.h>
#include <grpc/support/log.h>
Expand Down Expand Up @@ -59,6 +60,7 @@
#include "src/core/lib/transport/error_utils.h"
#include "src/core/lib/transport/http2_errors.h"
#include "src/core/lib/transport/metadata_batch.h"
#include "src/core/lib/transport/status_conversion.h"
#include "src/core/lib/transport/transport.h"

using grpc_core::HPackParser;
Expand Down Expand Up @@ -807,10 +809,7 @@ static grpc_error_handle parse_frame_slice(grpc_chttp2_transport* t,
&unused)) {
grpc_chttp2_parsing_become_skip_parser(t);
if (s) {
s->forced_close_error = err;
grpc_chttp2_add_rst_stream_to_next_write(t, t->incoming_stream_id,
GRPC_HTTP2_PROTOCOL_ERROR,
&s->stats.outgoing);
grpc_chttp2_cancel_stream(t, s, std::exchange(err, absl::OkStatus()));
}
}
return err;
Expand Down
1 change: 0 additions & 1 deletion test/core/bad_client/generate_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ BAD_CLIENT_TESTS = {
"headers": test_options(),
"initial_settings_frame": test_options(),
"head_of_line_blocking": test_options(),
"large_metadata": test_options(),
"out_of_bounds": test_options(),
"server_registered_method": test_options(),
"simple_request": test_options(),
Expand Down
112 changes: 0 additions & 112 deletions test/core/bad_client/tests/large_metadata.cc

This file was deleted.