grpc 1.82.0 → 1.83.0.pre1
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 +4 -4
- data/Makefile +8 -5
- data/etc/roots.pem +10400 -3855
- data/include/grpc/grpc_audit_logging.h +2 -2
- data/include/grpc/grpc_security_constants.h +2 -0
- data/include/grpc/impl/channel_arg_names.h +23 -0
- data/src/core/call/call_filters.h +19 -3
- data/src/core/call/call_spine.h +4 -4
- data/src/core/call/client_call.cc +1 -1
- data/src/core/call/metadata.cc +7 -2
- data/src/core/call/server_call.cc +13 -3
- data/src/core/call/server_call.h +5 -3
- data/src/core/client_channel/backup_poller.cc +2 -17
- data/src/core/client_channel/client_channel.cc +17 -14
- data/src/core/client_channel/client_channel.h +3 -1
- data/src/core/client_channel/client_channel_filter.cc +11 -13
- data/src/core/client_channel/client_channel_service_config.cc +5 -13
- data/src/core/client_channel/direct_channel.cc +5 -1
- data/src/core/client_channel/direct_channel.h +3 -1
- data/src/core/config/experiment_env_var.cc +30 -0
- data/src/core/config/experiment_env_var.h +26 -0
- data/src/core/credentials/call/regional_access_boundary_fetcher.cc +6 -6
- data/src/core/credentials/transport/ssl/ssl_security_connector.cc +14 -2
- data/src/core/credentials/transport/tls/grpc_tls_certificate_selector.cc +172 -0
- data/src/core/credentials/transport/tls/grpc_tls_certificate_selector.h +103 -0
- data/src/core/credentials/transport/tls/load_system_roots_fallback.cc +3 -2
- data/src/core/credentials/transport/tls/load_system_roots_supported.cc +10 -3
- data/src/core/credentials/transport/tls/tls_security_connector.cc +14 -2
- data/src/core/credentials/transport/xds/xds_credentials.cc +4 -12
- data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +2 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +19 -13
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +11 -9
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/flow_control.h +3 -2
- data/src/core/ext/transport/chttp2/transport/frame.cc +58 -1
- data/src/core/ext/transport/chttp2/transport/frame.h +13 -1
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -4
- data/src/core/ext/transport/chttp2/transport/frame_security.cc +10 -1
- data/src/core/ext/transport/chttp2/transport/frame_security.h +2 -1
- data/src/core/ext/transport/chttp2/transport/goaway.cc +11 -1
- data/src/core/ext/transport/chttp2/transport/goaway.h +17 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +9 -0
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +117 -276
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +44 -17
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +382 -496
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +75 -77
- data/src/core/ext/transport/chttp2/transport/http2_settings.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +30 -11
- data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +24 -9
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +26 -0
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +2 -0
- data/src/core/ext/transport/chttp2/transport/internal.h +4 -0
- data/src/core/ext/transport/chttp2/transport/parsing.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/ping_promise.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +4 -10
- data/src/core/ext/transport/chttp2/transport/read_context.h +62 -20
- data/src/core/ext/transport/chttp2/transport/security_frame.h +1 -0
- data/src/core/ext/transport/chttp2/transport/stream.h +271 -120
- data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +77 -61
- data/src/core/handshaker/security/secure_endpoint.cc +0 -13
- data/src/core/lib/channel/promise_based_filter.cc +77 -3
- data/src/core/lib/channel/promise_based_filter.h +238 -184
- data/src/core/lib/event_engine/extensions/receive_coalescing_extension.h +0 -4
- data/src/core/lib/event_engine/extensions/tcp_trace.h +1 -1
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +2 -12
- data/src/core/lib/event_engine/shim.cc +2 -16
- data/src/core/lib/event_engine/shim.h +0 -4
- data/src/core/lib/experiments/experiments.cc +51 -102
- data/src/core/lib/experiments/experiments.h +37 -59
- data/src/core/lib/iomgr/error.cc +3 -73
- data/src/core/lib/iomgr/error.h +8 -6
- data/src/core/lib/iomgr/error_cfstream.cc +1 -2
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +2 -6
- data/src/core/lib/iomgr/ev_poll_posix.cc +2 -6
- data/src/core/lib/iomgr/tcp_posix.cc +2 -6
- data/src/core/lib/security/authorization/audit_logging.cc +2 -2
- data/src/core/lib/security/authorization/audit_logging.h +3 -3
- data/src/core/lib/security/authorization/grpc_authorization_engine.cc +11 -13
- data/src/core/lib/security/authorization/grpc_authorization_engine.h +1 -1
- data/src/core/lib/security/authorization/matchers.cc +20 -20
- data/src/core/lib/security/authorization/matchers.h +15 -16
- data/src/core/lib/security/authorization/rbac_policy.h +1 -1
- data/src/core/lib/security/authorization/stdout_logger.cc +3 -3
- data/src/core/lib/security/authorization/stdout_logger.h +6 -5
- data/src/core/lib/surface/call.cc +0 -8
- data/src/core/lib/surface/call.h +2 -0
- data/src/core/lib/surface/channel.cc +21 -2
- data/src/core/lib/surface/channel.h +14 -6
- data/src/core/lib/surface/filter_stack_call.cc +10 -29
- data/src/core/lib/surface/legacy_channel.cc +7 -7
- data/src/core/lib/surface/legacy_channel.h +3 -1
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +13 -13
- data/src/core/lib/transport/bdp_estimator.h +9 -5
- data/src/core/lib/transport/error_utils.cc +26 -138
- data/src/core/lib/transport/promise_endpoint.h +2 -4
- data/src/core/load_balancing/grpclb/grpclb.cc +2 -1
- data/src/core/load_balancing/pick_first/pick_first.cc +33 -2
- data/src/core/load_balancing/pick_first/pick_first.h +6 -0
- data/src/core/load_balancing/ring_hash/ring_hash.cc +3 -10
- data/src/core/load_balancing/rls/rls.cc +2 -1
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +2 -7
- data/src/core/load_balancing/xds/cds.cc +80 -56
- data/src/core/load_balancing/xds/cds.h +21 -0
- data/src/core/mitigation_engine/mitigation.h +53 -0
- data/src/core/mitigation_engine/mitigation_provider.h +62 -0
- data/src/core/resolver/dns/dns_resolver_plugin.cc +1 -6
- data/src/core/resolver/xds/xds_resolver.cc +14 -11
- data/src/core/server/server.h +1 -4
- data/src/core/server/server_config_selector.h +5 -4
- data/src/core/server/server_config_selector_filter.cc +67 -80
- data/src/core/server/xds_server_config_fetcher.cc +681 -692
- data/src/core/server/xds_server_config_fetcher_legacy.cc +15 -12
- data/src/core/telemetry/call_tracer.cc +49 -2
- data/src/core/telemetry/call_tracer.h +1 -0
- data/src/core/telemetry/tcp_tracer.h +38 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
- data/src/core/tsi/ssl_telemetry_utils.cc +343 -0
- data/src/core/tsi/ssl_telemetry_utils.h +74 -0
- data/src/core/tsi/ssl_transport_security.cc +577 -301
- data/src/core/tsi/ssl_transport_security.h +22 -6
- data/src/core/tsi/ssl_transport_security_utils.cc +2 -0
- data/src/core/tsi/transport_security.h +7 -0
- data/src/core/util/http_client/httpcli.cc +1 -4
- data/src/core/util/http_client/httpcli_security_connector.cc +2 -1
- data/src/core/util/status_helper.cc +71 -192
- data/src/core/util/status_helper.h +16 -21
- data/src/core/xds/grpc/file_watcher_certificate_provider_factory.cc +2 -11
- data/src/core/xds/grpc/xds_bootstrap_grpc.cc +2 -7
- data/src/core/xds/grpc/xds_cluster_parser.cc +5 -16
- data/src/core/xds/grpc/xds_common_types.cc +94 -38
- data/src/core/xds/grpc/xds_common_types.h +33 -18
- data/src/core/xds/grpc/xds_common_types_parser.cc +168 -100
- data/src/core/xds/grpc/xds_common_types_parser.h +18 -1
- data/src/core/xds/grpc/xds_endpoint_parser.cc +6 -17
- data/src/core/xds/grpc/xds_http_filter_registry.cc +2 -10
- data/src/core/xds/grpc/xds_http_rbac_filter.cc +3 -12
- data/src/core/xds/grpc/xds_metadata_parser.cc +0 -2
- data/src/core/xds/grpc/xds_route_config_parser.cc +7 -11
- data/src/core/xds/grpc/xds_routing.cc +113 -82
- data/src/core/xds/grpc/xds_routing.h +70 -20
- data/src/core/xds/grpc/xds_server_grpc.cc +22 -13
- data/src/core/xds/grpc/xds_server_grpc.h +16 -2
- data/src/core/xds/grpc/xds_server_grpc_interface.h +10 -0
- data/src/core/xds/grpc/xds_transport_grpc.cc +123 -18
- data/src/core/xds/grpc/xds_transport_grpc.h +28 -4
- data/src/core/xds/xds_client/lrs_client.cc +3 -7
- data/src/core/xds/xds_client/xds_bootstrap.cc +4 -16
- data/src/core/xds/xds_client/xds_client.cc +2 -15
- data/src/core/xds/xds_client/xds_transport.h +3 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +1 -1
- metadata +9 -1
|
@@ -70,6 +70,8 @@
|
|
|
70
70
|
#include "src/core/util/debug_location.h"
|
|
71
71
|
#include "src/core/util/grpc_check.h"
|
|
72
72
|
#include "src/core/util/match.h"
|
|
73
|
+
#include "src/core/util/orphanable.h"
|
|
74
|
+
#include "src/core/util/ref_counted_ptr.h"
|
|
73
75
|
#include "src/core/util/time.h"
|
|
74
76
|
#include "absl/container/inlined_vector.h"
|
|
75
77
|
#include "absl/functional/function_ref.h"
|
|
@@ -1273,192 +1275,241 @@ class V3InterceptorToV2Bridge : public ChannelFilter, public Interceptor {
|
|
|
1273
1275
|
InterActivityLatch<std::optional<ServerMetadataHandle>>
|
|
1274
1276
|
server_initial_metadata;
|
|
1275
1277
|
InterActivityPipe<MessageHandle, 1> server_to_client_messages;
|
|
1278
|
+
InterActivityLatch<ServerMetadataHandle> server_trailing_metadata;
|
|
1276
1279
|
};
|
|
1277
1280
|
auto* pipe_owner = GetContext<Arena>()->ManagedNew<PipeOwner>();
|
|
1281
|
+
if (IsV2NonOwningWakerImplementationEnabled()) {
|
|
1282
|
+
// We need to start polling the initiator for server trailing
|
|
1283
|
+
// metadata immediately, since the v3 interceptor may generate a
|
|
1284
|
+
// failure before any of the other promises resolve.
|
|
1285
|
+
//
|
|
1286
|
+
// Spawn a promise on the initiator's activity to pull server trailing
|
|
1287
|
+
// metadata and pass it to the v2 activity via an inter-activity latch.
|
|
1288
|
+
initiator.SpawnInfallible(
|
|
1289
|
+
"pull_server_trailing_metadata",
|
|
1290
|
+
[initiator = initiator, pipe_owner]() mutable {
|
|
1291
|
+
return Map(
|
|
1292
|
+
initiator.PullServerTrailingMetadata(),
|
|
1293
|
+
[pipe_owner](ServerMetadataHandle metadata) {
|
|
1294
|
+
pipe_owner->server_trailing_metadata.Set(std::move(metadata));
|
|
1295
|
+
return Empty{};
|
|
1296
|
+
});
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1278
1299
|
// Now return a promise that does all the things.
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1300
|
+
// The returned promise is wrapped in OnCancel so that, if the v2 stack
|
|
1301
|
+
// destroys it before it completes (e.g. the forced-cancellation path in
|
|
1302
|
+
// ServerCallData::Completed, which resets promise_ to an empty
|
|
1303
|
+
// ArenaPromise), we actively propagate a cancellation into the v3 call
|
|
1304
|
+
// pair.
|
|
1305
|
+
return OnCancel(
|
|
1306
|
+
Race(
|
|
1307
|
+
// Get server trailing metadata from the v3 promise via the
|
|
1308
|
+
// inter-activity latch.
|
|
1309
|
+
If(
|
|
1310
|
+
IsV2NonOwningWakerImplementationEnabled(),
|
|
1311
|
+
[pipe_owner]() {
|
|
1312
|
+
return pipe_owner->server_trailing_metadata.Wait();
|
|
1313
|
+
},
|
|
1314
|
+
[initiator = initiator]() mutable {
|
|
1315
|
+
return initiator.PullServerTrailingMetadata();
|
|
1316
|
+
}),
|
|
1317
|
+
// This promise does the rest of the things, but it will always
|
|
1318
|
+
// return pending, because the promise can't actually finish
|
|
1319
|
+
// until the initiator returns trailing metadata above.
|
|
1320
|
+
TrySeq(
|
|
1321
|
+
state->call_handler_latch.Wait(),
|
|
1322
|
+
[initiator = initiator, pipe_owner,
|
|
1323
|
+
call_args = std::move(call_args),
|
|
1324
|
+
next_promise_factory = std::move(next_promise_factory)](
|
|
1325
|
+
CallHandler handler) mutable {
|
|
1326
|
+
// Intercept all pipes from v2 API.
|
|
1327
|
+
//
|
|
1328
|
+
// For client-to-server messages, we do the following:
|
|
1329
|
+
// 1. Push the message into the v3 initiator, which sends
|
|
1330
|
+
// it to the v3 interceptor. Note that this needs to
|
|
1331
|
+
// be done inside of the v3 initiator's activity.
|
|
1332
|
+
// 2. Pull the message from the v3 handler, where it will
|
|
1333
|
+
// arrive when the v3 interceptor is done with it.
|
|
1334
|
+
// Note that this needs to be done inside of the v3
|
|
1335
|
+
// handler's activity. We then push the message into
|
|
1336
|
+
// an inter-activity pipe to return it to the v2 activity.
|
|
1337
|
+
// 3. In the v2 activity, read the message from the
|
|
1338
|
+
// inter-activity pipe and send it on to the next
|
|
1339
|
+
// filter.
|
|
1340
|
+
//
|
|
1341
|
+
// Step 2: Spawn a promise to pull messages from the v3
|
|
1342
|
+
// handler and push them into an inter-activity pipe to
|
|
1343
|
+
// return them to the v2 activity.
|
|
1344
|
+
handler.SpawnGuarded(
|
|
1345
|
+
"pull_client_to_server_message",
|
|
1346
|
+
[handler, pipe_owner]() mutable {
|
|
1347
|
+
return ForEach(
|
|
1348
|
+
MessagesFrom(handler),
|
|
1349
|
+
[pipe_owner](MessageHandle message) {
|
|
1350
|
+
return Map(pipe_owner->client_to_server_messages
|
|
1351
|
+
.sender.Push(std::move(message)),
|
|
1352
|
+
[](bool x) { return StatusFlag(x); });
|
|
1353
|
+
});
|
|
1354
|
+
});
|
|
1355
|
+
call_args.client_to_server_messages->InterceptAndMap(
|
|
1356
|
+
[initiator, handler,
|
|
1357
|
+
pipe_owner](MessageHandle message) mutable {
|
|
1358
|
+
// Step 1: Push the message onto the v3 initiator in
|
|
1359
|
+
// its activity.
|
|
1360
|
+
initiator.SpawnPushMessage(std::move(message));
|
|
1361
|
+
// Step 3: Here in the v2 activity, read the message
|
|
1362
|
+
// from the inter-activity pipe and return it.
|
|
1363
|
+
return Map(
|
|
1364
|
+
pipe_owner->client_to_server_messages.receiver
|
|
1365
|
+
.Next(),
|
|
1366
|
+
[](InterActivityPipe<MessageHandle, 1>::NextResult
|
|
1367
|
+
message) -> std::optional<MessageHandle> {
|
|
1368
|
+
if (!message.has_value()) return std::nullopt;
|
|
1369
|
+
return std::move(*message);
|
|
1370
|
+
});
|
|
1371
|
+
});
|
|
1372
|
+
// For server initial metadata, we do a similar thing, but
|
|
1373
|
+
// in the opposite direction, and using an inter-activity
|
|
1374
|
+
// latch instead of a pipe:
|
|
1375
|
+
// 1. Push the metadata into the v3 handler, which sends
|
|
1376
|
+
// it to the v3 interceptor. Note that this needs to
|
|
1377
|
+
// be done inside of the v3 handler's activity.
|
|
1378
|
+
// 2. Pull the metadata from the v3 initiator, where it will
|
|
1379
|
+
// arrive when the v3 interceptor is done with it.
|
|
1380
|
+
// Note that this needs to be done inside of the v3
|
|
1381
|
+
// initiator's activity. We then use an inter-activity
|
|
1382
|
+
// latch to return the metadata to the v2 activity.
|
|
1383
|
+
// 3. In the v2 activity, read the metadata from the
|
|
1384
|
+
// inter-activity latch and send it on to the previous
|
|
1385
|
+
// filter.
|
|
1386
|
+
//
|
|
1387
|
+
// Step 2: Spawn a promise to pull the metadata from the v3
|
|
1388
|
+
// initiator and use an inter-activity latch to return it to
|
|
1389
|
+
// the v2 activity.
|
|
1390
|
+
initiator.SpawnGuarded(
|
|
1391
|
+
"pull_server_initial_metadata",
|
|
1392
|
+
[initiator, pipe_owner]() mutable {
|
|
1393
|
+
return TrySeq(
|
|
1394
|
+
initiator.PullServerInitialMetadata(),
|
|
1395
|
+
[pipe_owner](
|
|
1396
|
+
std::optional<ServerMetadataHandle> metadata) {
|
|
1397
|
+
pipe_owner->server_initial_metadata.Set(
|
|
1398
|
+
std::move(metadata));
|
|
1399
|
+
});
|
|
1400
|
+
});
|
|
1401
|
+
call_args.server_initial_metadata->InterceptAndMap(
|
|
1402
|
+
[initiator, handler,
|
|
1403
|
+
pipe_owner](ServerMetadataHandle metadata) mutable {
|
|
1404
|
+
// Step 1: Push the metadata onto the v3 handler in
|
|
1405
|
+
// its activity.
|
|
1406
|
+
handler.SpawnPushServerInitialMetadata(
|
|
1407
|
+
std::move(metadata));
|
|
1408
|
+
// Step 3: Here in the v2 activity, read from the
|
|
1409
|
+
// inter-activity latch and return the metadata.
|
|
1410
|
+
return pipe_owner->server_initial_metadata.Wait();
|
|
1411
|
+
});
|
|
1412
|
+
// We handle server-to-client messages the same as
|
|
1413
|
+
// client-to-server messages, except in the opposite
|
|
1414
|
+
// direction:
|
|
1415
|
+
// 1. Push the message into the v3 handler, which sends
|
|
1416
|
+
// it to the v3 interceptor. Note that this needs to
|
|
1417
|
+
// be done inside of the v3 handler's activity.
|
|
1418
|
+
// 2. Pull the message from the v3 initiator, where it will
|
|
1419
|
+
// arrive when the v3 interceptor is done with it.
|
|
1420
|
+
// Note that this needs to be done inside of the v3
|
|
1421
|
+
// initiator's activity. We then push the message into
|
|
1422
|
+
// an inter-activity pipe to return it to the v2 activity.
|
|
1423
|
+
// 3. In the v2 activity, read the message from the
|
|
1424
|
+
// inter-activity pipe and send it on to the next
|
|
1425
|
+
// filter.
|
|
1426
|
+
//
|
|
1427
|
+
// Step 2: Spawn a promise to pull messages from the v3
|
|
1428
|
+
// initiator and push them into an inter-activity pipe to
|
|
1429
|
+
// return them to the v2 activity.
|
|
1430
|
+
initiator.SpawnGuarded(
|
|
1431
|
+
"pull_server_to_client_message",
|
|
1432
|
+
[initiator, pipe_owner]() mutable {
|
|
1433
|
+
return ForEach(
|
|
1434
|
+
MessagesFrom(initiator),
|
|
1435
|
+
[pipe_owner](MessageHandle message) {
|
|
1436
|
+
return Map(pipe_owner->server_to_client_messages
|
|
1437
|
+
.sender.Push(std::move(message)),
|
|
1438
|
+
[](bool x) { return StatusFlag(x); });
|
|
1439
|
+
});
|
|
1440
|
+
});
|
|
1441
|
+
call_args.server_to_client_messages->InterceptAndMap(
|
|
1442
|
+
[initiator, handler,
|
|
1443
|
+
pipe_owner](MessageHandle message) mutable {
|
|
1444
|
+
// Step 1: Push the message onto the v3 handler in
|
|
1445
|
+
// its activity.
|
|
1446
|
+
handler.SpawnPushMessage(std::move(message));
|
|
1447
|
+
// Step 3: Here in the v2 activity, read from the
|
|
1448
|
+
// inter-activity pipe and return the messages.
|
|
1449
|
+
return Map(
|
|
1450
|
+
pipe_owner->server_to_client_messages.receiver
|
|
1451
|
+
.Next(),
|
|
1452
|
+
[](InterActivityPipe<MessageHandle, 1>::NextResult
|
|
1453
|
+
message) -> std::optional<MessageHandle> {
|
|
1454
|
+
if (!message.has_value()) return std::nullopt;
|
|
1455
|
+
return std::move(*message);
|
|
1456
|
+
});
|
|
1457
|
+
});
|
|
1458
|
+
// In the v3 handler's activity, pull client initial metadata.
|
|
1459
|
+
// Use an inter-activity latch to get it back to the v2
|
|
1460
|
+
// activity.
|
|
1461
|
+
handler.SpawnGuarded(
|
|
1462
|
+
"pull_client_initial_metadata",
|
|
1463
|
+
[handler, pipe_owner]() mutable {
|
|
1464
|
+
return TrySeq(
|
|
1465
|
+
handler.PullClientInitialMetadata(),
|
|
1466
|
+
[pipe_owner](ClientMetadataHandle metadata) {
|
|
1467
|
+
pipe_owner->client_initial_metadata.Set(
|
|
1468
|
+
std::move(metadata));
|
|
1469
|
+
});
|
|
1470
|
+
});
|
|
1471
|
+
// A wrapper for next_promise_factory that does the following:
|
|
1472
|
+
// - Pulls client initial metadata from the V3 handler via
|
|
1473
|
+
// the inter-activity latch and injects it into the next
|
|
1474
|
+
// V2 filter via CallArgs.
|
|
1475
|
+
// - Polls the next promise to get server trailing metadata
|
|
1476
|
+
// from the next V2 filter and feeds it into the V3 handler.
|
|
1477
|
+
// Note that this does not actually pull the trailing metadata
|
|
1478
|
+
// from the V3 initiator; instead, we do that in a separate
|
|
1479
|
+
// promise above. That promise will always complete at the
|
|
1480
|
+
// end of the call, so we always return pending here.
|
|
1481
|
+
return Seq(
|
|
1482
|
+
pipe_owner->client_initial_metadata.Wait(),
|
|
1483
|
+
[next_promise_factory = std::move(next_promise_factory),
|
|
1484
|
+
call_args = std::move(call_args),
|
|
1485
|
+
handler](ClientMetadataHandle metadata) mutable {
|
|
1486
|
+
call_args.client_initial_metadata = std::move(metadata);
|
|
1487
|
+
return Seq(
|
|
1488
|
+
next_promise_factory(std::move(call_args)),
|
|
1489
|
+
[handler](ServerMetadataHandle metadata) mutable
|
|
1490
|
+
-> Poll<ServerMetadataHandle> {
|
|
1491
|
+
handler.SpawnPushServerTrailingMetadata(
|
|
1492
|
+
std::move(metadata));
|
|
1493
|
+
// We always lose the race.
|
|
1494
|
+
return Pending{};
|
|
1495
|
+
});
|
|
1496
|
+
});
|
|
1497
|
+
})),
|
|
1498
|
+
[initiator = initiator]() mutable {
|
|
1499
|
+
// The v2 promise was destroyed before completing: propagate the
|
|
1500
|
+
// cancellation into the v3 call pair so its CallSpine is torn down
|
|
1501
|
+
// and the v3 interceptor is notified.
|
|
1502
|
+
if (IsV2NonOwningWakerImplementationEnabled()) {
|
|
1503
|
+
initiator.SpawnCancel(
|
|
1504
|
+
absl::CancelledError("call cancelled by v2 filter stack"));
|
|
1505
|
+
} else {
|
|
1506
|
+
initiator.SpawnInfallible("v2-force-cancel", [initiator]() mutable {
|
|
1507
|
+
initiator.Cancel();
|
|
1508
|
+
return Map(initiator.PullServerTrailingMetadata(),
|
|
1509
|
+
[](ServerMetadataHandle) { return Empty{}; });
|
|
1510
|
+
});
|
|
1511
|
+
}
|
|
1512
|
+
});
|
|
1462
1513
|
}
|
|
1463
1514
|
|
|
1464
1515
|
protected:
|
|
@@ -1917,9 +1968,11 @@ class BaseCallData : public Activity,
|
|
|
1917
1968
|
std::string LogTag() const;
|
|
1918
1969
|
|
|
1919
1970
|
private:
|
|
1971
|
+
class WeakWakerHandle;
|
|
1972
|
+
|
|
1920
1973
|
// Wakeable implementation.
|
|
1921
1974
|
void Wakeup(WakeupMask) final;
|
|
1922
|
-
void WakeupAsync(WakeupMask) final
|
|
1975
|
+
void WakeupAsync(WakeupMask) final;
|
|
1923
1976
|
void Drop(WakeupMask) final;
|
|
1924
1977
|
|
|
1925
1978
|
virtual void OnWakeup() = 0;
|
|
@@ -1931,6 +1984,7 @@ class BaseCallData : public Activity,
|
|
|
1931
1984
|
const Timestamp deadline_;
|
|
1932
1985
|
CallFinalization finalization_;
|
|
1933
1986
|
std::atomic<grpc_polling_entity*> pollent_{nullptr};
|
|
1987
|
+
OrphanablePtr<WeakWakerHandle> handle_;
|
|
1934
1988
|
Pipe<ServerMetadataHandle>* const server_initial_metadata_pipe_;
|
|
1935
1989
|
SendMessage* const send_message_;
|
|
1936
1990
|
ReceiveMessage* const receive_message_;
|
|
@@ -37,10 +37,6 @@ class ReceiveCoalescingExtension {
|
|
|
37
37
|
/// It is safe to call this only when there are no outstanding Reads on
|
|
38
38
|
/// the Endpoint.
|
|
39
39
|
virtual void DisableRpcReceiveCoalescing() = 0;
|
|
40
|
-
|
|
41
|
-
/// If invoked, the endpoint tries to preserve proper order and alignment of
|
|
42
|
-
/// any memory that maybe shared across reads.
|
|
43
|
-
virtual void EnforceRxMemoryAlignment() = 0;
|
|
44
40
|
};
|
|
45
41
|
|
|
46
42
|
} // namespace grpc_event_engine::experimental
|
|
@@ -36,7 +36,7 @@ class TcpTraceExtension {
|
|
|
36
36
|
// Enable TCP telemetry collection using the Instrumentation API.
|
|
37
37
|
virtual void EnableTcpTelemetry(
|
|
38
38
|
grpc_core::RefCountedPtr<grpc_core::CollectionScope> collection_scope,
|
|
39
|
-
bool is_control_endpoint) = 0;
|
|
39
|
+
bool is_control_endpoint, bool trace_full_buffer) = 0;
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
} // namespace grpc_event_engine::experimental
|
|
@@ -76,14 +76,6 @@ namespace grpc_event_engine::experimental {
|
|
|
76
76
|
|
|
77
77
|
namespace {
|
|
78
78
|
|
|
79
|
-
bool ShouldUsePosixPoller() {
|
|
80
|
-
#if defined(GRPC_PYTHON_BUILD)
|
|
81
|
-
return grpc_core::IsEventEnginePollerForPythonEnabled();
|
|
82
|
-
#else
|
|
83
|
-
return true;
|
|
84
|
-
#endif
|
|
85
|
-
}
|
|
86
|
-
|
|
87
79
|
#if GRPC_ENABLE_FORK_SUPPORT && GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK
|
|
88
80
|
|
|
89
81
|
// Thread pool can outlive EE but we need to ensure the ordering if both
|
|
@@ -434,10 +426,8 @@ PosixEventEngine::PosixEventEngine(const Options& options)
|
|
|
434
426
|
: connection_shards_(options.connection_shards),
|
|
435
427
|
executor_(MakeThreadPool(options.reserve_threads)),
|
|
436
428
|
timer_manager_(std::make_shared<TimerManager>(executor_)) {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
SchedulePoller();
|
|
440
|
-
}
|
|
429
|
+
poller_ = grpc_event_engine::experimental::MakeDefaultPoller(executor_);
|
|
430
|
+
SchedulePoller();
|
|
441
431
|
}
|
|
442
432
|
|
|
443
433
|
#endif // GRPC_POSIX_SOCKET_TCP
|
|
@@ -21,14 +21,10 @@
|
|
|
21
21
|
|
|
22
22
|
namespace grpc_event_engine::experimental {
|
|
23
23
|
|
|
24
|
-
bool UseEventEngineClient() {
|
|
25
|
-
return !EventEngineExperimentDisabledForPython() &&
|
|
26
|
-
grpc_core::IsEventEngineClientEnabled();
|
|
27
|
-
}
|
|
24
|
+
bool UseEventEngineClient() { return grpc_core::IsEventEngineClientEnabled(); }
|
|
28
25
|
|
|
29
26
|
bool UseEventEngineListener() {
|
|
30
|
-
return
|
|
31
|
-
grpc_core::IsEventEngineListenerEnabled();
|
|
27
|
+
return grpc_core::IsEventEngineListenerEnabled();
|
|
32
28
|
}
|
|
33
29
|
|
|
34
30
|
bool UsePollsetAlternative() {
|
|
@@ -36,14 +32,4 @@ bool UsePollsetAlternative() {
|
|
|
36
32
|
grpc_core::IsPollsetAlternativeEnabled();
|
|
37
33
|
}
|
|
38
34
|
|
|
39
|
-
// Returns true if the poller is disabled by build configuration or experiment
|
|
40
|
-
// flags.
|
|
41
|
-
bool EventEngineExperimentDisabledForPython() {
|
|
42
|
-
#ifdef GRPC_PYTHON_BUILD
|
|
43
|
-
return !grpc_core::IsEventEnginePollerForPythonEnabled();
|
|
44
|
-
#else
|
|
45
|
-
return false;
|
|
46
|
-
#endif
|
|
47
|
-
}
|
|
48
|
-
|
|
49
35
|
} // namespace grpc_event_engine::experimental
|
|
@@ -35,10 +35,6 @@ bool UseEventEngineListener();
|
|
|
35
35
|
// may disable the poller in some builds.
|
|
36
36
|
bool UsePollsetAlternative();
|
|
37
37
|
|
|
38
|
-
// Returns true if the poller is disabled by build configuration or experiment
|
|
39
|
-
// flags.
|
|
40
|
-
bool EventEngineExperimentDisabledForPython();
|
|
41
|
-
|
|
42
38
|
} // namespace grpc_event_engine::experimental
|
|
43
39
|
|
|
44
40
|
#endif // GRPC_SRC_CORE_LIB_EVENT_ENGINE_SHIM_H
|