grpc 1.59.0 → 1.59.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +7 -1
  3. data/src/core/ext/filters/http/server/http_server_filter.cc +21 -17
  4. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +504 -361
  5. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +11 -1
  6. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +9 -0
  7. data/src/core/ext/transport/chttp2/transport/internal.h +92 -28
  8. data/src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.cc +44 -0
  9. data/src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.h +67 -0
  10. data/src/core/ext/transport/chttp2/transport/parsing.cc +103 -14
  11. data/src/core/ext/transport/chttp2/transport/ping_callbacks.cc +108 -0
  12. data/src/core/ext/transport/chttp2/transport/ping_callbacks.h +115 -0
  13. data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +26 -4
  14. data/src/core/ext/transport/chttp2/transport/ping_rate_policy.h +16 -1
  15. data/src/core/ext/transport/chttp2/transport/write_size_policy.cc +60 -0
  16. data/src/core/ext/transport/chttp2/transport/write_size_policy.h +66 -0
  17. data/src/core/ext/transport/chttp2/transport/writing.cc +149 -77
  18. data/src/core/lib/channel/promise_based_filter.cc +9 -4
  19. data/src/core/lib/channel/promise_based_filter.h +2 -1
  20. data/src/core/lib/experiments/experiments.cc +222 -0
  21. data/src/core/lib/experiments/experiments.h +135 -0
  22. data/src/core/lib/iomgr/combiner.cc +3 -0
  23. data/src/core/lib/transport/metadata_batch.h +11 -1
  24. data/src/core/lib/transport/transport.h +6 -0
  25. data/src/ruby/lib/grpc/version.rb +1 -1
  26. metadata +9 -3
@@ -88,6 +88,16 @@ const char* const description_keepalive_server_fix =
88
88
  "Allows overriding keepalive_permit_without_calls for servers. Refer "
89
89
  "https://github.com/grpc/grpc/pull/33917 for more information.";
90
90
  const char* const additional_constraints_keepalive_server_fix = "{}";
91
+ const char* const description_overload_protection =
92
+ "If chttp2 has more streams than it can handle open, send RST_STREAM "
93
+ "immediately on new streams appearing.";
94
+ const char* const additional_constraints_overload_protection = "{}";
95
+ const char* const description_separate_ping_from_keepalive =
96
+ "Keep a different keepalive timeout (resolution is seeing data after "
97
+ "sending a ping) from a ping timeout (resolution is getting a ping ack "
98
+ "after sending a ping) The first can be short and determines liveness. The "
99
+ "second can be longer and determines protocol correctness.";
100
+ const char* const additional_constraints_separate_ping_from_keepalive = "{}";
91
101
  const char* const description_work_serializer_dispatch =
92
102
  "Have the work serializer dispatch work to event engine for every "
93
103
  "callback, instead of running things inline in the first thread that "
@@ -107,6 +117,12 @@ const char* const description_round_robin_delegate_to_pick_first =
107
117
  "backend design.";
108
118
  const char* const additional_constraints_round_robin_delegate_to_pick_first =
109
119
  "{}";
120
+ const char* const description_write_size_cap =
121
+ "Limit outgoing writes proportional to the target write size";
122
+ const char* const additional_constraints_write_size_cap = "{}";
123
+ const char* const description_write_size_policy =
124
+ "Try to size writes such that they don't create too large of a backlog";
125
+ const char* const additional_constraints_write_size_policy = "{}";
110
126
  const char* const description_wrr_delegate_to_pick_first =
111
127
  "Change WRR code to delegate to pick_first as per dualstack backend "
112
128
  "design.";
@@ -115,10 +131,42 @@ const char* const description_combiner_offload_to_event_engine =
115
131
  "Offload Combiner work onto the EventEngine instead of the Executor.";
116
132
  const char* const additional_constraints_combiner_offload_to_event_engine =
117
133
  "{}";
134
+ const char* const description_multiping =
135
+ "Allow more than one ping to be in flight at a time by default.";
136
+ const char* const additional_constraints_multiping = "{}";
118
137
  const char* const description_registered_method_lookup_in_transport =
119
138
  "Change registered method's lookup point to transport";
120
139
  const char* const additional_constraints_registered_method_lookup_in_transport =
121
140
  "{}";
141
+ const char* const description_tarpit =
142
+ "If set, tarpit invalid requests for some amount of time";
143
+ const char* const additional_constraints_tarpit = "{}";
144
+ const char* const description_settings_timeout =
145
+ "If set, use the settings timeout to send settings frame to the peer.";
146
+ const char* const additional_constraints_settings_timeout = "{}";
147
+ const char* const description_rstpit =
148
+ "On RST_STREAM on a server, reduce MAX_CONCURRENT_STREAMS for a short "
149
+ "duration";
150
+ const char* const additional_constraints_rstpit = "{}";
151
+ const char* const description_red_max_concurrent_streams =
152
+ "Perform random early rejection of requests that would exceed a newly "
153
+ "reduced MAX_CONCURRENT_STREAMS but are allowed by the current.";
154
+ const char* const additional_constraints_red_max_concurrent_streams = "{}";
155
+ const char* const description_chttp2_batch_requests =
156
+ "Cap the number of requests received by one transport read prior to "
157
+ "offload.";
158
+ const char* const additional_constraints_chttp2_batch_requests = "{}";
159
+ const char* const description_chttp2_offload_on_rst_stream =
160
+ "Offload work on RST_STREAM.";
161
+ const char* const additional_constraints_chttp2_offload_on_rst_stream = "{}";
162
+ const char* const description_block_excessive_requests_before_settings_ack =
163
+ "If set, block excessive requests before receiving SETTINGS ACK.";
164
+ const char* const
165
+ additional_constraints_block_excessive_requests_before_settings_ack = "{}";
166
+ const char* const description_ping_on_rst_stream =
167
+ "Send a ping on receiving some RST_STREAM frames on the server (proportion "
168
+ "configurable via grpc.http2.ping_on_rst_stream_percent channel arg).";
169
+ const char* const additional_constraints_ping_on_rst_stream = "{}";
122
170
  } // namespace
