grpc 1.82.0.pre2 → 1.82.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59540275499a3a3d0bcfcd003334702a20a50c003f4d6c30a08ca91ec4450b31
4
- data.tar.gz: d43330bc78a0d1c5ccbcf1915615f927e217700c40cfdc785c03fbb408584acf
3
+ metadata.gz: d9cc5841b368b55c91bc97f60b5949d961d31595bbb785b260d90d387c9a90ff
4
+ data.tar.gz: 147293153cf22a8e79c760b6f25830d2dc3a3b7afcda2b10ff21d3310bb33c24
5
5
  SHA512:
6
- metadata.gz: bde13f653c1b7e53361e553120fc7c2f0e97a0b401c7caf9902018a8a8221d58720a83ee5ee6d71a580587502b1b89591a069fef156581b93799daa7fe780f30
7
- data.tar.gz: 127f3ebdf97fcd03967b717112356d9ec20a62f56cfd0f4c92b21d5aabdd40da25c7166f4cb350fe27bd16896882db89cb017c63ea8ad0908d560970f0e62307
6
+ metadata.gz: 91b69e9858a1d7386c6e53f3ccbe9f9cb022d7957ab3cf6352d48253e2921235e46be0f0f569e1563601968dd16fa42d881be81a3ed231a104c6b8c0399a7ec2
7
+ data.tar.gz: 12c2e74dff4ab27d15d103c6f3c376ce021ae542a68e007c419e049bfc7d5bc96940dda0ba97e24da594801abcde8a9f85f35279bee64c187f327f4c1a9a65b3
data/Makefile CHANGED
@@ -368,7 +368,7 @@ Q = @
368
368
  endif
369
369
 
370
370
  CORE_VERSION = 55.0.0
371
- CPP_VERSION = 1.82.0-pre2
371
+ CPP_VERSION = 1.82.2
372
372
 
373
373
  CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES))
374
374
  CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS)
@@ -21,6 +21,7 @@
21
21
  #include <grpc/support/port_platform.h>
22
22
  #include <inttypes.h>
23
23
 
24
+ #include <cstdint>
24
25
  #include <functional>
25
26
  #include <memory>
26
27
  #include <optional>
@@ -44,6 +45,7 @@
44
45
  #include "src/core/lib/surface/call.h"
45
46
  #include "src/core/lib/transport/transport.h"
46
47
  #include "src/core/telemetry/call_tracer.h"
48
+ #include "src/core/transport/message_size_service_config.h"
47
49
  #include "src/core/util/grpc_check.h"
48
50
  #include "src/core/util/latent_see.h"
49
51
  #include "absl/status/status.h"
