grpc 1.38.0 → 1.39.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +50 -19
- data/include/grpc/event_engine/endpoint_config.h +48 -0
- data/include/grpc/event_engine/event_engine.h +13 -15
- data/include/grpc/event_engine/port.h +2 -0
- data/include/grpc/event_engine/slice_allocator.h +17 -7
- data/include/grpc/grpc.h +9 -2
- data/include/grpc/grpc_security.h +32 -0
- data/include/grpc/grpc_security_constants.h +1 -0
- data/include/grpc/impl/codegen/grpc_types.h +17 -13
- data/include/grpc/impl/codegen/port_platform.h +17 -0
- data/src/core/ext/filters/client_channel/client_channel.cc +2 -2
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +2 -0
- data/src/core/ext/filters/client_channel/health/health_check_client.h +3 -3
- data/src/core/ext/filters/client_channel/http_proxy.cc +16 -1
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +755 -0
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +10 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +10 -24
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +63 -95
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_event_engine.cc +31 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_event_engine.cc +28 -0
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -3
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +7 -2
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +15 -3
- data/src/core/ext/filters/client_channel/retry_filter.cc +665 -404
- data/src/core/ext/filters/client_channel/retry_service_config.cc +43 -24
- data/src/core/ext/filters/client_channel/retry_service_config.h +8 -2
- data/src/core/ext/filters/client_idle/client_idle_filter.cc +1 -1
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +6 -0
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +2 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +10 -4
- data/src/core/ext/transport/chttp2/transport/internal.h +1 -0
- data/src/core/ext/transport/chttp2/transport/parsing.cc +2 -2
- data/src/core/ext/transport/inproc/inproc_transport.cc +42 -31
- data/src/core/ext/xds/xds_api.cc +247 -106
- data/src/core/ext/xds/xds_api.h +15 -6
- data/src/core/lib/address_utils/sockaddr_utils.cc +13 -0
- data/src/core/lib/address_utils/sockaddr_utils.h +10 -0
- data/src/core/lib/channel/channelz.h +3 -0
- data/src/core/lib/event_engine/endpoint_config.cc +46 -0
- data/src/core/lib/event_engine/endpoint_config_internal.h +42 -0
- data/src/core/lib/event_engine/event_engine.cc +50 -0
- data/src/core/lib/event_engine/slice_allocator.cc +33 -3
- data/src/core/lib/event_engine/sockaddr.cc +14 -12
- data/src/core/lib/event_engine/sockaddr.h +44 -0
- data/src/core/lib/gpr/wrap_memcpy.cc +2 -1
- data/src/core/lib/gprpp/status_helper.h +3 -0
- data/src/core/lib/iomgr/endpoint_pair_event_engine.cc +33 -0
- data/src/core/lib/iomgr/error.cc +5 -4
- data/src/core/lib/iomgr/error.h +1 -1
- data/src/core/lib/iomgr/event_engine/closure.cc +54 -0
- data/src/core/lib/iomgr/event_engine/closure.h +33 -0
- data/src/core/lib/iomgr/event_engine/endpoint.cc +194 -0
- data/src/core/lib/iomgr/event_engine/endpoint.h +53 -0
- data/src/core/lib/iomgr/event_engine/iomgr.cc +105 -0
- data/src/core/lib/iomgr/event_engine/iomgr.h +24 -0
- data/src/core/lib/iomgr/event_engine/pollset.cc +87 -0
- data/{include/grpc/event_engine/channel_args.h → src/core/lib/iomgr/event_engine/pollset.h} +7 -10
- data/src/core/lib/iomgr/event_engine/promise.h +51 -0
- data/src/core/lib/iomgr/event_engine/resolved_address_internal.cc +41 -0
- data/src/core/lib/iomgr/event_engine/resolved_address_internal.h +35 -0
- data/src/core/lib/iomgr/event_engine/resolver.cc +110 -0
- data/src/core/lib/iomgr/event_engine/tcp.cc +243 -0
- data/src/core/lib/iomgr/event_engine/timer.cc +57 -0
- data/src/core/lib/iomgr/exec_ctx.cc +8 -0
- data/src/core/lib/iomgr/exec_ctx.h +3 -4
- data/src/core/lib/iomgr/executor/threadpool.cc +2 -3
- data/src/core/lib/iomgr/executor/threadpool.h +2 -2
- data/src/core/lib/iomgr/iomgr.cc +1 -1
- data/src/core/lib/iomgr/iomgr_posix.cc +2 -0
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +40 -10
- data/src/core/lib/iomgr/pollset_custom.cc +2 -2
- data/src/core/lib/iomgr/pollset_custom.h +3 -1
- data/src/core/lib/iomgr/pollset_uv.cc +3 -1
- data/src/core/lib/iomgr/pollset_uv.h +5 -1
- data/src/core/lib/iomgr/port.h +7 -5
- data/src/core/lib/iomgr/resolve_address.cc +5 -1
- data/src/core/lib/iomgr/resolve_address.h +6 -0
- data/src/core/lib/iomgr/sockaddr.h +1 -0
- data/src/core/lib/iomgr/socket_mutator.cc +15 -2
- data/src/core/lib/iomgr/socket_mutator.h +26 -2
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +4 -4
- data/src/core/lib/iomgr/socket_utils_posix.h +2 -2
- data/src/core/lib/iomgr/tcp_client_posix.cc +7 -2
- data/src/core/lib/iomgr/tcp_posix.cc +42 -39
- data/src/core/lib/iomgr/tcp_posix.h +8 -0
- data/src/core/lib/iomgr/tcp_server_custom.cc +3 -4
- data/src/core/lib/iomgr/tcp_server_posix.cc +6 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +2 -1
- data/src/core/lib/iomgr/timer.h +6 -1
- data/src/core/lib/security/authorization/authorization_engine.h +44 -0
- data/src/core/lib/security/authorization/authorization_policy_provider.h +32 -0
- data/src/core/lib/security/authorization/authorization_policy_provider_vtable.cc +46 -0
- data/src/core/lib/security/authorization/evaluate_args.cc +209 -0
- data/src/core/lib/security/authorization/evaluate_args.h +91 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +3 -1
- data/src/core/lib/security/credentials/tls/tls_utils.cc +32 -0
- data/src/core/lib/security/credentials/tls/tls_utils.h +13 -0
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +9 -6
- data/src/core/lib/security/security_connector/ssl_utils.cc +5 -0
- data/src/core/lib/surface/call.cc +21 -1
- data/src/core/lib/surface/call.h +11 -0
- data/src/core/lib/surface/completion_queue.cc +22 -22
- data/src/core/lib/surface/completion_queue.h +1 -1
- data/src/core/lib/surface/completion_queue_factory.cc +1 -2
- data/src/core/lib/surface/init.cc +1 -3
- data/src/core/lib/surface/init.h +10 -1
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/error_utils.cc +2 -2
- data/src/core/lib/transport/transport.h +2 -0
- data/src/core/lib/transport/transport_op_string.cc +1 -1
- data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -0
- data/src/core/tsi/alts/crypt/gsec.h +2 -0
- data/src/ruby/ext/grpc/extconf.rb +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +6 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +10 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/boringssl-with-bazel/err_data.c +269 -263
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +8 -6
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/cipher_extra.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +9 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/prime.c +0 -4
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/digest.c +7 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/md32_common.h +87 -121
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md4/md4.c +20 -30
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/md5/md5.c +19 -30
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +1 -4
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +0 -13
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +26 -24
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +10 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha1.c +28 -39
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha256.c +48 -66
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/sha/sha512.c +4 -5
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +362 -371
- data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7_x509.c +4 -2
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/passive.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/rsa_asn1.c +1 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +101 -11
- data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509a.c +3 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +3 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +14 -15
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vpm.c +53 -73
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +31 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509rset.c +3 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_all.c +3 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_req.c +5 -8
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_sig.c +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509a.c +3 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +7 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +5 -8
- data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +66 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +40 -9
- data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +1 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +6 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/ecdsa.h +14 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +19 -11
- data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +325 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +23 -7
- data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +99 -63
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +139 -109
- data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +12 -19
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +48 -50
- data/third_party/boringssl-with-bazel/src/include/openssl/x509_vfy.h +451 -435
- data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +0 -1
- data/third_party/boringssl-with-bazel/src/ssl/d1_both.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/d1_srtp.cc +1 -1
- data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +773 -84
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +80 -47
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +24 -19
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +189 -86
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +45 -56
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +272 -167
- data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/s3_pkt.cc +14 -19
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +34 -102
- data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +2 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +8 -31
- data/third_party/boringssl-with-bazel/src/ssl/ssl_stat.cc +3 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +4 -3
- data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +7 -3
- data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +576 -648
- data/third_party/boringssl-with-bazel/src/ssl/tls13_both.cc +31 -3
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +98 -39
- data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +141 -94
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +58 -68
- metadata +65 -40
- data/third_party/boringssl-with-bazel/src/crypto/hpke/internal.h +0 -267
- data/third_party/boringssl-with-bazel/src/crypto/x509/vpm_int.h +0 -71
@@ -158,11 +158,11 @@ RetryServiceConfigParser::ParseGlobalParams(const grpc_channel_args* /*args*/,
|
|
158
158
|
|
159
159
|
namespace {
|
160
160
|
|
161
|
-
grpc_error_handle ParseRetryPolicy(
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
161
|
+
grpc_error_handle ParseRetryPolicy(
|
162
|
+
const Json& json, int* max_attempts, grpc_millis* initial_backoff,
|
163
|
+
grpc_millis* max_backoff, float* backoff_multiplier,
|
164
|
+
StatusCodeSet* retryable_status_codes,
|
165
|
+
absl::optional<grpc_millis>* per_attempt_recv_timeout) {
|
166
166
|
if (json.type() != Json::Type::OBJECT) {
|
167
167
|
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
168
168
|
"field:retryPolicy error:should be of type object");
|
@@ -170,7 +170,10 @@ grpc_error_handle ParseRetryPolicy(const Json& json, int* max_attempts,
|
|
170
170
|
std::vector<grpc_error_handle> error_list;
|
171
171
|
// Parse maxAttempts.
|
172
172
|
auto it = json.object_value().find("maxAttempts");
|
173
|
-
if (it
|
173
|
+
if (it == json.object_value().end()) {
|
174
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
175
|
+
"field:maxAttempts error:required field missing"));
|
176
|
+
} else {
|
174
177
|
if (it->second.type() != Json::Type::NUMBER) {
|
175
178
|
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
176
179
|
"field:maxAttempts error:should be of type number"));
|
@@ -200,11 +203,14 @@ grpc_error_handle ParseRetryPolicy(const Json& json, int* max_attempts,
|
|
200
203
|
max_backoff, &error_list) &&
|
201
204
|
*max_backoff == 0) {
|
202
205
|
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
203
|
-
"field:maxBackoff error:
|
206
|
+
"field:maxBackoff error:must be greater than 0"));
|
204
207
|
}
|
205
208
|
// Parse backoffMultiplier.
|
206
209
|
it = json.object_value().find("backoffMultiplier");
|
207
|
-
if (it
|
210
|
+
if (it == json.object_value().end()) {
|
211
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
212
|
+
"field:backoffMultiplier error:required field missing"));
|
213
|
+
} else {
|
208
214
|
if (it->second.type() != Json::Type::NUMBER) {
|
209
215
|
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
210
216
|
"field:backoffMultiplier error:should be of type number"));
|
@@ -215,7 +221,7 @@ grpc_error_handle ParseRetryPolicy(const Json& json, int* max_attempts,
|
|
215
221
|
"field:backoffMultiplier error:failed to parse"));
|
216
222
|
} else if (*backoff_multiplier <= 0) {
|
217
223
|
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
218
|
-
"field:backoffMultiplier error:
|
224
|
+
"field:backoffMultiplier error:must be greater than 0"));
|
219
225
|
}
|
220
226
|
}
|
221
227
|
}
|
@@ -224,7 +230,7 @@ grpc_error_handle ParseRetryPolicy(const Json& json, int* max_attempts,
|
|
224
230
|
if (it != json.object_value().end()) {
|
225
231
|
if (it->second.type() != Json::Type::ARRAY) {
|
226
232
|
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
227
|
-
"field:retryableStatusCodes error:
|
233
|
+
"field:retryableStatusCodes error:must be of type array"));
|
228
234
|
} else {
|
229
235
|
for (const Json& element : it->second.array_value()) {
|
230
236
|
if (element.type() != Json::Type::STRING) {
|
@@ -242,19 +248,31 @@ grpc_error_handle ParseRetryPolicy(const Json& json, int* max_attempts,
|
|
242
248
|
}
|
243
249
|
retryable_status_codes->Add(status);
|
244
250
|
}
|
245
|
-
if (retryable_status_codes->Empty()) {
|
246
|
-
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
247
|
-
"field:retryableStatusCodes error:should be non-empty"));
|
248
|
-
};
|
249
251
|
}
|
250
252
|
}
|
251
|
-
//
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
253
|
+
// Parse perAttemptRecvTimeout.
|
254
|
+
it = json.object_value().find("perAttemptRecvTimeout");
|
255
|
+
if (it != json.object_value().end()) {
|
256
|
+
grpc_millis per_attempt_recv_timeout_value;
|
257
|
+
if (!ParseDurationFromJson(it->second, &per_attempt_recv_timeout_value)) {
|
258
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
259
|
+
"field:perAttemptRecvTimeout error:type must be STRING of the "
|
260
|
+
"form given by google.proto.Duration."));
|
261
|
+
} else {
|
262
|
+
*per_attempt_recv_timeout = per_attempt_recv_timeout_value;
|
263
|
+
// TODO(roth): As part of implementing hedging, relax this check such
|
264
|
+
// that we allow a value of 0 if a hedging policy is specified.
|
265
|
+
if (per_attempt_recv_timeout_value == 0) {
|
266
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
267
|
+
"field:perAttemptRecvTimeout error:must be greater than 0"));
|
268
|
+
}
|
257
269
|
}
|
270
|
+
} else if (retryable_status_codes->Empty()) {
|
271
|
+
// If perAttemptRecvTimeout not present, retryableStatusCodes must be
|
272
|
+
// non-empty.
|
273
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
274
|
+
"field:retryableStatusCodes error:must be non-empty if "
|
275
|
+
"perAttemptRecvTimeout not present"));
|
258
276
|
}
|
259
277
|
return GRPC_ERROR_CREATE_FROM_VECTOR("retryPolicy", &error_list);
|
260
278
|
}
|
@@ -274,13 +292,14 @@ RetryServiceConfigParser::ParsePerMethodParams(
|
|
274
292
|
grpc_millis max_backoff = 0;
|
275
293
|
float backoff_multiplier = 0;
|
276
294
|
StatusCodeSet retryable_status_codes;
|
295
|
+
absl::optional<grpc_millis> per_attempt_recv_timeout;
|
277
296
|
*error = ParseRetryPolicy(it->second, &max_attempts, &initial_backoff,
|
278
297
|
&max_backoff, &backoff_multiplier,
|
279
|
-
&retryable_status_codes);
|
298
|
+
&retryable_status_codes, &per_attempt_recv_timeout);
|
280
299
|
if (*error != GRPC_ERROR_NONE) return nullptr;
|
281
|
-
return absl::make_unique<RetryMethodConfig>(
|
282
|
-
|
283
|
-
|
300
|
+
return absl::make_unique<RetryMethodConfig>(
|
301
|
+
max_attempts, initial_backoff, max_backoff, backoff_multiplier,
|
302
|
+
retryable_status_codes, per_attempt_recv_timeout);
|
284
303
|
}
|
285
304
|
|
286
305
|
} // namespace internal
|
@@ -47,12 +47,14 @@ class RetryMethodConfig : public ServiceConfigParser::ParsedConfig {
|
|
47
47
|
public:
|
48
48
|
RetryMethodConfig(int max_attempts, grpc_millis initial_backoff,
|
49
49
|
grpc_millis max_backoff, float backoff_multiplier,
|
50
|
-
StatusCodeSet retryable_status_codes
|
50
|
+
StatusCodeSet retryable_status_codes,
|
51
|
+
absl::optional<grpc_millis> per_attempt_recv_timeout)
|
51
52
|
: max_attempts_(max_attempts),
|
52
53
|
initial_backoff_(initial_backoff),
|
53
54
|
max_backoff_(max_backoff),
|
54
55
|
backoff_multiplier_(backoff_multiplier),
|
55
|
-
retryable_status_codes_(retryable_status_codes)
|
56
|
+
retryable_status_codes_(retryable_status_codes),
|
57
|
+
per_attempt_recv_timeout_(per_attempt_recv_timeout) {}
|
56
58
|
|
57
59
|
int max_attempts() const { return max_attempts_; }
|
58
60
|
grpc_millis initial_backoff() const { return initial_backoff_; }
|
@@ -61,6 +63,9 @@ class RetryMethodConfig : public ServiceConfigParser::ParsedConfig {
|
|
61
63
|
StatusCodeSet retryable_status_codes() const {
|
62
64
|
return retryable_status_codes_;
|
63
65
|
}
|
66
|
+
absl::optional<grpc_millis> per_attempt_recv_timeout() const {
|
67
|
+
return per_attempt_recv_timeout_;
|
68
|
+
}
|
64
69
|
|
65
70
|
private:
|
66
71
|
int max_attempts_ = 0;
|
@@ -68,6 +73,7 @@ class RetryMethodConfig : public ServiceConfigParser::ParsedConfig {
|
|
68
73
|
grpc_millis max_backoff_ = 0;
|
69
74
|
float backoff_multiplier_ = 0;
|
70
75
|
StatusCodeSet retryable_status_codes_;
|
76
|
+
absl::optional<grpc_millis> per_attempt_recv_timeout_;
|
71
77
|
};
|
72
78
|
|
73
79
|
class RetryServiceConfigParser : public ServiceConfigParser::Parser {
|
@@ -187,7 +187,7 @@ void ChannelData::StartTransportOp(grpc_channel_element* elem,
|
|
187
187
|
grpc_transport_op* op) {
|
188
188
|
ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
|
189
189
|
// Catch the disconnect_with_error transport op.
|
190
|
-
if (op->disconnect_with_error !=
|
190
|
+
if (op->disconnect_with_error != GRPC_ERROR_NONE) {
|
191
191
|
// IncreaseCallCount() introduces a phony call and prevent the timer from
|
192
192
|
// being reset by other threads.
|
193
193
|
chand->IncreaseCallCount();
|
@@ -428,6 +428,12 @@ void CallData::DelayBatch(grpc_call_element* elem,
|
|
428
428
|
MutexLock lock(&delay_mu_);
|
429
429
|
delayed_batch_ = batch;
|
430
430
|
resume_batch_canceller_ = new ResumeBatchCanceller(elem);
|
431
|
+
// Without this line, ExecCtx::Get()->Now() will return a cached timestamp. If
|
432
|
+
// there are thousands of RPCs happen on one thread, we might observe ms-level
|
433
|
+
// error in Now(). This could mean the construction of RPC object is
|
434
|
+
// microseconds earlier than the filter execution. But we still haven't found
|
435
|
+
// the root cause. Read more: https://github.com/grpc/grpc/pull/25738.
|
436
|
+
ExecCtx::Get()->InvalidateNow();
|
431
437
|
grpc_millis resume_time = ExecCtx::Get()->Now() + fi_policy_->delay;
|
432
438
|
GRPC_CLOSURE_INIT(&batch->handler_private.closure, ResumeBatch, elem,
|
433
439
|
grpc_schedule_on_exec_ctx);
|
@@ -82,7 +82,8 @@ grpc_channel* grpc_insecure_channel_create_from_fd(
|
|
82
82
|
#else // !GPR_SUPPORT_CHANNELS_FROM_FD
|
83
83
|
|
84
84
|
grpc_channel* grpc_insecure_channel_create_from_fd(
|
85
|
-
const char* target
|
85
|
+
const char* /* target */, int /* fd */,
|
86
|
+
const grpc_channel_args* /* args */) {
|
86
87
|
GPR_ASSERT(0);
|
87
88
|
return nullptr;
|
88
89
|
}
|
@@ -68,8 +68,9 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server* server,
|
|
68
68
|
|
69
69
|
#else // !GPR_SUPPORT_CHANNELS_FROM_FD
|
70
70
|
|
71
|
-
void grpc_server_add_insecure_channel_from_fd(grpc_server* server
|
72
|
-
void* reserved
|
71
|
+
void grpc_server_add_insecure_channel_from_fd(grpc_server* /* server */,
|
72
|
+
void* /* reserved */,
|
73
|
+
int /* fd */) {
|
73
74
|
GPR_ASSERT(0);
|
74
75
|
}
|
75
76
|
|
@@ -564,7 +564,7 @@ static void close_transport_locked(grpc_chttp2_transport* t,
|
|
564
564
|
GRPC_STATUS_UNAVAILABLE);
|
565
565
|
}
|
566
566
|
if (t->write_state != GRPC_CHTTP2_WRITE_STATE_IDLE) {
|
567
|
-
if (t->close_transport_on_writes_finished ==
|
567
|
+
if (t->close_transport_on_writes_finished == GRPC_ERROR_NONE) {
|
568
568
|
t->close_transport_on_writes_finished =
|
569
569
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
570
570
|
"Delayed close due to in-progress write");
|
@@ -821,9 +821,9 @@ static void set_write_state(grpc_chttp2_transport* t,
|
|
821
821
|
// from peer while we had some pending writes)
|
822
822
|
if (st == GRPC_CHTTP2_WRITE_STATE_IDLE) {
|
823
823
|
grpc_core::ExecCtx::RunList(DEBUG_LOCATION, &t->run_after_write);
|
824
|
-
if (t->close_transport_on_writes_finished !=
|
824
|
+
if (t->close_transport_on_writes_finished != GRPC_ERROR_NONE) {
|
825
825
|
grpc_error_handle err = t->close_transport_on_writes_finished;
|
826
|
-
t->close_transport_on_writes_finished =
|
826
|
+
t->close_transport_on_writes_finished = GRPC_ERROR_NONE;
|
827
827
|
close_transport_locked(t, err);
|
828
828
|
}
|
829
829
|
}
|
@@ -1582,6 +1582,8 @@ static void perform_stream_op_locked(void* stream_op,
|
|
1582
1582
|
GPR_ASSERT(!s->pending_byte_stream);
|
1583
1583
|
s->recv_message_ready = op_payload->recv_message.recv_message_ready;
|
1584
1584
|
s->recv_message = op_payload->recv_message.recv_message;
|
1585
|
+
s->call_failed_before_recv_message =
|
1586
|
+
op_payload->recv_message.call_failed_before_recv_message;
|
1585
1587
|
if (s->id != 0) {
|
1586
1588
|
if (!s->read_closed) {
|
1587
1589
|
before = s->frame_storage.length +
|
@@ -1795,7 +1797,7 @@ static void perform_transport_op_locked(void* stream_op,
|
|
1795
1797
|
grpc_chttp2_transport* t =
|
1796
1798
|
static_cast<grpc_chttp2_transport*>(op->handler_private.extra_arg);
|
1797
1799
|
|
1798
|
-
if (op->goaway_error) {
|
1800
|
+
if (op->goaway_error != GRPC_ERROR_NONE) {
|
1799
1801
|
send_goaway(t, op->goaway_error);
|
1800
1802
|
}
|
1801
1803
|
|
@@ -1947,6 +1949,10 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* /*t*/,
|
|
1947
1949
|
null_then_sched_closure(&s->recv_message_ready);
|
1948
1950
|
} else if (s->published_metadata[1] != GRPC_METADATA_NOT_PUBLISHED) {
|
1949
1951
|
*s->recv_message = nullptr;
|
1952
|
+
if (s->call_failed_before_recv_message != nullptr) {
|
1953
|
+
*s->call_failed_before_recv_message =
|
1954
|
+
(s->published_metadata[1] != GRPC_METADATA_PUBLISHED_AT_CLOSE);
|
1955
|
+
}
|
1950
1956
|
null_then_sched_closure(&s->recv_message_ready);
|
1951
1957
|
}
|
1952
1958
|
GRPC_ERROR_UNREF(error);
|
@@ -556,6 +556,7 @@ struct grpc_chttp2_stream {
|
|
556
556
|
grpc_closure* recv_initial_metadata_ready = nullptr;
|
557
557
|
bool* trailing_metadata_available = nullptr;
|
558
558
|
grpc_core::OrphanablePtr<grpc_core::ByteStream>* recv_message;
|
559
|
+
bool* call_failed_before_recv_message = nullptr;
|
559
560
|
grpc_closure* recv_message_ready = nullptr;
|
560
561
|
grpc_metadata_batch* recv_trailing_metadata;
|
561
562
|
grpc_closure* recv_trailing_metadata_finished = nullptr;
|
@@ -246,10 +246,10 @@ grpc_error_handle grpc_chttp2_perform_read(grpc_chttp2_transport* t,
|
|
246
246
|
t->incoming_frame_size -= static_cast<uint32_t>(end - cur);
|
247
247
|
return GRPC_ERROR_NONE;
|
248
248
|
}
|
249
|
-
GPR_UNREACHABLE_CODE(return
|
249
|
+
GPR_UNREACHABLE_CODE(return GRPC_ERROR_NONE);
|
250
250
|
}
|
251
251
|
|
252
|
-
GPR_UNREACHABLE_CODE(return
|
252
|
+
GPR_UNREACHABLE_CODE(return GRPC_ERROR_NONE);
|
253
253
|
}
|
254
254
|
|
255
255
|
static grpc_error_handle init_frame_parser(grpc_chttp2_transport* t) {
|
@@ -388,7 +388,8 @@ void complete_if_batch_end_locked(inproc_stream* s, grpc_error_handle error,
|
|
388
388
|
int is_rtm = static_cast<int>(op == s->recv_trailing_md_op);
|
389
389
|
|
390
390
|
if ((is_sm + is_stm + is_rim + is_rm + is_rtm) == 1) {
|
391
|
-
INPROC_LOG(GPR_INFO, "%s %p %p %
|
391
|
+
INPROC_LOG(GPR_INFO, "%s %p %p %s", msg, s, op,
|
392
|
+
grpc_error_std_string(error).c_str());
|
392
393
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, op->on_complete,
|
393
394
|
GRPC_ERROR_REF(error));
|
394
395
|
}
|
@@ -468,8 +469,9 @@ void fail_helper_locked(inproc_stream* s, grpc_error_handle error) {
|
|
468
469
|
.trailing_metadata_available = true;
|
469
470
|
}
|
470
471
|
INPROC_LOG(GPR_INFO,
|
471
|
-
"fail_helper %p scheduling initial-metadata-ready %
|
472
|
-
error,
|
472
|
+
"fail_helper %p scheduling initial-metadata-ready %s %s", s,
|
473
|
+
grpc_error_std_string(error).c_str(),
|
474
|
+
grpc_error_std_string(err).c_str());
|
473
475
|
grpc_core::ExecCtx::Run(
|
474
476
|
DEBUG_LOCATION,
|
475
477
|
s->recv_initial_md_op->payload->recv_initial_metadata
|
@@ -483,8 +485,13 @@ void fail_helper_locked(inproc_stream* s, grpc_error_handle error) {
|
|
483
485
|
s->recv_initial_md_op = nullptr;
|
484
486
|
}
|
485
487
|
if (s->recv_message_op) {
|
486
|
-
INPROC_LOG(GPR_INFO, "fail_helper %p scheduling message-ready %
|
487
|
-
error);
|
488
|
+
INPROC_LOG(GPR_INFO, "fail_helper %p scheduling message-ready %s", s,
|
489
|
+
grpc_error_std_string(error).c_str());
|
490
|
+
if (s->recv_message_op->payload->recv_message
|
491
|
+
.call_failed_before_recv_message != nullptr) {
|
492
|
+
*s->recv_message_op->payload->recv_message
|
493
|
+
.call_failed_before_recv_message = true;
|
494
|
+
}
|
488
495
|
grpc_core::ExecCtx::Run(
|
489
496
|
DEBUG_LOCATION,
|
490
497
|
s->recv_message_op->payload->recv_message.recv_message_ready,
|
@@ -508,15 +515,15 @@ void fail_helper_locked(inproc_stream* s, grpc_error_handle error) {
|
|
508
515
|
s->send_trailing_md_op = nullptr;
|
509
516
|
}
|
510
517
|
if (s->recv_trailing_md_op) {
|
511
|
-
INPROC_LOG(GPR_INFO, "fail_helper %p scheduling trailing-metadata-ready %
|
512
|
-
s, error);
|
518
|
+
INPROC_LOG(GPR_INFO, "fail_helper %p scheduling trailing-metadata-ready %s",
|
519
|
+
s, grpc_error_std_string(error).c_str());
|
513
520
|
grpc_core::ExecCtx::Run(
|
514
521
|
DEBUG_LOCATION,
|
515
522
|
s->recv_trailing_md_op->payload->recv_trailing_metadata
|
516
523
|
.recv_trailing_metadata_ready,
|
517
524
|
GRPC_ERROR_REF(error));
|
518
|
-
INPROC_LOG(GPR_INFO, "fail_helper %p scheduling trailing-md-on-complete %
|
519
|
-
s, error);
|
525
|
+
INPROC_LOG(GPR_INFO, "fail_helper %p scheduling trailing-md-on-complete %s",
|
526
|
+
s, grpc_error_std_string(error).c_str());
|
520
527
|
complete_if_batch_end_locked(
|
521
528
|
s, error, s->recv_trailing_md_op,
|
522
529
|
"fail_helper scheduling recv-trailing-metadata-on-complete");
|
@@ -685,8 +692,8 @@ void op_state_machine_locked(inproc_stream* s, grpc_error_handle error) {
|
|
685
692
|
INPROC_LOG(
|
686
693
|
GPR_INFO,
|
687
694
|
"op_state_machine %p scheduling on_complete errors for already "
|
688
|
-
"recvd initial md %
|
689
|
-
s, new_err);
|
695
|
+
"recvd initial md %s",
|
696
|
+
s, grpc_error_std_string(new_err).c_str());
|
690
697
|
fail_helper_locked(s, GRPC_ERROR_REF(new_err));
|
691
698
|
goto done;
|
692
699
|
}
|
@@ -710,8 +717,8 @@ void op_state_machine_locked(inproc_stream* s, grpc_error_handle error) {
|
|
710
717
|
grpc_metadata_batch_clear(&s->to_read_initial_md);
|
711
718
|
s->to_read_initial_md_filled = false;
|
712
719
|
INPROC_LOG(GPR_INFO,
|
713
|
-
"op_state_machine %p scheduling initial-metadata-ready %
|
714
|
-
new_err);
|
720
|
+
"op_state_machine %p scheduling initial-metadata-ready %s", s,
|
721
|
+
grpc_error_std_string(new_err).c_str());
|
715
722
|
grpc_core::ExecCtx::Run(
|
716
723
|
DEBUG_LOCATION,
|
717
724
|
s->recv_initial_md_op->payload->recv_initial_metadata
|
@@ -724,8 +731,8 @@ void op_state_machine_locked(inproc_stream* s, grpc_error_handle error) {
|
|
724
731
|
|
725
732
|
if (new_err != GRPC_ERROR_NONE) {
|
726
733
|
INPROC_LOG(GPR_INFO,
|
727
|
-
"op_state_machine %p scheduling on_complete errors2 %
|
728
|
-
new_err);
|
734
|
+
"op_state_machine %p scheduling on_complete errors2 %s", s,
|
735
|
+
grpc_error_std_string(new_err).c_str());
|
729
736
|
fail_helper_locked(s, GRPC_ERROR_REF(new_err));
|
730
737
|
goto done;
|
731
738
|
}
|
@@ -753,8 +760,8 @@ void op_state_machine_locked(inproc_stream* s, grpc_error_handle error) {
|
|
753
760
|
INPROC_LOG(
|
754
761
|
GPR_INFO,
|
755
762
|
"op_state_machine %p scheduling on_complete errors for already "
|
756
|
-
"recvd trailing md %
|
757
|
-
s, new_err);
|
763
|
+
"recvd trailing md %s",
|
764
|
+
s, grpc_error_std_string(new_err).c_str());
|
758
765
|
fail_helper_locked(s, GRPC_ERROR_REF(new_err));
|
759
766
|
goto done;
|
760
767
|
}
|
@@ -801,8 +808,8 @@ void op_state_machine_locked(inproc_stream* s, grpc_error_handle error) {
|
|
801
808
|
// a final status, so don't mark this op complete)
|
802
809
|
if (s->t->is_client || s->trailing_md_sent) {
|
803
810
|
INPROC_LOG(GPR_INFO,
|
804
|
-
"op_state_machine %p scheduling trailing-md-on-complete %
|
805
|
-
s, new_err);
|
811
|
+
"op_state_machine %p scheduling trailing-md-on-complete %s",
|
812
|
+
s, grpc_error_std_string(new_err).c_str());
|
806
813
|
grpc_core::ExecCtx::Run(
|
807
814
|
DEBUG_LOCATION,
|
808
815
|
s->recv_trailing_md_op->payload->recv_trailing_metadata
|
@@ -816,8 +823,8 @@ void op_state_machine_locked(inproc_stream* s, grpc_error_handle error) {
|
|
816
823
|
} else {
|
817
824
|
INPROC_LOG(GPR_INFO,
|
818
825
|
"op_state_machine %p server needs to delay handling "
|
819
|
-
"trailing-md-on-complete %
|
820
|
-
s, new_err);
|
826
|
+
"trailing-md-on-complete %s",
|
827
|
+
s, grpc_error_std_string(new_err).c_str());
|
821
828
|
}
|
822
829
|
} else if (!s->trailing_md_recvd) {
|
823
830
|
INPROC_LOG(
|
@@ -830,8 +837,8 @@ void op_state_machine_locked(inproc_stream* s, grpc_error_handle error) {
|
|
830
837
|
// In this case, we don't care to receive the write-close from the client
|
831
838
|
// because we have already sent status and the RPC is over as far as we
|
832
839
|
// are concerned.
|
833
|
-
INPROC_LOG(GPR_INFO, "op_state_machine %p scheduling trailing-md-ready %
|
834
|
-
s, new_err);
|
840
|
+
INPROC_LOG(GPR_INFO, "op_state_machine %p scheduling trailing-md-ready %s",
|
841
|
+
s, grpc_error_std_string(new_err).c_str());
|
835
842
|
grpc_core::ExecCtx::Run(
|
836
843
|
DEBUG_LOCATION,
|
837
844
|
s->recv_trailing_md_op->payload->recv_trailing_metadata
|
@@ -1091,8 +1098,8 @@ void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
|
|
1091
1098
|
}
|
1092
1099
|
INPROC_LOG(
|
1093
1100
|
GPR_INFO,
|
1094
|
-
"perform_stream_op error %p scheduling initial-metadata-ready %
|
1095
|
-
s, error);
|
1101
|
+
"perform_stream_op error %p scheduling initial-metadata-ready %s",
|
1102
|
+
s, grpc_error_std_string(error).c_str());
|
1096
1103
|
grpc_core::ExecCtx::Run(
|
1097
1104
|
DEBUG_LOCATION,
|
1098
1105
|
op->payload->recv_initial_metadata.recv_initial_metadata_ready,
|
@@ -1101,8 +1108,12 @@ void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
|
|
1101
1108
|
if (op->recv_message) {
|
1102
1109
|
INPROC_LOG(
|
1103
1110
|
GPR_INFO,
|
1104
|
-
"perform_stream_op error %p scheduling recv message-ready %
|
1105
|
-
error);
|
1111
|
+
"perform_stream_op error %p scheduling recv message-ready %s", s,
|
1112
|
+
grpc_error_std_string(error).c_str());
|
1113
|
+
if (op->payload->recv_message.call_failed_before_recv_message !=
|
1114
|
+
nullptr) {
|
1115
|
+
*op->payload->recv_message.call_failed_before_recv_message = true;
|
1116
|
+
}
|
1106
1117
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION,
|
1107
1118
|
op->payload->recv_message.recv_message_ready,
|
1108
1119
|
GRPC_ERROR_REF(error));
|
@@ -1110,16 +1121,16 @@ void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
|
|
1110
1121
|
if (op->recv_trailing_metadata) {
|
1111
1122
|
INPROC_LOG(
|
1112
1123
|
GPR_INFO,
|
1113
|
-
"perform_stream_op error %p scheduling trailing-metadata-ready %
|
1114
|
-
s, error);
|
1124
|
+
"perform_stream_op error %p scheduling trailing-metadata-ready %s",
|
1125
|
+
s, grpc_error_std_string(error).c_str());
|
1115
1126
|
grpc_core::ExecCtx::Run(
|
1116
1127
|
DEBUG_LOCATION,
|
1117
1128
|
op->payload->recv_trailing_metadata.recv_trailing_metadata_ready,
|
1118
1129
|
GRPC_ERROR_REF(error));
|
1119
1130
|
}
|
1120
1131
|
}
|
1121
|
-
INPROC_LOG(GPR_INFO, "perform_stream_op %p scheduling on_complete %
|
1122
|
-
error);
|
1132
|
+
INPROC_LOG(GPR_INFO, "perform_stream_op %p scheduling on_complete %s", s,
|
1133
|
+
grpc_error_std_string(error).c_str());
|
1123
1134
|
grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_complete, GRPC_ERROR_REF(error));
|
1124
1135
|
}
|
1125
1136
|
gpr_mu_unlock(mu);
|