123
171
 
124
172
  namespace grpc_core {
@@ -164,6 +212,10 @@ const ExperimentMetadata g_experiment_metadata[] = {
164
212
  additional_constraints_keepalive_fix, false, false},
165
213
  {"keepalive_server_fix", description_keepalive_server_fix,
166
214
  additional_constraints_keepalive_server_fix, false, false},
215
+ {"overload_protection", description_overload_protection,
216
+ additional_constraints_overload_protection, true, true},
217
+ {"separate_ping_from_keepalive", description_separate_ping_from_keepalive,
218
+ additional_constraints_separate_ping_from_keepalive, true, true},
167
219
  {"work_serializer_dispatch", description_work_serializer_dispatch,
168
220
  additional_constraints_work_serializer_dispatch, false, true},
169
221
  {"lazier_stream_updates", description_lazier_stream_updates,
@@ -173,14 +225,36 @@ const ExperimentMetadata g_experiment_metadata[] = {
173
225
  {"round_robin_delegate_to_pick_first",
174
226
  description_round_robin_delegate_to_pick_first,
175
227
  additional_constraints_round_robin_delegate_to_pick_first, true, true},
228
+ {"write_size_cap", description_write_size_cap,
229
+ additional_constraints_write_size_cap, true, true},
230
+ {"write_size_policy", description_write_size_policy,
231
+ additional_constraints_write_size_policy, true, true},
176
232
  {"wrr_delegate_to_pick_first", description_wrr_delegate_to_pick_first,
177
233
  additional_constraints_wrr_delegate_to_pick_first, true, true},
178
234
  {"combiner_offload_to_event_engine",
179
235
  description_combiner_offload_to_event_engine,
180
236
  additional_constraints_combiner_offload_to_event_engine, true, true},
237
+ {"multiping", description_multiping, additional_constraints_multiping,
238
+ false, true},
181
239
  {"registered_method_lookup_in_transport",
182
240
  description_registered_method_lookup_in_transport,
183
241
  additional_constraints_registered_method_lookup_in_transport, true, true},
242
+ {"tarpit", description_tarpit, additional_constraints_tarpit, true, true},
243
+ {"settings_timeout", description_settings_timeout,
244
+ additional_constraints_settings_timeout, true, true},
245
+ {"rstpit", description_rstpit, additional_constraints_rstpit, false, true},
246
+ {"red_max_concurrent_streams", description_red_max_concurrent_streams,
247
+ additional_constraints_red_max_concurrent_streams, false, true},
248
+ {"chttp2_batch_requests", description_chttp2_batch_requests,
249
+ additional_constraints_chttp2_batch_requests, true, true},
250
+ {"chttp2_offload_on_rst_stream", description_chttp2_offload_on_rst_stream,
251
+ additional_constraints_chttp2_offload_on_rst_stream, true, true},
252
+ {"block_excessive_requests_before_settings_ack",
253
+ description_block_excessive_requests_before_settings_ack,
254
+ additional_constraints_block_excessive_requests_before_settings_ack, true,
255
+ true},
256
+ {"ping_on_rst_stream", description_ping_on_rst_stream,
257
+ additional_constraints_ping_on_rst_stream, true, true},
184
258
  };
185
259
 
186
260
  } // namespace grpc_core
@@ -253,6 +327,16 @@ const char* const description_keepalive_server_fix =
253
327
  "Allows overriding keepalive_permit_without_calls for servers. Refer "
254
328
  "https://github.com/grpc/grpc/pull/33917 for more information.";
255
329
  const char* const additional_constraints_keepalive_server_fix = "{}";
330
+ const char* const description_overload_protection =
331
+ "If chttp2 has more streams than it can handle open, send RST_STREAM "
332
+ "immediately on new streams appearing.";
333
+ const char* const additional_constraints_overload_protection = "{}";
334
+ const char* const description_separate_ping_from_keepalive =
335
+ "Keep a different keepalive timeout (resolution is seeing data after "
336
+ "sending a ping) from a ping timeout (resolution is getting a ping ack "
337
+ "after sending a ping) The first can be short and determines liveness. The "
338
+ "second can be longer and determines protocol correctness.";
339
+ const char* const additional_constraints_separate_ping_from_keepalive = "{}";
256
340
  const char* const description_work_serializer_dispatch =
257
341
  "Have the work serializer dispatch work to event engine for every "
258
342
  "callback, instead of running things inline in the first thread that "
@@ -272,6 +356,12 @@ const char* const description_round_robin_delegate_to_pick_first =
272
356
  "backend design.";
273
357
  const char* const additional_constraints_round_robin_delegate_to_pick_first =
274
358
  "{}";
359
+ const char* const description_write_size_cap =
360
+ "Limit outgoing writes proportional to the target write size";
361
+ const char* const additional_constraints_write_size_cap = "{}";
362
+ const char* const description_write_size_policy =
363
+ "Try to size writes such that they don't create too large of a backlog";
364
+ const char* const additional_constraints_write_size_policy = "{}";
275
365
  const char* const description_wrr_delegate_to_pick_first =
276
366
  "Change WRR code to delegate to pick_first as per dualstack backend "
277
367
  "design.";
@@ -280,10 +370,42 @@ const char* const description_combiner_offload_to_event_engine =
280
370
  "Offload Combiner work onto the EventEngine instead of the Executor.";
281
371
  const char* const additional_constraints_combiner_offload_to_event_engine =
282
372
  "{}";
373
+ const char* const description_multiping =
374
+ "Allow more than one ping to be in flight at a time by default.";
375
+ const char* const additional_constraints_multiping = "{}";
283
376
  const char* const description_registered_method_lookup_in_transport =
284
377
  "Change registered method's lookup point to transport";
285
378
  const char* const additional_constraints_registered_method_lookup_in_transport =
286
379
  "{}";
380
+ const char* const description_tarpit =
381
+ "If set, tarpit invalid requests for some amount of time";
382
+ const char* const additional_constraints_tarpit = "{}";
383
+ const char* const description_settings_timeout =
384
+ "If set, use the settings timeout to send settings frame to the peer.";
385
+ const char* const additional_constraints_settings_timeout = "{}";
386
+ const char* const description_rstpit =
387
+ "On RST_STREAM on a server, reduce MAX_CONCURRENT_STREAMS for a short "
388
+ "duration";
389
+ const char* const additional_constraints_rstpit = "{}";
390
+ const char* const description_red_max_concurrent_streams =
391
+ "Perform random early rejection of requests that would exceed a newly "
392
+ "reduced MAX_CONCURRENT_STREAMS but are allowed by the current.";
393
+ const char* const additional_constraints_red_max_concurrent_streams = "{}";
394
+ const char* const description_chttp2_batch_requests =
395
+ "Cap the number of requests received by one transport read prior to "
396
+ "offload.";
397
+ const char* const additional_constraints_chttp2_batch_requests = "{}";
398
+ const char* const description_chttp2_offload_on_rst_stream =
399
+ "Offload work on RST_STREAM.";
400
+ const char* const additional_constraints_chttp2_offload_on_rst_stream = "{}";
401
+ const char* const description_block_excessive_requests_before_settings_ack =
402
+ "If set, block excessive requests before receiving SETTINGS ACK.";
403
+ const char* const
404
+ additional_constraints_block_excessive_requests_before_settings_ack = "{}";
405
+ const char* const description_ping_on_rst_stream =
406
+ "Send a ping on receiving some RST_STREAM frames on the server (proportion "
407
+ "configurable via grpc.http2.ping_on_rst_stream_percent channel arg).";
408
+ const char* const additional_constraints_ping_on_rst_stream = "{}";
287
409
  } // namespace
288
410
 
289
411
  namespace grpc_core {
@@ -329,6 +451,10 @@ const ExperimentMetadata g_experiment_metadata[] = {
329
451
  additional_constraints_keepalive_fix, false, false},
330
452
  {"keepalive_server_fix", description_keepalive_server_fix,
331
453
  additional_constraints_keepalive_server_fix, false, false},
454
+ {"overload_protection", description_overload_protection,
455
+ additional_constraints_overload_protection, true, true},
456
+ {"separate_ping_from_keepalive", description_separate_ping_from_keepalive,
457
+ additional_constraints_separate_ping_from_keepalive, true, true},
332
458
  {"work_serializer_dispatch", description_work_serializer_dispatch,
333
459
  additional_constraints_work_serializer_dispatch, false, true},
334
460
  {"lazier_stream_updates", description_lazier_stream_updates,
@@ -338,14 +464,36 @@ const ExperimentMetadata g_experiment_metadata[] = {
338
464
  {"round_robin_delegate_to_pick_first",
339
465
  description_round_robin_delegate_to_pick_first,
340
466
  additional_constraints_round_robin_delegate_to_pick_first, true, true},
467
+ {"write_size_cap", description_write_size_cap,
468
+ additional_constraints_write_size_cap, true, true},
469
+ {"write_size_policy", description_write_size_policy,
470
+ additional_constraints_write_size_policy, true, true},
341
471
  {"wrr_delegate_to_pick_first", description_wrr_delegate_to_pick_first,
342
472
  additional_constraints_wrr_delegate_to_pick_first, true, true},
343
473
  {"combiner_offload_to_event_engine",
344
474
  description_combiner_offload_to_event_engine,
345
475
  additional_constraints_combiner_offload_to_event_engine, true, true},
476
+ {"multiping", description_multiping, additional_constraints_multiping,
477
+ false, true},
346
478
  {"registered_method_lookup_in_transport",
347
479
  description_registered_method_lookup_in_transport,
348
480
  additional_constraints_registered_method_lookup_in_transport, true, true},
481
+ {"tarpit", description_tarpit, additional_constraints_tarpit, true, true},
482
+ {"settings_timeout", description_settings_timeout,
483
+ additional_constraints_settings_timeout, true, true},
484
+ {"rstpit", description_rstpit, additional_constraints_rstpit, false, true},
485
+ {"red_max_concurrent_streams", description_red_max_concurrent_streams,
486
+ additional_constraints_red_max_concurrent_streams, false, true},
487
+ {"chttp2_batch_requests", description_chttp2_batch_requests,
488
+ additional_constraints_chttp2_batch_requests, true, true},
489
+ {"chttp2_offload_on_rst_stream", description_chttp2_offload_on_rst_stream,
490
+ additional_constraints_chttp2_offload_on_rst_stream, true, true},
491
+ {"block_excessive_requests_before_settings_ack",
492
+ description_block_excessive_requests_before_settings_ack,
493
+ additional_constraints_block_excessive_requests_before_settings_ack, true,
494
+ true},
495
+ {"ping_on_rst_stream", description_ping_on_rst_stream,
496
+ additional_constraints_ping_on_rst_stream, true, true},
349
497
  };
350
498
 
351
499
  } // namespace grpc_core
@@ -418,6 +566,16 @@ const char* const description_keepalive_server_fix =
418
566
  "Allows overriding keepalive_permit_without_calls for servers. Refer "
419
567
  "https://github.com/grpc/grpc/pull/33917 for more information.";
420
568
  const char* const additional_constraints_keepalive_server_fix = "{}";
569
+ const char* const description_overload_protection =
570
+ "If chttp2 has more streams than it can handle open, send RST_STREAM "
571
+ "immediately on new streams appearing.";
572
+ const char* const additional_constraints_overload_protection = "{}";
573
+ const char* const description_separate_ping_from_keepalive =
574
+ "Keep a different keepalive timeout (resolution is seeing data after "
575
+ "sending a ping) from a ping timeout (resolution is getting a ping ack "
576
+ "after sending a ping) The first can be short and determines liveness. The "
577
+ "second can be longer and determines protocol correctness.";
578
+ const char* const additional_constraints_separate_ping_from_keepalive = "{}";
421
579
  const char* const description_work_serializer_dispatch =
422
580
  "Have the work serializer dispatch work to event engine for every "
423
581
  "callback, instead of running things inline in the first thread that "
@@ -437,6 +595,12 @@ const char* const description_round_robin_delegate_to_pick_first =
437
595
  "backend design.";
438
596
  const char* const additional_constraints_round_robin_delegate_to_pick_first =
439
597
  "{}";
598
+ const char* const description_write_size_cap =
599
+ "Limit outgoing writes proportional to the target write size";
600
+ const char* const additional_constraints_write_size_cap = "{}";
601
+ const char* const description_write_size_policy =
602
+ "Try to size writes such that they don't create too large of a backlog";
603
+ const char* const additional_constraints_write_size_policy = "{}";
440
604
  const char* const description_wrr_delegate_to_pick_first =
441
605
  "Change WRR code to delegate to pick_first as per dualstack backend "
442
606
  "design.";
@@ -445,10 +609,42 @@ const char* const description_combiner_offload_to_event_engine =
445
609
  "Offload Combiner work onto the EventEngine instead of the Executor.";
446
610
  const char* const additional_constraints_combiner_offload_to_event_engine =
447
611
  "{}";
612
+ const char* const description_multiping =
613
+ "Allow more than one ping to be in flight at a time by default.";
614
+ const char* const additional_constraints_multiping = "{}";
448
615
  const char* const description_registered_method_lookup_in_transport =
449
616
  "Change registered method's lookup point to transport";
450
617
  const char* const additional_constraints_registered_method_lookup_in_transport =
451
618
  "{}";
619
+ const char* const description_tarpit =
620
+ "If set, tarpit invalid requests for some amount of time";
621
+ const char* const additional_constraints_tarpit = "{}";
622
+ const char* const description_settings_timeout =
623
+ "If set, use the settings timeout to send settings frame to the peer.";
624
+ const char* const additional_constraints_settings_timeout = "{}";
625
+ const char* const description_rstpit =
626
+ "On RST_STREAM on a server, reduce MAX_CONCURRENT_STREAMS for a short "
627
+ "duration";
628
+ const char* const additional_constraints_rstpit = "{}";
629
+ const char* const description_red_max_concurrent_streams =
630
+ "Perform random early rejection of requests that would exceed a newly "
631
+ "reduced MAX_CONCURRENT_STREAMS but are allowed by the current.";
632
+ const char* const additional_constraints_red_max_concurrent_streams = "{}";
633
+ const char* const description_chttp2_batch_requests =
634
+ "Cap the number of requests received by one transport read prior to "
635
+ "offload.";
636
+ const char* const additional_constraints_chttp2_batch_requests = "{}";
637
+ const char* const description_chttp2_offload_on_rst_stream =
638
+ "Offload work on RST_STREAM.";
639
+ const char* const additional_constraints_chttp2_offload_on_rst_stream = "{}";
640
+ const char* const description_block_excessive_requests_before_settings_ack =
641
+ "If set, block excessive requests before receiving SETTINGS ACK.";
642
+ const char* const
643
+ additional_constraints_block_excessive_requests_before_settings_ack = "{}";
644
+ const char* const description_ping_on_rst_stream =
645
+ "Send a ping on receiving some RST_STREAM frames on the server (proportion "
646
+ "configurable via grpc.http2.ping_on_rst_stream_percent channel arg).";
647
+ const char* const additional_constraints_ping_on_rst_stream = "{}";
452
648
  } // namespace
453
649
 
454
650
  namespace grpc_core {
@@ -494,6 +690,10 @@ const ExperimentMetadata g_experiment_metadata[] = {
494
690
  additional_constraints_keepalive_fix, false, false},
495
691
  {"keepalive_server_fix", description_keepalive_server_fix,
496
692
  additional_constraints_keepalive_server_fix, false, false},
693
+ {"overload_protection", description_overload_protection,
694
+ additional_constraints_overload_protection, true, true},
695
+ {"separate_ping_from_keepalive", description_separate_ping_from_keepalive,
696
+ additional_constraints_separate_ping_from_keepalive, true, true},
497
697
  {"work_serializer_dispatch", description_work_serializer_dispatch,
498
698
  additional_constraints_work_serializer_dispatch, false, true},
499
699
  {"lazier_stream_updates", description_lazier_stream_updates,
@@ -503,14 +703,36 @@ const ExperimentMetadata g_experiment_metadata[] = {
503
703
  {"round_robin_delegate_to_pick_first",
504
704
  description_round_robin_delegate_to_pick_first,
505
705
  additional_constraints_round_robin_delegate_to_pick_first, true, true},
706
+ {"write_size_cap", description_write_size_cap,
707
+ additional_constraints_write_size_cap, true, true},
708
+ {"write_size_policy", description_write_size_policy,
709
+ additional_constraints_write_size_policy, true, true},
506
710
  {"wrr_delegate_to_pick_first", description_wrr_delegate_to_pick_first,
507
711
  additional_constraints_wrr_delegate_to_pick_first, true, true},
508
712
  {"combiner_offload_to_event_engine",
509
713
  description_combiner_offload_to_event_engine,
510
714
  additional_constraints_combiner_offload_to_event_engine, true, true},
715
+ {"multiping", description_multiping, additional_constraints_multiping,
716
+ false, true},
511
717
  {"registered_method_lookup_in_transport",
512
718
  description_registered_method_lookup_in_transport,
513
719
  additional_constraints_registered_method_lookup_in_transport, true, true},
720
+ {"tarpit", description_tarpit, additional_constraints_tarpit, true, true},
721
+ {"settings_timeout", description_settings_timeout,
722
+ additional_constraints_settings_timeout, true, true},
723
+ {"rstpit", description_rstpit, additional_constraints_rstpit, false, true},
724
+ {"red_max_concurrent_streams", description_red_max_concurrent_streams,
725
+ additional_constraints_red_max_concurrent_streams, false, true},
726
+ {"chttp2_batch_requests", description_chttp2_batch_requests,
727
+ additional_constraints_chttp2_batch_requests, true, true},
728
+ {"chttp2_offload_on_rst_stream", description_chttp2_offload_on_rst_stream,
729
+ additional_constraints_chttp2_offload_on_rst_stream, true, true},
730
+ {"block_excessive_requests_before_settings_ack",
731
+ description_block_excessive_requests_before_settings_ack,
732
+ additional_constraints_block_excessive_requests_before_settings_ack, true,
733
+ true},
734
+ {"ping_on_rst_stream", description_ping_on_rst_stream,
735
+ additional_constraints_ping_on_rst_stream, true, true},
514
736
  };
515
737
 
516
738
  } // namespace grpc_core
@@ -77,6 +77,10 @@ inline bool IsCanaryClientPrivacyEnabled() { return false; }
77
77
  inline bool IsServerPrivacyEnabled() { return false; }
78
78
  inline bool IsKeepaliveFixEnabled() { return false; }
79
79
  inline bool IsKeepaliveServerFixEnabled() { return false; }
80
+ #define GRPC_EXPERIMENT_IS_INCLUDED_OVERLOAD_PROTECTION
81
+ inline bool IsOverloadProtectionEnabled() { return true; }
82
+ #define GRPC_EXPERIMENT_IS_INCLUDED_SEPARATE_PING_FROM_KEEPALIVE
83
+ inline bool IsSeparatePingFromKeepaliveEnabled() { return true; }
80
84
  inline bool IsWorkSerializerDispatchEnabled() { return false; }
81
85
  #define GRPC_EXPERIMENT_IS_INCLUDED_LAZIER_STREAM_UPDATES
82
86
  inline bool IsLazierStreamUpdatesEnabled() { return true; }
@@ -84,12 +88,31 @@ inline bool IsLazierStreamUpdatesEnabled() { return true; }
84
88
  inline bool IsJitterMaxIdleEnabled() { return true; }
85
89
  #define GRPC_EXPERIMENT_IS_INCLUDED_ROUND_ROBIN_DELEGATE_TO_PICK_FIRST
86
90
  inline bool IsRoundRobinDelegateToPickFirstEnabled() { return true; }
91
+ #define GRPC_EXPERIMENT_IS_INCLUDED_WRITE_SIZE_CAP
92
+ inline bool IsWriteSizeCapEnabled() { return true; }
93
+ #define GRPC_EXPERIMENT_IS_INCLUDED_WRITE_SIZE_POLICY
94
+ inline bool IsWriteSizePolicyEnabled() { return true; }
87
95
  #define GRPC_EXPERIMENT_IS_INCLUDED_WRR_DELEGATE_TO_PICK_FIRST
88
96
  inline bool IsWrrDelegateToPickFirstEnabled() { return true; }
89
97
  #define GRPC_EXPERIMENT_IS_INCLUDED_COMBINER_OFFLOAD_TO_EVENT_ENGINE
90
98
  inline bool IsCombinerOffloadToEventEngineEnabled() { return true; }
99
+ inline bool IsMultipingEnabled() { return false; }
91
100
  #define GRPC_EXPERIMENT_IS_INCLUDED_REGISTERED_METHOD_LOOKUP_IN_TRANSPORT
92
101
  inline bool IsRegisteredMethodLookupInTransportEnabled() { return true; }
102
+ #define GRPC_EXPERIMENT_IS_INCLUDED_TARPIT
103
+ inline bool IsTarpitEnabled() { return true; }
104
+ #define GRPC_EXPERIMENT_IS_INCLUDED_SETTINGS_TIMEOUT
105
+ inline bool IsSettingsTimeoutEnabled() { return true; }
106
+ inline bool IsRstpitEnabled() { return false; }
107
+ inline bool IsRedMaxConcurrentStreamsEnabled() { return false; }
108
+ #define GRPC_EXPERIMENT_IS_INCLUDED_CHTTP2_BATCH_REQUESTS
109
+ inline bool IsChttp2BatchRequestsEnabled() { return true; }
110
+ #define GRPC_EXPERIMENT_IS_INCLUDED_CHTTP2_OFFLOAD_ON_RST_STREAM
111
+ inline bool IsChttp2OffloadOnRstStreamEnabled() { return true; }
112
+ #define GRPC_EXPERIMENT_IS_INCLUDED_BLOCK_EXCESSIVE_REQUESTS_BEFORE_SETTINGS_ACK
113
+ inline bool IsBlockExcessiveRequestsBeforeSettingsAckEnabled() { return true; }
114
+ #define GRPC_EXPERIMENT_IS_INCLUDED_PING_ON_RST_STREAM
115
+ inline bool IsPingOnRstStreamEnabled() { return true; }
93
116
 
94
117
  #elif defined(GPR_WINDOWS)
95
118
  inline bool IsTcpFrameSizeTuningEnabled() { return false; }
@@ -112,6 +135,10 @@ inline bool IsCanaryClientPrivacyEnabled() { return false; }
112
135
  inline bool IsServerPrivacyEnabled() { return false; }
113
136
  inline bool IsKeepaliveFixEnabled() { return false; }
114
137
  inline bool IsKeepaliveServerFixEnabled() { return false; }
138
+ #define GRPC_EXPERIMENT_IS_INCLUDED_OVERLOAD_PROTECTION
139
+ inline bool IsOverloadProtectionEnabled() { return true; }
140
+ #define GRPC_EXPERIMENT_IS_INCLUDED_SEPARATE_PING_FROM_KEEPALIVE
141
+ inline bool IsSeparatePingFromKeepaliveEnabled() { return true; }
115
142
  inline bool IsWorkSerializerDispatchEnabled() { return false; }
116
143
  #define GRPC_EXPERIMENT_IS_INCLUDED_LAZIER_STREAM_UPDATES
117
144
  inline bool IsLazierStreamUpdatesEnabled() { return true; }
@@ -119,12 +146,31 @@ inline bool IsLazierStreamUpdatesEnabled() { return true; }
119
146
  inline bool IsJitterMaxIdleEnabled() { return true; }
120
147
  #define GRPC_EXPERIMENT_IS_INCLUDED_ROUND_ROBIN_DELEGATE_TO_PICK_FIRST
121
148
  inline bool IsRoundRobinDelegateToPickFirstEnabled() { return true; }
149
+ #define GRPC_EXPERIMENT_IS_INCLUDED_WRITE_SIZE_CAP
150
+ inline bool IsWriteSizeCapEnabled() { return true; }
151
+ #define GRPC_EXPERIMENT_IS_INCLUDED_WRITE_SIZE_POLICY
152
+ inline bool IsWriteSizePolicyEnabled() { return true; }
122
153
  #define GRPC_EXPERIMENT_IS_INCLUDED_WRR_DELEGATE_TO_PICK_FIRST
123
154
  inline bool IsWrrDelegateToPickFirstEnabled() { return true; }
124
155
  #define GRPC_EXPERIMENT_IS_INCLUDED_COMBINER_OFFLOAD_TO_EVENT_ENGINE
125
156
  inline bool IsCombinerOffloadToEventEngineEnabled() { return true; }
157
+ inline bool IsMultipingEnabled() { return false; }
126
158
  #define GRPC_EXPERIMENT_IS_INCLUDED_REGISTERED_METHOD_LOOKUP_IN_TRANSPORT
127
159
  inline bool IsRegisteredMethodLookupInTransportEnabled() { return true; }
160
+ #define GRPC_EXPERIMENT_IS_INCLUDED_TARPIT
161
+ inline bool IsTarpitEnabled() { return true; }
162
+ #define GRPC_EXPERIMENT_IS_INCLUDED_SETTINGS_TIMEOUT
163
+ inline bool IsSettingsTimeoutEnabled() { return true; }
164
+ inline bool IsRstpitEnabled() { return false; }
165
+ inline bool IsRedMaxConcurrentStreamsEnabled() { return false; }
166
+ #define GRPC_EXPERIMENT_IS_INCLUDED_CHTTP2_BATCH_REQUESTS
167
+ inline bool IsChttp2BatchRequestsEnabled() { return true; }
168
+ #define GRPC_EXPERIMENT_IS_INCLUDED_CHTTP2_OFFLOAD_ON_RST_STREAM
169
+ inline bool IsChttp2OffloadOnRstStreamEnabled() { return true; }
170
+ #define GRPC_EXPERIMENT_IS_INCLUDED_BLOCK_EXCESSIVE_REQUESTS_BEFORE_SETTINGS_ACK
171
+ inline bool IsBlockExcessiveRequestsBeforeSettingsAckEnabled() { return true; }
172
+ #define GRPC_EXPERIMENT_IS_INCLUDED_PING_ON_RST_STREAM
173
+ inline bool IsPingOnRstStreamEnabled() { return true; }
128
174
 
129
175
  #else
130
176
  inline bool IsTcpFrameSizeTuningEnabled() { return false; }
@@ -147,6 +193,10 @@ inline bool IsCanaryClientPrivacyEnabled() { return false; }
147
193
  inline bool IsServerPrivacyEnabled() { return false; }
148
194
  inline bool IsKeepaliveFixEnabled() { return false; }
149
195
  inline bool IsKeepaliveServerFixEnabled() { return false; }
196
+ #define GRPC_EXPERIMENT_IS_INCLUDED_OVERLOAD_PROTECTION
197
+ inline bool IsOverloadProtectionEnabled() { return true; }
198
+ #define GRPC_EXPERIMENT_IS_INCLUDED_SEPARATE_PING_FROM_KEEPALIVE
199
+ inline bool IsSeparatePingFromKeepaliveEnabled() { return true; }
150
200
  inline bool IsWorkSerializerDispatchEnabled() { return false; }
151
201
  #define GRPC_EXPERIMENT_IS_INCLUDED_LAZIER_STREAM_UPDATES
152
202
  inline bool IsLazierStreamUpdatesEnabled() { return true; }
@@ -154,12 +204,31 @@ inline bool IsLazierStreamUpdatesEnabled() { return true; }
154
204
  inline bool IsJitterMaxIdleEnabled() { return true; }
155
205
  #define GRPC_EXPERIMENT_IS_INCLUDED_ROUND_ROBIN_DELEGATE_TO_PICK_FIRST
156
206
  inline bool IsRoundRobinDelegateToPickFirstEnabled() { return true; }
207
+ #define GRPC_EXPERIMENT_IS_INCLUDED_WRITE_SIZE_CAP
208
+ inline bool IsWriteSizeCapEnabled() { return true; }
209
+ #define GRPC_EXPERIMENT_IS_INCLUDED_WRITE_SIZE_POLICY
210
+ inline bool IsWriteSizePolicyEnabled() { return true; }
157
211
  #define GRPC_EXPERIMENT_IS_INCLUDED_WRR_DELEGATE_TO_PICK_FIRST
158
212
  inline bool IsWrrDelegateToPickFirstEnabled() { return true; }
159
213
  #define GRPC_EXPERIMENT_IS_INCLUDED_COMBINER_OFFLOAD_TO_EVENT_ENGINE
160
214
  inline bool IsCombinerOffloadToEventEngineEnabled() { return true; }
215
+ inline bool IsMultipingEnabled() { return false; }
161
216
  #define GRPC_EXPERIMENT_IS_INCLUDED_REGISTERED_METHOD_LOOKUP_IN_TRANSPORT
162
217
  inline bool IsRegisteredMethodLookupInTransportEnabled() { return true; }
218
+ #define GRPC_EXPERIMENT_IS_INCLUDED_TARPIT
219
+ inline bool IsTarpitEnabled() { return true; }
220
+ #define GRPC_EXPERIMENT_IS_INCLUDED_SETTINGS_TIMEOUT
221
+ inline bool IsSettingsTimeoutEnabled() { return true; }
222
+ inline bool IsRstpitEnabled() { return false; }
223
+ inline bool IsRedMaxConcurrentStreamsEnabled() { return false; }
224
+ #define GRPC_EXPERIMENT_IS_INCLUDED_CHTTP2_BATCH_REQUESTS
225
+ inline bool IsChttp2BatchRequestsEnabled() { return true; }
226
+ #define GRPC_EXPERIMENT_IS_INCLUDED_CHTTP2_OFFLOAD_ON_RST_STREAM
227
+ inline bool IsChttp2OffloadOnRstStreamEnabled() { return true; }
228
+ #define GRPC_EXPERIMENT_IS_INCLUDED_BLOCK_EXCESSIVE_REQUESTS_BEFORE_SETTINGS_ACK
229
+ inline bool IsBlockExcessiveRequestsBeforeSettingsAckEnabled() { return true; }
230
+ #define GRPC_EXPERIMENT_IS_INCLUDED_PING_ON_RST_STREAM
231
+ inline bool IsPingOnRstStreamEnabled() { return true; }
163
232
  #endif
164
233
 
165
234
  #else
@@ -183,13 +252,26 @@ enum ExperimentIds {
183
252
  kExperimentIdServerPrivacy,
184
253
  kExperimentIdKeepaliveFix,
185
254
  kExperimentIdKeepaliveServerFix,
255
+ kExperimentIdOverloadProtection,
256
+ kExperimentIdSeparatePingFromKeepalive,
186
257
  kExperimentIdWorkSerializerDispatch,
187
258
  kExperimentIdLazierStreamUpdates,
188
259
  kExperimentIdJitterMaxIdle,
189
260
  kExperimentIdRoundRobinDelegateToPickFirst,
261
+ kExperimentIdWriteSizeCap,
262
+ kExperimentIdWriteSizePolicy,
190
263
  kExperimentIdWrrDelegateToPickFirst,
191
264
  kExperimentIdCombinerOffloadToEventEngine,
265
+ kExperimentIdMultiping,
192
266
  kExperimentIdRegisteredMethodLookupInTransport,
267
+ kExperimentIdTarpit,
268
+ kExperimentIdSettingsTimeout,
269
+ kExperimentIdRstpit,
270
+ kExperimentIdRedMaxConcurrentStreams,
271
+ kExperimentIdChttp2BatchRequests,
272
+ kExperimentIdChttp2OffloadOnRstStream,
273
+ kExperimentIdBlockExcessiveRequestsBeforeSettingsAck,
274
+ kExperimentIdPingOnRstStream,
193
275
  kNumExperiments
194
276
  };
195
277
  #define GRPC_EXPERIMENT_IS_INCLUDED_TCP_FRAME_SIZE_TUNING
@@ -268,6 +350,14 @@ inline bool IsKeepaliveFixEnabled() {
268
350
  inline bool IsKeepaliveServerFixEnabled() {
269
351
  return IsExperimentEnabled(kExperimentIdKeepaliveServerFix);
270
352
  }
353
+ #define GRPC_EXPERIMENT_IS_INCLUDED_OVERLOAD_PROTECTION
354
+ inline bool IsOverloadProtectionEnabled() {
355
+ return IsExperimentEnabled(kExperimentIdOverloadProtection);
356
+ }
357
+ #define GRPC_EXPERIMENT_IS_INCLUDED_SEPARATE_PING_FROM_KEEPALIVE
358
+ inline bool IsSeparatePingFromKeepaliveEnabled() {
359
+ return IsExperimentEnabled(kExperimentIdSeparatePingFromKeepalive);
360
+ }
271
361
  #define GRPC_EXPERIMENT_IS_INCLUDED_WORK_SERIALIZER_DISPATCH
272
362
  inline bool IsWorkSerializerDispatchEnabled() {
273
363
  return IsExperimentEnabled(kExperimentIdWorkSerializerDispatch);
@@ -284,6 +374,14 @@ inline bool IsJitterMaxIdleEnabled() {
284
374
  inline bool IsRoundRobinDelegateToPickFirstEnabled() {
285
375
  return IsExperimentEnabled(kExperimentIdRoundRobinDelegateToPickFirst);
286
376
  }
377
+ #define GRPC_EXPERIMENT_IS_INCLUDED_WRITE_SIZE_CAP
378
+ inline bool IsWriteSizeCapEnabled() {
379
+ return IsExperimentEnabled(kExperimentIdWriteSizeCap);
380
+ }
381
+ #define GRPC_EXPERIMENT_IS_INCLUDED_WRITE_SIZE_POLICY
382
+ inline bool IsWriteSizePolicyEnabled() {
383
+ return IsExperimentEnabled(kExperimentIdWriteSizePolicy);
384
+ }
287
385
  #define GRPC_EXPERIMENT_IS_INCLUDED_WRR_DELEGATE_TO_PICK_FIRST
288
386
  inline bool IsWrrDelegateToPickFirstEnabled() {
289
387
  return IsExperimentEnabled(kExperimentIdWrrDelegateToPickFirst);
@@ -292,10 +390,47 @@ inline bool IsWrrDelegateToPickFirstEnabled() {
292
390
  inline bool IsCombinerOffloadToEventEngineEnabled() {
293
391
  return IsExperimentEnabled(kExperimentIdCombinerOffloadToEventEngine);
294
392
  }
393
+ #define GRPC_EXPERIMENT_IS_INCLUDED_MULTIPING
394
+ inline bool IsMultipingEnabled() {
395
+ return IsExperimentEnabled(kExperimentIdMultiping);
396
+ }
295
397
  #define GRPC_EXPERIMENT_IS_INCLUDED_REGISTERED_METHOD_LOOKUP_IN_TRANSPORT
296
398
  inline bool IsRegisteredMethodLookupInTransportEnabled() {
297
399
  return IsExperimentEnabled(kExperimentIdRegisteredMethodLookupInTransport);
298
400
  }
401
+ #define GRPC_EXPERIMENT_IS_INCLUDED_TARPIT
402
+ inline bool IsTarpitEnabled() {
403
+ return IsExperimentEnabled(kExperimentIdTarpit);
404
+ }
405
+ #define GRPC_EXPERIMENT_IS_INCLUDED_SETTINGS_TIMEOUT
406
+ inline bool IsSettingsTimeoutEnabled() {
407
+ return IsExperimentEnabled(kExperimentIdSettingsTimeout);
408
+ }
409
+ #define GRPC_EXPERIMENT_IS_INCLUDED_RSTPIT
410
+ inline bool IsRstpitEnabled() {
411
+ return IsExperimentEnabled(kExperimentIdRstpit);
412
+ }
413
+ #define GRPC_EXPERIMENT_IS_INCLUDED_RED_MAX_CONCURRENT_STREAMS
414
+ inline bool IsRedMaxConcurrentStreamsEnabled() {
415
+ return IsExperimentEnabled(kExperimentIdRedMaxConcurrentStreams);
416
+ }
417
+ #define GRPC_EXPERIMENT_IS_INCLUDED_CHTTP2_BATCH_REQUESTS
418
+ inline bool IsChttp2BatchRequestsEnabled() {
419
+ return IsExperimentEnabled(kExperimentIdChttp2BatchRequests);
420
+ }
421
+ #define GRPC_EXPERIMENT_IS_INCLUDED_CHTTP2_OFFLOAD_ON_RST_STREAM
422
+ inline bool IsChttp2OffloadOnRstStreamEnabled() {
423
+ return IsExperimentEnabled(kExperimentIdChttp2OffloadOnRstStream);
424
+ }
425
+ #define GRPC_EXPERIMENT_IS_INCLUDED_BLOCK_EXCESSIVE_REQUESTS_BEFORE_SETTINGS_ACK
426
+ inline bool IsBlockExcessiveRequestsBeforeSettingsAckEnabled() {
427
+ return IsExperimentEnabled(
428
+ kExperimentIdBlockExcessiveRequestsBeforeSettingsAck);
429
+ }
430
+ #define GRPC_EXPERIMENT_IS_INCLUDED_PING_ON_RST_STREAM
431
+ inline bool IsPingOnRstStreamEnabled() {
432
+ return IsExperimentEnabled(kExperimentIdPingOnRstStream);
433
+ }
299
434
 
300
435
  extern const ExperimentMetadata g_experiment_metadata[kNumExperiments];
301
436
 
@@ -180,6 +180,9 @@ static void offload(void* arg, grpc_error_handle /*error*/) {
180
180
 
181
181
  static void queue_offload(grpc_core::Combiner* lock) {
182
182
  move_next();
183
+ // Make the combiner look uncontended by storing a non-null value here, so
184
+ // that we don't immediately offload again.
185
+ gpr_atm_no_barrier_store(&lock->initiating_exec_ctx_or_null, 1);
183
186
  GRPC_COMBINER_TRACE(gpr_log(GPR_INFO, "C:%p queue_offload", lock));
184
187
  if (grpc_core::IsCombinerOffloadToEventEngineEnabled()) {
185
188
  lock->event_engine->Run([lock] {
@@ -45,6 +45,7 @@
45
45
  #include "src/core/lib/gprpp/packed_table.h"
46
46
  #include "src/core/lib/gprpp/time.h"
47
47
  #include "src/core/lib/gprpp/type_list.h"
48
+ #include "src/core/lib/promise/poll.h"
48
49
  #include "src/core/lib/resource_quota/arena.h"
49
50
  #include "src/core/lib/slice/slice.h"
50
51
  #include "src/core/lib/transport/custom_metadata.h"
@@ -519,6 +520,15 @@ struct GrpcRegisteredMethod {
519
520
  static std::string DisplayValue(void* x);
520
521
  };
521
522
 
523
+ // Annotation added by filters to inform the transport to tarpit this
524
+ // response: add some random delay to thwart certain kinds of attacks.
525
+ struct GrpcTarPit {
526
+ static absl::string_view DebugKey() { return "GrpcTarPit"; }
527
+ static constexpr bool kRepeatable = false;
528
+ using ValueType = Empty;
529
+ static absl::string_view DisplayValue(Empty) { return "tarpit"; }
530
+ };
531
+
522
532
  namespace metadata_detail {
523
533
 
524
534
  // Build a key/value formatted debug string.
@@ -1496,7 +1506,7 @@ using grpc_metadata_batch_base = grpc_core::MetadataMap<
1496
1506
  grpc_core::GrpcStreamNetworkState, grpc_core::PeerString,
1497
1507
  grpc_core::GrpcStatusContext, grpc_core::GrpcStatusFromWire,
1498
1508
  grpc_core::GrpcCallWasCancelled, grpc_core::WaitForReady,
1499
- grpc_core::GrpcTrailersOnly,
1509
+ grpc_core::GrpcTrailersOnly, grpc_core::GrpcTarPit,
1500
1510
  grpc_core::GrpcRegisteredMethod GRPC_CUSTOM_CLIENT_METADATA
1501
1511
  GRPC_CUSTOM_SERVER_METADATA>;
1502
1512
 
@@ -495,6 +495,12 @@ struct grpc_transport_stream_op_batch_payload {
495
495
  // Error contract: the transport that gets this op must cause cancel_error
496
496
  // to be unref'ed after processing it
497
497
  grpc_error_handle cancel_error;
498
+ // If true the transport should endeavor to delay sending the cancellation
499
+ // notification for some small amount of time, in order to foil certain
500
+ // exploits.
501
+ // This should be set for cancellations that result from malformed client
502
+ // initial metadata.
503
+ bool tarpit = false;
498
504
  } cancel_stream;
499
505
 
500
506
  // Indexes correspond to grpc_context_index enum values
@@ -14,5 +14,5 @@
14
14
 
15
15
  # GRPC contains the General RPC module.
16
16
  module GRPC
17
- VERSION = '1.59.0'
17
+ VERSION = '1.59.2'
18
18
  end