@@ -75,8 +77,6 @@ ServerCompressionFilter::Create(const ChannelArgs& args, ChannelFilter::Args) {
75
77
 
76
78
  ChannelCompression::ChannelCompression(const ChannelArgs& args)
77
79
  : max_recv_size_(GetMaxRecvSizeFromChannelArgs(args)),
78
- message_size_service_config_parser_index_(
79
- MessageSizeParser::ParserIndex()),
80
80
  default_compression_algorithm_(
81
81
  DefaultCompressionAlgorithmFromChannelArgs(args).value_or(
82
82
  GRPC_COMPRESS_NONE)),
@@ -118,26 +118,25 @@ MessageHandle ChannelCompression::CompressMessage(
118
118
  return message;
119
119
  }
120
120
  // Try to compress the payload.
121
- SliceBuffer tmp;
122
- SliceBuffer* payload = message->payload();
123
- bool did_compress = grpc_msg_compress(algorithm, payload->c_slice_buffer(),
124
- tmp.c_slice_buffer());
121
+ std::optional<SliceBuffer> compressed =
122
+ MessageCompress(algorithm, *message->payload());
123
+
125
124
  // If we achieved compression send it as compressed, otherwise send it as (to
126
125
  // avoid spending cycles on the receiver decompressing).
127
- if (did_compress) {
126
+ if (compressed.has_value()) {
128
127
  if (GRPC_TRACE_FLAG_ENABLED(compression)) {
129
128
  const char* algo_name;
130
- const size_t before_size = payload->Length();
131
- const size_t after_size = tmp.Length();
129
+ GRPC_CHECK(grpc_compression_algorithm_name(algorithm, &algo_name));
130
+ const size_t before_size = message->payload()->Length();
131
+ const size_t after_size = compressed->Length();
132
132
  const float savings_ratio = 1.0f - (static_cast<float>(after_size) /
133
133
  static_cast<float>(before_size));
134
- GRPC_CHECK(grpc_compression_algorithm_name(algorithm, &algo_name));
135
134
  LOG(INFO) << absl::StrFormat(
136
135
  "Compressed[%s] %" PRIuPTR " bytes vs. %" PRIuPTR
137
136
  " bytes (%.2f%% savings)",
138
137
  algo_name, before_size, after_size, 100 * savings_ratio);
139
138
  }
140
- tmp.Swap(payload);
139
+ *message->payload() = std::move(*compressed);
141
140
  flags |= GRPC_WRITE_INTERNAL_COMPRESS;
142
141
  if (call_tracer != nullptr) {
143
142
  call_tracer->RecordSendCompressedMessage(*message);
@@ -148,7 +147,7 @@ MessageHandle ChannelCompression::CompressMessage(
148
147
  GRPC_CHECK(grpc_compression_algorithm_name(algorithm, &algo_name));
149
148
  LOG(INFO) << "Algorithm '" << algo_name
150
149
  << "' enabled but decided not to compress. Input size: "
151
- << payload->Length();
150
+ << message->payload()->Length();
152
151
  }
153
152
  }
154
153
  return message;
@@ -180,15 +179,17 @@ absl::StatusOr<MessageHandle> ChannelCompression::DecompressMessage(
180
179
  return std::move(message);
181
180
  }
182
181
  // Try to decompress the payload.
183
- SliceBuffer decompressed_slices;
184
- if (grpc_msg_decompress(args.algorithm, message->payload()->c_slice_buffer(),
185
- decompressed_slices.c_slice_buffer()) == 0) {
186
- return absl::InternalError(
187
- absl::StrCat("Unexpected error decompressing data for algorithm ",
188
- CompressionAlgorithmAsString(args.algorithm)));
182
+ std::optional<uint32_t> max_output_size = IsMessageSizeRefactoringEnabled()
183
+ ? args.max_recv_message_length
184
+ : std::nullopt;
185
+ absl::StatusOr<SliceBuffer> decompressed_slices =
186
+ MessageDecompress(args.algorithm, *message->payload(), max_output_size);
187
+ if (!decompressed_slices.ok()) {
188
+ return decompressed_slices.status();
189
189
  }
190
- // Swap the decompressed slices into the message.
191
- message->payload()->Swap(&decompressed_slices);
190
+
191
+ // Move the decompressed slices into the message.
192
+ *message->payload() = std::move(*decompressed_slices);
192
193
  message->mutable_flags() &= ~GRPC_WRITE_INTERNAL_COMPRESS;
193
194
  message->mutable_flags() |= GRPC_WRITE_INTERNAL_TEST_ONLY_WAS_COMPRESSED;
194
195
  if (call_tracer != nullptr) {
@@ -213,18 +214,10 @@ grpc_compression_algorithm ChannelCompression::HandleOutgoingMetadata(
213
214
  ChannelCompression::DecompressArgs ChannelCompression::HandleIncomingMetadata(
214
215
  const grpc_metadata_batch& incoming_metadata) {
215
216
  // Configure max receive size.
216
- auto max_recv_message_length = max_recv_size_;
217
- const MessageSizeParsedConfig* limits =
218
- MessageSizeParsedConfig::GetFromCallContext(
219
- GetContext<Arena>(), message_size_service_config_parser_index_);
220
- if (limits != nullptr && limits->max_recv_size().has_value() &&
221
- (!max_recv_message_length.has_value() ||
222
- *limits->max_recv_size() < *max_recv_message_length)) {
223
- max_recv_message_length = limits->max_recv_size();
224
- }
225
- return DecompressArgs{incoming_metadata.get(GrpcEncodingMetadata())
226
- .value_or(GRPC_COMPRESS_NONE),
227
- max_recv_message_length};
217
+ return DecompressArgs{
218
+ incoming_metadata.get(GrpcEncodingMetadata())
219
+ .value_or(GRPC_COMPRESS_NONE),
220
+ GetMaxRecvSizeFromCallContext(GetContext<Arena>(), max_recv_size_)};
228
221
  }
229
222
 
230
223
  void ClientCompressionFilter::Call::OnClientInitialMetadata(
@@ -107,7 +107,6 @@ class ChannelCompression {
107
107
  private:
108
108
  // Max receive message length, if set.
109
109
  std::optional<uint32_t> max_recv_size_;
110
- size_t message_size_service_config_parser_index_;
111
110
  // The default, channel-level, compression algorithm.
112
111
  grpc_compression_algorithm default_compression_algorithm_;
113
112
  // Enabled compression algorithms.
@@ -106,6 +106,7 @@
106
106
  #include "src/core/telemetry/stats_data.h"
107
107
  #include "src/core/telemetry/tcp_tracer.h"
108
108
  #include "src/core/transport/auth_context.h"
109
+ #include "src/core/transport/message_size_service_config.h"
109
110
  #include "src/core/util/bitset.h"
110
111
  #include "src/core/util/crash.h"
111
112
  #include "src/core/util/debug_location.h"
@@ -811,6 +812,7 @@ grpc_chttp2_transport::grpc_chttp2_transport(
811
812
  Ref(), &init_keepalive_ping_locked),
812
813
  absl::OkStatus());
813
814
 
815
+ // TODO(tjagtap) : [PH2][P0] : Do this for PH2.
814
816
  if (flow_control.bdp_probe()) {
815
817
  bdp_ping_blocked = true;
816
818
  grpc_chttp2_act_on_flowctl_action(flow_control.PeriodicUpdate(), this,
@@ -854,6 +856,9 @@ grpc_chttp2_transport::grpc_chttp2_transport(
854
856
  epte->SetSocketNode(channelz_socket);
855
857
  }
856
858
  }
859
+
860
+ max_recv_message_length =
861
+ grpc_core::GetMaxRecvSizeFromChannelArgs(channel_args);
857
862
  }
858
863
 
859
864
  static void destroy_transport_locked(void* tp, grpc_error_handle /*error*/) {
@@ -874,6 +879,10 @@ static void close_transport_locked(grpc_chttp2_transport* t,
874
879
  grpc_error_handle error) {
875
880
  end_all_the_calls(t, error);
876
881
  cancel_pings(t, error);
882
+ if (t->transport_framing_endpoint_extension != nullptr) {
883
+ t->transport_framing_endpoint_extension->SetSendFrameCallback(nullptr);
884
+ t->transport_framing_endpoint_extension = nullptr;
885
+ }
877
886
  if (t->closed_with_error.ok()) {
878
887
  if (!grpc_error_has_clear_grpc_status(error)) {
879
888
  error =
@@ -1505,7 +1514,8 @@ static grpc_closure* add_closure_barrier(grpc_closure* closure) {
1505
1514
  return closure;
1506
1515
  }
1507
1516
 
1508
- static void null_then_sched_closure(grpc_closure** closure) {
1517
+ static void null_then_sched_closure_with_error(grpc_closure** closure,
1518
+ grpc_error_handle error) {
1509
1519
  grpc_closure* c = *closure;
1510
1520
  *closure = nullptr;
1511
1521
  // null_then_schedule_closure might be run during a start_batch which might
@@ -1514,7 +1524,11 @@ static void null_then_sched_closure(grpc_closure** closure) {
1514
1524
  // completion, have the application see it, and make a new operation on the
1515
1525
  // call which recycles the batch BEFORE the call to start_batch completes,
1516
1526
  // forcing a race.
1517
- grpc_core::ExecCtx::Run(DEBUG_LOCATION, c, absl::OkStatus());
1527
+ grpc_core::ExecCtx::Run(DEBUG_LOCATION, c, error);
1528
+ }
1529
+
1530
+ static void null_then_sched_closure(grpc_closure** closure) {
1531
+ null_then_sched_closure_with_error(closure, absl::OkStatus());
1518
1532
  }
1519
1533
 
1520
1534
  void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
@@ -2341,6 +2355,8 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_chttp2_transport* t,
2341
2355
  t->registered_method_matcher_cb(t->accept_stream_cb_user_data,
2342
2356
  s->recv_initial_metadata);
2343
2357
  }
2358
+ s->max_recv_message_length =
2359
+ GetMaxRecvSizeFromCallContext(s->arena, t->max_recv_message_length);
2344
2360
  null_then_sched_closure(&s->recv_initial_metadata_ready);
2345
2361
  }
2346
2362
  }
@@ -2413,7 +2429,36 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t,
2413
2429
  *s->call_failed_before_recv_message =
2414
2430
  (s->published_metadata[1] != GRPC_METADATA_PUBLISHED_AT_CLOSE);
2415
2431
  }
2416
- null_then_sched_closure(&s->recv_message_ready);
2432
+ if (s->seen_error && s->message_size_limit_exceeded) {
2433
+ null_then_sched_closure_with_error(&s->recv_message_ready, error);
2434
+ } else {
2435
+ null_then_sched_closure(&s->recv_message_ready);
2436
+ }
2437
+ } else if (s->seen_error && s->message_size_limit_exceeded) {
2438
+ null_then_sched_closure_with_error(&s->recv_message_ready, error);
2439
+ }
2440
+
2441
+ if (grpc_core::IsMessageSizeRefactoringEnabled() && s->seen_error &&
2442
+ s->message_size_limit_exceeded) {
2443
+ s->message_size_limit_exceeded = false;
2444
+ // Explicitly cancel the stream to fail the RPC immediately.
2445
+ // We delay the cancellation until the recv_message_ready closure is
2446
+ // executed to prevent re-entrancy issues. When the HTTP/2 frame deframer
2447
+ // in `grpc_deframe_unprocessed_incoming_frames`
2448
+ // returns a size violation error, invoking `grpc_chttp2_cancel_stream`
2449
+ // immediately triggers `grpc_chttp2_mark_stream_closed`. This in turn
2450
+ // synchronously re-enters `grpc_chttp2_maybe_complete_recv_message` while
2451
+ // the original deframing loop is still active on the call stack.
2452
+ //
2453
+ // Because the re-entrant invocation observes that the incoming frame
2454
+ // storage has been cleared but `s->recv_message_ready` is still non-null,
2455
+ // it preemptively schedules the closure as a standard/non-error stream
2456
+ // termination (i.e., via `null_then_sched_closure(...,
2457
+ // absl::OkStatus())`). By the time control returns to the initial (outer)
2458
+ // deframing loop to execute `null_then_sched_closure_with_error`, the
2459
+ // closure pointer is already null, causing the original error context to
2460
+ // be discarded.
2461
+ grpc_chttp2_cancel_stream(t, s, error, true, nullptr);
2417
2462
  }
2418
2463
  }();
2419
2464
 
@@ -48,6 +48,7 @@ absl::Status grpc_chttp2_data_parser_begin_frame(uint8_t flags,
48
48
  } else {
49
49
  s->received_last_frame = false;
50
50
  }
51
+ ++s->num_frames;
51
52
 
52
53
  return absl::OkStatus();
53
54
  }
@@ -123,6 +124,24 @@ grpc_core::Poll<grpc_error_handle> grpc_deframe_unprocessed_incoming_frames(
123
124
  (static_cast<uint32_t>(header[3]) << 8) |
124
125
  static_cast<uint32_t>(header[4]);
125
126
 
127
+ if (grpc_core::IsMessageSizeRefactoringEnabled()) {
128
+ if (s->max_recv_message_length.has_value() &&
129
+ length > *(s->max_recv_message_length)) {
130
+ error = GRPC_ERROR_CREATE(
131
+ absl::StrFormat("%s: Received message larger than max (%d vs. %u)",
132
+ s->t->is_client ? "CLIENT" : "SERVER", length,
133
+ *(s->max_recv_message_length)));
134
+ error = grpc_error_set_int(error, grpc_core::StatusIntProperty::kStreamId,
135
+ static_cast<intptr_t>(s->id));
136
+ // Attach the explicit gRPC status code to fail the RPC correctly.
137
+ error =
138
+ grpc_error_set_int(error, grpc_core::StatusIntProperty::kRpcStatus,
139
+ GRPC_STATUS_RESOURCE_EXHAUSTED);
140
+ s->message_size_limit_exceeded = true;
141
+ return error;
142
+ }
143
+ }
144
+
126
145
  if (slices->length < length + GRPC_HEADER_SIZE_IN_BYTES) {
127
146
  if (min_progress_size != nullptr) {
128
147
  *min_progress_size = length + GRPC_HEADER_SIZE_IN_BYTES - slices->length;
@@ -138,6 +157,7 @@ grpc_core::Poll<grpc_error_handle> grpc_deframe_unprocessed_incoming_frames(
138
157
  grpc_slice_buffer_move_first_into_buffer(slices, GRPC_HEADER_SIZE_IN_BYTES,
139
158
  header);
140
159
  grpc_slice_buffer_move_first(slices, length, stream_out->c_slice_buffer());
160
+ s->num_frames = 0;
141
161
  }
142
162
 
143
163
  return absl::OkStatus();
@@ -148,8 +168,20 @@ grpc_error_handle grpc_chttp2_data_parser_parse(void* /*parser*/,
148
168
  grpc_chttp2_stream* s,
149
169
  const grpc_slice& slice,
150
170
  int is_last) {
151
- grpc_core::CSliceRef(slice);
152
- grpc_slice_buffer_add(&s->frame_storage, slice);
171
+ const size_t slice_len = GRPC_SLICE_LENGTH(slice);
172
+ bool is_small_frame = 0 < slice_len && slice_len < GRPC_SLICE_INLINED_SIZE;
173
+ bool multiple_small_frames =
174
+ (s->num_frames >= 64) &&
175
+ ((s->frame_storage.length / s->num_frames) < GRPC_SLICE_INLINED_SIZE);
176
+ if (GPR_UNLIKELY(multiple_small_frames && is_small_frame &&
177
+ grpc_core::IsHeaderDataFrameEnabled())) {
178
+ uint8_t* append_ptr =
179
+ grpc_slice_buffer_tiny_add(&s->frame_storage, slice_len);
180
+ memcpy(append_ptr, GRPC_SLICE_START_PTR(slice), slice_len);
181
+ } else {
182
+ grpc_core::CSliceRef(slice);
183
+ grpc_slice_buffer_add(&s->frame_storage, slice);
184
+ }
153
185
  grpc_chttp2_maybe_complete_recv_message(t, s);
154
186
 
155
187
  if (is_last) {
@@ -31,11 +31,15 @@
31
31
  #include "absl/strings/string_view.h"
32
32
 
33
33
  void grpc_chttp2_goaway_parser_init(grpc_chttp2_goaway_parser* p) {
34
- p->debug_data = nullptr;
34
+ if (!grpc_core::IsPh2Perf01Enabled()) {
35
+ p->debug_data = nullptr;
36
+ }
35
37
  }
36
38
 
37
39
  void grpc_chttp2_goaway_parser_destroy(grpc_chttp2_goaway_parser* p) {
38
- gpr_free(p->debug_data);
40
+ if (!grpc_core::IsPh2Perf01Enabled()) {
41
+ gpr_free(p->debug_data);
42
+ }
39
43
  }
40
44
 
41
45
  grpc_error_handle grpc_chttp2_goaway_parser_begin_frame(
@@ -45,10 +49,14 @@ grpc_error_handle grpc_chttp2_goaway_parser_begin_frame(
45
49
  absl::StrFormat("goaway frame too short (%d bytes)", length));
46
50
  }
47
51
 
48
- gpr_free(p->debug_data);
49
52
  p->debug_length = length - 8;
50
- p->debug_data = static_cast<char*>(gpr_malloc(p->debug_length));
51
- p->debug_pos = 0;
53
+ if (grpc_core::IsPh2Perf01Enabled()) {
54
+ p->debug_slice_buffer.Clear();
55
+ } else {
56
+ gpr_free(p->debug_data);
57
+ p->debug_data = static_cast<char*>(gpr_malloc(p->debug_length));
58
+ p->debug_pos = 0;
59
+ }
52
60
  p->state = GRPC_CHTTP2_GOAWAY_LSI0;
53
61
  return absl::OkStatus();
54
62
  }
@@ -130,24 +138,48 @@ grpc_error_handle grpc_chttp2_goaway_parser_parse(void* parser,
130
138
  ++cur;
131
139
  [[fallthrough]];
132
140
  case GRPC_CHTTP2_GOAWAY_DEBUG:
133
- if (end != cur) {
134
- memcpy(p->debug_data + p->debug_pos, cur,
135
- static_cast<size_t>(end - cur));
136
- }
137
- GRPC_CHECK((size_t)(end - cur) < UINT32_MAX - p->debug_pos);
138
- p->debug_pos += static_cast<uint32_t>(end - cur);
139
- p->state = GRPC_CHTTP2_GOAWAY_DEBUG;
140
- if (is_last) {
141
- t->http2_ztrace_collector.Append([p]() {
142
- return grpc_core::H2GoAwayTrace<true>{
143
- p->last_stream_id, p->error_code,
144
- std::string(absl::string_view(p->debug_data, p->debug_length))};
145
- });
146
- grpc_chttp2_add_incoming_goaway(
147
- t, p->error_code, p->last_stream_id,
148
- absl::string_view(p->debug_data, p->debug_length));
149
- gpr_free(p->debug_data);
150
- p->debug_data = nullptr;
141
+ if (grpc_core::IsPh2Perf01Enabled()) {
142
+ if (end != cur) {
143
+ p->debug_slice_buffer.AppendIndexed(
144
+ grpc_core::Slice::FromCopiedBuffer(
145
+ cur, static_cast<size_t>(end - cur)));
146
+ }
147
+ GRPC_CHECK(p->debug_slice_buffer.Length() <= p->debug_length);
148
+ p->state = GRPC_CHTTP2_GOAWAY_DEBUG;
149
+ if (is_last) {
150
+ std::string debug_str = p->debug_slice_buffer.JoinIntoString();
151
+
152
+ grpc_chttp2_add_incoming_goaway(t, p->error_code, p->last_stream_id,
153
+ absl::string_view(debug_str));
154
+
155
+ t->http2_ztrace_collector.Append(
156
+ [last_stream_id = p->last_stream_id, error_code = p->error_code,
157
+ debug_str = std::move(debug_str)]() mutable {
158
+ return grpc_core::H2GoAwayTrace<true>{
159
+ last_stream_id, error_code, std::move(debug_str)};
160
+ });
161
+ p->debug_slice_buffer.Clear();
162
+ }
163
+ } else {
164
+ if (end != cur) {
165
+ memcpy(p->debug_data + p->debug_pos, cur,
166
+ static_cast<size_t>(end - cur));
167
+ }
168
+ GRPC_CHECK((size_t)(end - cur) < UINT32_MAX - p->debug_pos);
169
+ p->debug_pos += static_cast<uint32_t>(end - cur);
170
+ p->state = GRPC_CHTTP2_GOAWAY_DEBUG;
171
+ if (is_last) {
172
+ t->http2_ztrace_collector.Append([p]() {
173
+ return grpc_core::H2GoAwayTrace<true>{
174
+ p->last_stream_id, p->error_code,
175
+ std::string(absl::string_view(p->debug_data, p->debug_length))};
176
+ });
177
+ grpc_chttp2_add_incoming_goaway(
178
+ t, p->error_code, p->last_stream_id,
179
+ absl::string_view(p->debug_data, p->debug_length));
180
+ gpr_free(p->debug_data);
181
+ p->debug_data = nullptr;
182
+ }
151
183
  }
152
184
  return absl::OkStatus();
153
185
  }
@@ -44,6 +44,7 @@ struct grpc_chttp2_goaway_parser {
44
44
  uint32_t last_stream_id;
45
45
  uint32_t error_code;
46
46
  char* debug_data;
47
+ grpc_core::SliceBuffer debug_slice_buffer;
47
48
  uint32_t debug_length;
48
49
  uint32_t debug_pos;
49
50
  };
@@ -625,6 +625,8 @@ struct grpc_chttp2_transport final : public grpc_core::FilterStackTransport,
625
625
 
626
626
  GPR_NO_UNIQUE_ADDRESS grpc_core::latent_see::Flow write_flow;
627
627
 
628
+ std::optional<uint32_t> max_recv_message_length;
629
+
628
630
  // Current mitigation engine, retrieved once per connection.
629
631
  grpc_core::RefCountedPtr<grpc_core::MitigationEngine> mitigation_engine;
630
632
  };
@@ -714,6 +716,7 @@ struct grpc_chttp2_stream {
714
716
  grpc_metadata_batch trailing_metadata_buffer;
715
717
 
716
718
  grpc_slice_buffer frame_storage; // protected by t combiner
719
+ size_t num_frames = 0; // protected by t combiner
717
720
 
718
721
  grpc_core::Timestamp deadline = grpc_core::Timestamp::InfFuture();
719
722
 
@@ -773,6 +776,9 @@ struct grpc_chttp2_stream {
773
776
  // The last time a stream window update was received.
774
777
  grpc_core::Timestamp last_window_update_time =
775
778
  grpc_core::Timestamp::InfPast();
779
+
780
+ bool message_size_limit_exceeded = false;
781
+ std::optional<uint32_t> max_recv_message_length;
776
782
  };
777
783
 
778
784
  /// Transport writing call flow:
@@ -430,6 +430,14 @@ static grpc_error_handle init_frame_parser(grpc_chttp2_transport* t,
430
430
  t->incoming_frame_type));
431
431
  }
432
432
  t->is_first_frame = false;
433
+
434
+ if (grpc_core::IsPh2Perf01Enabled() &&
435
+ t->incoming_frame_size > t->settings.acked().max_frame_size()) {
436
+ return GRPC_ERROR_CREATE(absl::StrFormat(
437
+ "Frame size %d is larger than max frame size %d",
438
+ t->incoming_frame_size, t->settings.acked().max_frame_size()));
439
+ }
440
+
433
441
  if (t->expect_continuation_stream_id != 0) {
434
442
  if (t->incoming_frame_type != GRPC_CHTTP2_FRAME_CONTINUATION) {
435
443
  return GRPC_ERROR_CREATE(
@@ -25,168 +25,203 @@
25
25
  #include <zconf.h>
26
26
  #include <zlib.h>
27
27
 
28
+ #include <algorithm>
29
+ #include <cstdint>
30
+ #include <optional>
31
+
28
32
  #include "src/core/lib/slice/slice.h"
29
33
  #include "src/core/util/grpc_check.h"
34
+ #include "src/core/util/status_helper.h"
30
35
  #include "absl/log/log.h"
36
+ #include "absl/status/status.h"
37
+ #include "absl/status/statusor.h"
31
38
 
32
39
  #define OUTPUT_BLOCK_SIZE 1024
33
40
 
34
- static int zlib_body(z_stream* zs, grpc_slice_buffer* input,
35
- grpc_slice_buffer* output,
36
- int (*flate)(z_stream* zs, int flush)) {
41
+ namespace grpc_core {
42
+ namespace {
43
+
44
+ absl::StatusOr<SliceBuffer> ZlibBody(z_stream* zs, const SliceBuffer& input,
45
+ int (*flate)(z_stream* zs, int flush),
46
+ std::optional<uint32_t> max_output_size) {
37
47
  int r = Z_STREAM_END; // Do not fail on an empty input.
38
48
  int flush;
39
49
  size_t i;
40
- grpc_slice outbuf = GRPC_SLICE_MALLOC(OUTPUT_BLOCK_SIZE);
50
+ uint32_t remaining_output_size = max_output_size.value_or(UINT32_MAX);
51
+ SliceBuffer output_sb;
41
52
  const uInt uint_max = ~uInt{0};
53
+ auto outbuf = MutableSlice::CreateUninitialized(
54
+ std::min<uint32_t>(remaining_output_size, OUTPUT_BLOCK_SIZE));
42
55
 
43
- GRPC_CHECK(GRPC_SLICE_LENGTH(outbuf) <= uint_max);
44
- zs->avail_out = static_cast<uInt> GRPC_SLICE_LENGTH(outbuf);
45
- zs->next_out = GRPC_SLICE_START_PTR(outbuf);
56
+ GRPC_CHECK(outbuf.length() <= uint_max);
57
+ zs->avail_out = static_cast<uInt>(outbuf.length());
58
+ zs->next_out = const_cast<uint8_t*>(outbuf.begin());
46
59
  flush = Z_NO_FLUSH;
47
- for (i = 0; i < input->count; i++) {
48
- if (i == input->count - 1) flush = Z_FINISH;
49
- GRPC_CHECK(GRPC_SLICE_LENGTH(input->slices[i]) <= uint_max);
50
- zs->avail_in = static_cast<uInt> GRPC_SLICE_LENGTH(input->slices[i]);
51
- zs->next_in = GRPC_SLICE_START_PTR(input->slices[i]);
60
+ for (i = 0; i < input.Count(); i++) {
61
+ if (i == input.Count() - 1) {
62
+ flush = Z_FINISH;
63
+ }
64
+ GRPC_CHECK(input[i].length() <= uint_max);
65
+ zs->avail_in = static_cast<uInt>(input[i].length());
66
+ zs->next_in = const_cast<uint8_t*>(input[i].begin());
52
67
  do {
53
68
  if (zs->avail_out == 0) {
54
- grpc_slice_buffer_add_indexed(output, outbuf);
55
- outbuf = GRPC_SLICE_MALLOC(OUTPUT_BLOCK_SIZE);
56
- GRPC_CHECK(GRPC_SLICE_LENGTH(outbuf) <= uint_max);
57
- zs->avail_out = static_cast<uInt> GRPC_SLICE_LENGTH(outbuf);
58
- zs->next_out = GRPC_SLICE_START_PTR(outbuf);
69
+ if (max_output_size.has_value() && remaining_output_size == 0) {
70
+ VLOG(2) << "zlib: max provided output size exceeded";
71
+ return absl::ResourceExhaustedError(
72
+ "Decompressed message larger than max");
73
+ }
74
+ output_sb.AppendIndexed(Slice(std::move(outbuf)));
75
+ outbuf = MutableSlice::CreateUninitialized(
76
+ std::min<uint32_t>(remaining_output_size, OUTPUT_BLOCK_SIZE));
77
+ // Update remaining output size to reflect the size of the slice we just
78
+ // filled with compressed / decompressed data.
79
+ if (max_output_size.has_value()) {
80
+ remaining_output_size -= outbuf.length();
81
+ }
82
+ GRPC_CHECK(outbuf.length() <= uint_max);
83
+ zs->avail_out = static_cast<uInt>(outbuf.length());
84
+ zs->next_out = const_cast<uint8_t*>(outbuf.begin());
59
85
  }
60
86
  r = flate(zs, flush);
61
87
  if (r < 0 && r != Z_BUF_ERROR /* not fatal */) {
62
88
  VLOG(2) << "zlib error (" << r << ")";
63
- goto error;
89
+ return absl::InternalError("Decompression failed due to zlib error");
64
90
  }
65
91
  } while (zs->avail_out == 0);
66
92
  if (zs->avail_in) {
67
93
  VLOG(2) << "zlib: not all input consumed";
68
- goto error;
94
+ return absl::InternalError(
95
+ "Decompression failed due to not all input "
96
+ "consumed");
69
97
  }
70
98
  }
71
99
  if (r != Z_STREAM_END) {
72
100
  VLOG(2) << "zlib: Data error";
73
- goto error;
101
+ return absl::InternalError("Decompression failed due to data error");
74
102
  }
75
103
 
76
- GRPC_CHECK(outbuf.refcount);
77
- outbuf.data.refcounted.length -= zs->avail_out;
78
- grpc_slice_buffer_add_indexed(output, outbuf);
79
-
80
- return 1;
81
-
82
- error:
83
- grpc_core::CSliceUnref(outbuf);
84
- return 0;
104
+ // TODO(vigneshbabu): Add a Truncate() method to the Slice type to avoid using
105
+ // the underlying C type here.
106
+ grpc_slice slice = outbuf.TakeCSlice();
107
+ if (slice.refcount) {
108
+ slice.data.refcounted.length -= zs->avail_out;
109
+ } else {
110
+ slice.data.inlined.length -= zs->avail_out;
111
+ }
112
+ output_sb.AppendIndexed(Slice(slice));
113
+ return output_sb;
85
114
  }
86
115
 
87
- static void* zalloc_gpr(void* /*opaque*/, unsigned int items,
88
- unsigned int size) {
116
+ void* ZallocGpr(void* /*opaque*/, unsigned int items, unsigned int size) {
89
117
  return gpr_malloc(items * size);
90
118
  }
91
119
 
92
- static void zfree_gpr(void* /*opaque*/, void* address) { gpr_free(address); }
120
+ void ZFreeGpr(void* /*opaque*/, void* address) { gpr_free(address); }
93
121
 
94
- static int zlib_compress(grpc_slice_buffer* input, grpc_slice_buffer* output,
95
- int gzip) {
122
+ std::optional<SliceBuffer> ZlibCompress(const SliceBuffer& input, int gzip) {
96
123
  z_stream zs;
97
- int r;
98
- size_t i;
99
- size_t count_before = output->count;
100
- size_t length_before = output->length;
124
+ absl::StatusOr<SliceBuffer> compression_result;
101
125
  memset(&zs, 0, sizeof(zs));
102
- zs.zalloc = zalloc_gpr;
103
- zs.zfree = zfree_gpr;
104
- r = deflateInit2(&zs, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 15 | (gzip ? 16 : 0),
105
- 8, Z_DEFAULT_STRATEGY);
126
+ zs.zalloc = ZallocGpr;
127
+ zs.zfree = ZFreeGpr;
128
+ bool r = deflateInit2(&zs, Z_DEFAULT_COMPRESSION, Z_DEFLATED,
129
+ 15 | (gzip ? 16 : 0), 8, Z_DEFAULT_STRATEGY);
106
130
  GRPC_CHECK(r == Z_OK);
107
- r = zlib_body(&zs, input, output, deflate) && output->length < input->length;
108
- if (!r) {
109
- for (i = count_before; i < output->count; i++) {
110
- grpc_core::CSliceUnref(output->slices[i]);
111
- }
112
- output->count = count_before;
113
- output->length = length_before;
114
- }
131
+ compression_result = ZlibBody(&zs, input, deflate, input.Length());
115
132
  deflateEnd(&zs);
116
- return r;
133
+ if (compression_result.ok() &&
134
+ compression_result->Length() < input.Length()) {
135
+ return std::move(*compression_result);
136
+ }
137
+ return std::nullopt;
117
138
  }
118
139
 
119
- static int zlib_decompress(grpc_slice_buffer* input, grpc_slice_buffer* output,
120
- int gzip) {
140
+ absl::StatusOr<SliceBuffer> ZlibDecompress(
141
+ const SliceBuffer& input, int gzip,
142
+ std::optional<uint32_t> max_output_size) {
121
143
  z_stream zs;
122
- int r;
123
- size_t i;
124
- size_t count_before = output->count;
125
- size_t length_before = output->length;
144
+ absl::StatusOr<SliceBuffer> decompression_result;
126
145
  memset(&zs, 0, sizeof(zs));
127
- zs.zalloc = zalloc_gpr;
128
- zs.zfree = zfree_gpr;
129
- r = inflateInit2(&zs, 15 | (gzip ? 16 : 0));
146
+ zs.zalloc = ZallocGpr;
147
+ zs.zfree = ZFreeGpr;
148
+ bool r = inflateInit2(&zs, 15 | (gzip ? 16 : 0));
130
149
  GRPC_CHECK(r == Z_OK);
131
- r = zlib_body(&zs, input, output, inflate);
132
- if (!r) {
133
- for (i = count_before; i < output->count; i++) {
134
- grpc_core::CSliceUnref(output->slices[i]);
135
- }
136
- output->count = count_before;
137
- output->length = length_before;
138
- }
150
+ decompression_result = ZlibBody(&zs, input, inflate, max_output_size);
139
151
  inflateEnd(&zs);
140
- return r;
152
+ return decompression_result;
141
153
  }
142
154
 
143
- static int copy(grpc_slice_buffer* input, grpc_slice_buffer* output) {
144
- size_t i;
145
- for (i = 0; i < input->count; i++) {
146
- grpc_slice_buffer_add(output, grpc_core::CSliceRef(input->slices[i]));
147
- }
148
- return 1;
149
- }
155
+ } // namespace
150
156
 
151
- static int compress_inner(grpc_compression_algorithm algorithm,
152
- grpc_slice_buffer* input, grpc_slice_buffer* output) {
157
+ std::optional<SliceBuffer> MessageCompress(grpc_compression_algorithm algorithm,
158
+ const SliceBuffer& input) {
153
159
  switch (algorithm) {
154
160
  case GRPC_COMPRESS_NONE:
155
161
  // the fallback path always needs to be send uncompressed: we simply
156
162
  // rely on that here
157
- return 0;
163
+ return std::nullopt;
158
164
  case GRPC_COMPRESS_DEFLATE:
159
- return zlib_compress(input, output, 0);
165
+ return ZlibCompress(input, 0);
160
166
  case GRPC_COMPRESS_GZIP:
161
- return zlib_compress(input, output, 1);
167
+ return ZlibCompress(input, 1);
162
168
  case GRPC_COMPRESS_ALGORITHMS_COUNT:
163
169
  break;
164
170
  }
165
171
  LOG(ERROR) << "invalid compression algorithm " << algorithm;
166
- return 0;
172
+ return std::nullopt;
167
173
  }
168
174
 
175
+ absl::StatusOr<SliceBuffer> MessageDecompress(
176
+ grpc_compression_algorithm algorithm, const SliceBuffer& input,
177
+ std::optional<uint32_t> max_output_size) {
178
+ switch (algorithm) {
179
+ case GRPC_COMPRESS_NONE: {
180
+ SliceBuffer output;
181
+ output.Append(input);
182
+ return output;
183
+ }
184
+ case GRPC_COMPRESS_DEFLATE:
185
+ return ZlibDecompress(input, 0, max_output_size);
186
+ case GRPC_COMPRESS_GZIP:
187
+ return ZlibDecompress(input, 1, max_output_size);
188
+ case GRPC_COMPRESS_ALGORITHMS_COUNT:
189
+ break;
190
+ }
191
+ LOG(ERROR) << "invalid compression algorithm " << algorithm;
192
+ return absl::InternalError("Invalid compression algorithm");
193
+ }
194
+
195
+ } // namespace grpc_core
196
+
169
197
  int grpc_msg_compress(grpc_compression_algorithm algorithm,
170
198
  grpc_slice_buffer* input, grpc_slice_buffer* output) {
171
- if (!compress_inner(algorithm, input, output)) {
172
- copy(input, output);
173
- return 0;
199
+ int retval = 1;
200
+ grpc_core::SliceBuffer input_sb;
201
+ grpc_slice_buffer_swap(input, input_sb.c_slice_buffer());
202
+ std::optional<grpc_core::SliceBuffer> output_sb =
203
+ grpc_core::MessageCompress(algorithm, input_sb);
204
+ if (!output_sb.has_value()) {
205
+ output_sb.emplace();
206
+ output_sb->Append(input_sb);
207
+ retval = 0;
174
208
  }
175
- return 1;
209
+ grpc_slice_buffer_swap(input, input_sb.c_slice_buffer());
210
+ grpc_slice_buffer_swap(output, output_sb->c_slice_buffer());
211
+ return retval;
176
212
  }
177
213
 
178
214
  int grpc_msg_decompress(grpc_compression_algorithm algorithm,
179
215
  grpc_slice_buffer* input, grpc_slice_buffer* output) {
180
- switch (algorithm) {
181
- case GRPC_COMPRESS_NONE:
182
- return copy(input, output);
183
- case GRPC_COMPRESS_DEFLATE:
184
- return zlib_decompress(input, output, 0);
185
- case GRPC_COMPRESS_GZIP:
186
- return zlib_decompress(input, output, 1);
187
- case GRPC_COMPRESS_ALGORITHMS_COUNT:
188
- break;
216
+ grpc_core::SliceBuffer input_sb;
217
+ grpc_slice_buffer_swap(input, input_sb.c_slice_buffer());
218
+
219
+ absl::StatusOr<grpc_core::SliceBuffer> output_sb =
220
+ grpc_core::MessageDecompress(algorithm, input_sb, std::nullopt);
221
+ if (!output_sb.ok()) {
222
+ return 0;
189
223
  }
190
- LOG(ERROR) << "invalid compression algorithm " << algorithm;
191
- return 0;
224
+ grpc_slice_buffer_swap(input, input_sb.c_slice_buffer());
225
+ grpc_slice_buffer_swap(output, output_sb->c_slice_buffer());
226
+ return 1;
192
227
  }
@@ -23,6 +23,13 @@
23
23
  #include <grpc/slice.h>
24
24
  #include <grpc/support/port_platform.h>
25
25
 
26
+ #include <cstdint>
27
+ #include <optional>
28
+
29
+ #include "src/core/lib/slice/slice_buffer.h"
30
+ #include "absl/status/status.h"
31
+ #include "absl/status/statusor.h"
32
+
26
33
  // compress 'input' to 'output' using 'algorithm'.
27
34
  // On success, appends compressed slices to output and returns 1.
28
35
  // On failure, appends uncompressed slices to output and returns 0.
@@ -35,4 +42,21 @@ int grpc_msg_compress(grpc_compression_algorithm algorithm,
35
42
  int grpc_msg_decompress(grpc_compression_algorithm algorithm,
36
43
  grpc_slice_buffer* input, grpc_slice_buffer* output);
37
44
 
45
+ namespace grpc_core {
46
+
47
+ // Compresses 'input' using 'algorithm'.
48
+ // On success, returns a SliceBuffer containing the compressed data.
49
+ // On failure, returns nullopt.
50
+ std::optional<SliceBuffer> MessageCompress(grpc_compression_algorithm algorithm,
51
+ const SliceBuffer& input);
52
+ // Decompresses 'input'.
53
+ // On success, returns a SliceBuffer containing the decompressed data.
54
+ // On failure, returns a non-OK status.
55
+ // Fails if the decompressed data would be larger than max_output_size.
56
+ absl::StatusOr<SliceBuffer> MessageDecompress(
57
+ grpc_compression_algorithm algorithm, const SliceBuffer& input,
58
+ std::optional<uint32_t> max_output_size);
59
+
60
+ } // namespace grpc_core
61
+
38
62
  #endif // GRPC_SRC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H
@@ -109,6 +109,9 @@ const char* const description_h2_max_deallocating_streams_headroom =
109
109
  "Separate allocated max concurrent streams.";
110
110
  const char* const additional_constraints_h2_max_deallocating_streams_headroom =
111
111
  "{}";
112
+ const char* const description_header_data_frame =
113
+ "Managing header and data memory better";
114
+ const char* const additional_constraints_header_data_frame = "{}";
112
115
  const char* const description_inproc_cancel_stream =
113
116
  "If set, cancel inproc stream inside the transport mutex.";
114
117
  const char* const additional_constraints_inproc_cancel_stream = "{}";
@@ -349,6 +352,8 @@ const ExperimentMetadata g_experiment_metadata[] = {
349
352
  description_h2_max_deallocating_streams_headroom,
350
353
  additional_constraints_h2_max_deallocating_streams_headroom, nullptr, 0,
351
354
  false, true},
355
+ {"header_data_frame", description_header_data_frame,
356
+ additional_constraints_header_data_frame, nullptr, 0, true, true},
352
357
  {"inproc_cancel_stream", description_inproc_cancel_stream,
353
358
  additional_constraints_inproc_cancel_stream, nullptr, 0, true, true},
354
359
  {"keep_alive_ping_timer_batch", description_keep_alive_ping_timer_batch,
@@ -365,7 +370,7 @@ const ExperimentMetadata g_experiment_metadata[] = {
365
370
  {"memory_optimization_02", description_memory_optimization_02,
366
371
  additional_constraints_memory_optimization_02, nullptr, 0, false, false},
367
372
  {"message_size_refactoring", description_message_size_refactoring,
368
- additional_constraints_message_size_refactoring, nullptr, 0, false, true},
373
+ additional_constraints_message_size_refactoring, nullptr, 0, true, true},
369
374
  {"metadata_outstanding_token_refactor",
370
375
  description_metadata_outstanding_token_refactor,
371
376
  additional_constraints_metadata_outstanding_token_refactor, nullptr, 0,
@@ -393,7 +398,7 @@ const ExperimentMetadata g_experiment_metadata[] = {
393
398
  {"ph2_client_server", description_ph2_client_server,
394
399
  additional_constraints_ph2_client_server, nullptr, 0, false, true},
395
400
  {"ph2_perf_01", description_ph2_perf_01, additional_constraints_ph2_perf_01,
396
- nullptr, 0, false, true},
401
+ nullptr, 0, true, true},
397
402
  {"ph2_server", description_ph2_server, additional_constraints_ph2_server,
398
403
  nullptr, 0, false, true},
399
404
  {"pick_first_ignore_empty_updates",
@@ -577,6 +582,9 @@ const char* const description_h2_max_deallocating_streams_headroom =
577
582
  "Separate allocated max concurrent streams.";
578
583
  const char* const additional_constraints_h2_max_deallocating_streams_headroom =
579
584
  "{}";
585
+ const char* const description_header_data_frame =
586
+ "Managing header and data memory better";
587
+ const char* const additional_constraints_header_data_frame = "{}";
580
588
  const char* const description_inproc_cancel_stream =
581
589
  "If set, cancel inproc stream inside the transport mutex.";
582
590
  const char* const additional_constraints_inproc_cancel_stream = "{}";
@@ -817,6 +825,8 @@ const ExperimentMetadata g_experiment_metadata[] = {
817
825
  description_h2_max_deallocating_streams_headroom,
818
826
  additional_constraints_h2_max_deallocating_streams_headroom, nullptr, 0,
819
827
  false, true},
828
+ {"header_data_frame", description_header_data_frame,
829
+ additional_constraints_header_data_frame, nullptr, 0, true, true},
820
830
  {"inproc_cancel_stream", description_inproc_cancel_stream,
821
831
  additional_constraints_inproc_cancel_stream, nullptr, 0, true, true},
822
832
  {"keep_alive_ping_timer_batch", description_keep_alive_ping_timer_batch,
@@ -833,7 +843,7 @@ const ExperimentMetadata g_experiment_metadata[] = {
833
843
  {"memory_optimization_02", description_memory_optimization_02,
834
844
  additional_constraints_memory_optimization_02, nullptr, 0, false, false},
835
845
  {"message_size_refactoring", description_message_size_refactoring,
836
- additional_constraints_message_size_refactoring, nullptr, 0, false, true},
846
+ additional_constraints_message_size_refactoring, nullptr, 0, true, true},
837
847
  {"metadata_outstanding_token_refactor",
838
848
  description_metadata_outstanding_token_refactor,
839
849
  additional_constraints_metadata_outstanding_token_refactor, nullptr, 0,
@@ -861,7 +871,7 @@ const ExperimentMetadata g_experiment_metadata[] = {
861
871
  {"ph2_client_server", description_ph2_client_server,
862
872
  additional_constraints_ph2_client_server, nullptr, 0, false, true},
863
873
  {"ph2_perf_01", description_ph2_perf_01, additional_constraints_ph2_perf_01,
864
- nullptr, 0, false, true},
874
+ nullptr, 0, true, true},
865
875
  {"ph2_server", description_ph2_server, additional_constraints_ph2_server,
866
876
  nullptr, 0, false, true},
867
877
  {"pick_first_ignore_empty_updates",
@@ -1045,6 +1055,9 @@ const char* const description_h2_max_deallocating_streams_headroom =
1045
1055
  "Separate allocated max concurrent streams.";
1046
1056
  const char* const additional_constraints_h2_max_deallocating_streams_headroom =
1047
1057
  "{}";
1058
+ const char* const description_header_data_frame =
1059
+ "Managing header and data memory better";
1060
+ const char* const additional_constraints_header_data_frame = "{}";
1048
1061
  const char* const description_inproc_cancel_stream =
1049
1062
  "If set, cancel inproc stream inside the transport mutex.";
1050
1063
  const char* const additional_constraints_inproc_cancel_stream = "{}";
@@ -1285,6 +1298,8 @@ const ExperimentMetadata g_experiment_metadata[] = {
1285
1298
  description_h2_max_deallocating_streams_headroom,
1286
1299
  additional_constraints_h2_max_deallocating_streams_headroom, nullptr, 0,
1287
1300
  false, true},
1301
+ {"header_data_frame", description_header_data_frame,
1302
+ additional_constraints_header_data_frame, nullptr, 0, true, true},
1288
1303
  {"inproc_cancel_stream", description_inproc_cancel_stream,
1289
1304
  additional_constraints_inproc_cancel_stream, nullptr, 0, true, true},
1290
1305
  {"keep_alive_ping_timer_batch", description_keep_alive_ping_timer_batch,
@@ -1301,7 +1316,7 @@ const ExperimentMetadata g_experiment_metadata[] = {
1301
1316
  {"memory_optimization_02", description_memory_optimization_02,
1302
1317
  additional_constraints_memory_optimization_02, nullptr, 0, false, false},
1303
1318
  {"message_size_refactoring", description_message_size_refactoring,
1304
- additional_constraints_message_size_refactoring, nullptr, 0, false, true},
1319
+ additional_constraints_message_size_refactoring, nullptr, 0, true, true},
1305
1320
  {"metadata_outstanding_token_refactor",
1306
1321
  description_metadata_outstanding_token_refactor,
1307
1322
  additional_constraints_metadata_outstanding_token_refactor, nullptr, 0,
@@ -1329,7 +1344,7 @@ const ExperimentMetadata g_experiment_metadata[] = {
1329
1344
  {"ph2_client_server", description_ph2_client_server,
1330
1345
  additional_constraints_ph2_client_server, nullptr, 0, false, true},
1331
1346
  {"ph2_perf_01", description_ph2_perf_01, additional_constraints_ph2_perf_01,
1332
- nullptr, 0, false, true},
1347
+ nullptr, 0, true, true},
1333
1348
  {"ph2_server", description_ph2_server, additional_constraints_ph2_server,
1334
1349
  nullptr, 0, false, true},
1335
1350
  {"pick_first_ignore_empty_updates",
@@ -96,6 +96,8 @@ inline bool IsFailRecvMetadataOnDeadlineExceededEnabled() { return false; }
96
96
  inline bool IsFreeLargeAllocatorEnabled() { return false; }
97
97
  inline bool IsFuseFiltersEnabled() { return false; }
98
98
  inline bool IsH2MaxDeallocatingStreamsHeadroomEnabled() { return false; }
99
+ #define GRPC_EXPERIMENT_IS_INCLUDED_HEADER_DATA_FRAME
100
+ inline bool IsHeaderDataFrameEnabled() { return true; }
99
101
  #define GRPC_EXPERIMENT_IS_INCLUDED_INPROC_CANCEL_STREAM
100
102
  inline bool IsInprocCancelStreamEnabled() { return true; }
101
103
  inline bool IsKeepAlivePingTimerBatchEnabled() { return false; }
@@ -104,7 +106,8 @@ inline bool IsLocalConnectorSecureEnabled() { return false; }
104
106
  inline bool IsMaxInflightPingsStrictLimitEnabled() { return true; }
105
107
  inline bool IsMemoryOptimization01Enabled() { return false; }
106
108
  inline bool IsMemoryOptimization02Enabled() { return false; }
107
- inline bool IsMessageSizeRefactoringEnabled() { return false; }
109
+ #define GRPC_EXPERIMENT_IS_INCLUDED_MESSAGE_SIZE_REFACTORING
110
+ inline bool IsMessageSizeRefactoringEnabled() { return true; }
108
111
  inline bool IsMetadataOutstandingTokenRefactorEnabled() { return false; }
109
112
  #define GRPC_EXPERIMENT_IS_INCLUDED_METADATA_PUBLISH_TO_APP_TAG
110
113
  inline bool IsMetadataPublishToAppTagEnabled() { return true; }
@@ -122,7 +125,8 @@ inline bool IsOptimization04Enabled() { return true; }
122
125
  inline bool IsOtelExportTelemetryDomainsEnabled() { return false; }
123
126
  inline bool IsPh2ClientEnabled() { return false; }
124
127
  inline bool IsPh2ClientServerEnabled() { return false; }
125
- inline bool IsPh2Perf01Enabled() { return false; }
128
+ #define GRPC_EXPERIMENT_IS_INCLUDED_PH2_PERF_01
129
+ inline bool IsPh2Perf01Enabled() { return true; }
126
130
  inline bool IsPh2ServerEnabled() { return false; }
127
131
  inline bool IsPickFirstIgnoreEmptyUpdatesEnabled() { return false; }
128
132
  inline bool IsPipelinedReadSecureEndpointEnabled() { return false; }
@@ -192,6 +196,8 @@ inline bool IsFailRecvMetadataOnDeadlineExceededEnabled() { return false; }
192
196
  inline bool IsFreeLargeAllocatorEnabled() { return false; }
193
197
  inline bool IsFuseFiltersEnabled() { return false; }
194
198
  inline bool IsH2MaxDeallocatingStreamsHeadroomEnabled() { return false; }
199
+ #define GRPC_EXPERIMENT_IS_INCLUDED_HEADER_DATA_FRAME
200
+ inline bool IsHeaderDataFrameEnabled() { return true; }
195
201
  #define GRPC_EXPERIMENT_IS_INCLUDED_INPROC_CANCEL_STREAM
196
202
  inline bool IsInprocCancelStreamEnabled() { return true; }
197
203
  inline bool IsKeepAlivePingTimerBatchEnabled() { return false; }
@@ -200,7 +206,8 @@ inline bool IsLocalConnectorSecureEnabled() { return false; }
200
206
  inline bool IsMaxInflightPingsStrictLimitEnabled() { return true; }
201
207
  inline bool IsMemoryOptimization01Enabled() { return false; }
202
208
  inline bool IsMemoryOptimization02Enabled() { return false; }
203
- inline bool IsMessageSizeRefactoringEnabled() { return false; }
209
+ #define GRPC_EXPERIMENT_IS_INCLUDED_MESSAGE_SIZE_REFACTORING
210
+ inline bool IsMessageSizeRefactoringEnabled() { return true; }
204
211
  inline bool IsMetadataOutstandingTokenRefactorEnabled() { return false; }
205
212
  #define GRPC_EXPERIMENT_IS_INCLUDED_METADATA_PUBLISH_TO_APP_TAG
206
213
  inline bool IsMetadataPublishToAppTagEnabled() { return true; }
@@ -218,7 +225,8 @@ inline bool IsOptimization04Enabled() { return true; }
218
225
  inline bool IsOtelExportTelemetryDomainsEnabled() { return false; }
219
226
  inline bool IsPh2ClientEnabled() { return false; }
220
227
  inline bool IsPh2ClientServerEnabled() { return false; }
221
- inline bool IsPh2Perf01Enabled() { return false; }
228
+ #define GRPC_EXPERIMENT_IS_INCLUDED_PH2_PERF_01
229
+ inline bool IsPh2Perf01Enabled() { return true; }
222
230
  inline bool IsPh2ServerEnabled() { return false; }
223
231
  inline bool IsPickFirstIgnoreEmptyUpdatesEnabled() { return false; }
224
232
  inline bool IsPipelinedReadSecureEndpointEnabled() { return false; }
@@ -288,6 +296,8 @@ inline bool IsFailRecvMetadataOnDeadlineExceededEnabled() { return false; }
288
296
  inline bool IsFreeLargeAllocatorEnabled() { return false; }
289
297
  inline bool IsFuseFiltersEnabled() { return false; }
290
298
  inline bool IsH2MaxDeallocatingStreamsHeadroomEnabled() { return false; }
299
+ #define GRPC_EXPERIMENT_IS_INCLUDED_HEADER_DATA_FRAME
300
+ inline bool IsHeaderDataFrameEnabled() { return true; }
291
301
  #define GRPC_EXPERIMENT_IS_INCLUDED_INPROC_CANCEL_STREAM
292
302
  inline bool IsInprocCancelStreamEnabled() { return true; }
293
303
  inline bool IsKeepAlivePingTimerBatchEnabled() { return false; }
@@ -296,7 +306,8 @@ inline bool IsLocalConnectorSecureEnabled() { return false; }
296
306
  inline bool IsMaxInflightPingsStrictLimitEnabled() { return true; }
297
307
  inline bool IsMemoryOptimization01Enabled() { return false; }
298
308
  inline bool IsMemoryOptimization02Enabled() { return false; }
299
- inline bool IsMessageSizeRefactoringEnabled() { return false; }
309
+ #define GRPC_EXPERIMENT_IS_INCLUDED_MESSAGE_SIZE_REFACTORING
310
+ inline bool IsMessageSizeRefactoringEnabled() { return true; }
300
311
  inline bool IsMetadataOutstandingTokenRefactorEnabled() { return false; }
301
312
  #define GRPC_EXPERIMENT_IS_INCLUDED_METADATA_PUBLISH_TO_APP_TAG
302
313
  inline bool IsMetadataPublishToAppTagEnabled() { return true; }
@@ -314,7 +325,8 @@ inline bool IsOptimization04Enabled() { return true; }
314
325
  inline bool IsOtelExportTelemetryDomainsEnabled() { return false; }
315
326
  inline bool IsPh2ClientEnabled() { return false; }
316
327
  inline bool IsPh2ClientServerEnabled() { return false; }
317
- inline bool IsPh2Perf01Enabled() { return false; }
328
+ #define GRPC_EXPERIMENT_IS_INCLUDED_PH2_PERF_01
329
+ inline bool IsPh2Perf01Enabled() { return true; }
318
330
  inline bool IsPh2ServerEnabled() { return false; }
319
331
  inline bool IsPickFirstIgnoreEmptyUpdatesEnabled() { return false; }
320
332
  inline bool IsPipelinedReadSecureEndpointEnabled() { return false; }
@@ -368,6 +380,7 @@ enum ExperimentIds {
368
380
  kExperimentIdFreeLargeAllocator,
369
381
  kExperimentIdFuseFilters,
370
382
  kExperimentIdH2MaxDeallocatingStreamsHeadroom,
383
+ kExperimentIdHeaderDataFrame,
371
384
  kExperimentIdInprocCancelStream,
372
385
  kExperimentIdKeepAlivePingTimerBatch,
373
386
  kExperimentIdLocalConnectorSecure,
@@ -501,6 +514,10 @@ inline bool IsFuseFiltersEnabled() {
501
514
  inline bool IsH2MaxDeallocatingStreamsHeadroomEnabled() {
502
515
  return IsExperimentEnabled<kExperimentIdH2MaxDeallocatingStreamsHeadroom>();
503
516
  }
517
+ #define GRPC_EXPERIMENT_IS_INCLUDED_HEADER_DATA_FRAME
518
+ inline bool IsHeaderDataFrameEnabled() {
519
+ return IsExperimentEnabled<kExperimentIdHeaderDataFrame>();
520
+ }
504
521
  #define GRPC_EXPERIMENT_IS_INCLUDED_INPROC_CANCEL_STREAM
505
522
  inline bool IsInprocCancelStreamEnabled() {
506
523
  return IsExperimentEnabled<kExperimentIdInprocCancelStream>();
@@ -14,5 +14,5 @@
14
14
 
15
15
  # GRPC contains the General RPC module.
16
16
  module GRPC
17
- VERSION = '1.82.0.pre2'
17
+ VERSION = '1.82.2'
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.82.0.pre2
4
+ version: 1.82.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - gRPC Authors
@@ -3973,7 +3973,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
3973
3973
  - !ruby/object:Gem::Version
3974
3974
  version: '0'
3975
3975
  requirements: []
3976
- rubygems_version: 4.0.15
3976
+ rubygems_version: 4.0.19
3977
3977
  specification_version: 4
3978
3978
  summary: GRPC system in Ruby
3979
3979
  test_files: