To avoid data races and use-after-free on shutdown in Python 3.13.
It seems to have worked before due to unintended guarantees of the
Python interpreter that are gone with the new version.
Uses `threading.Event` and `threading.Lock` to coordinate between the main thread handling signals and the `flush_stdout_loop` thread. The `_quit_on_signal` handler now signals the flush thread to exit, and waits for the flush thread to complete its current sleep cycle before calling `sys.exit()`. This prevents a use-after-free that shows up as a data race.
Ref b/474047558
PiperOrigin-RevId: 859182150
Adding PH2 experiment to the client_interceptors_end2end_test suite.
Also adding the Channel Arg wherever we missed it in the earlier PR : https://github.com/grpc/grpc/pull/41399/files
PiperOrigin-RevId: 856102643
This includes two major changes:
1. An additional credentials option `sni_override` with the type `optional<string>`. If `nullopt`, it has no effect, and if set to the empty string it disables sending SNI entirely. Otherwise, the specified string will be sent.
2. The implementation of [gRFC A101](https://github.com/grpc/proposal/blob/master/A101-SNI-setting-and-SNI-SAN-validation.md) using that new option. This includes options to set SNI and to validate SAN values against the set SNI value.
Closes#41051
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/41051 from murgatroid99:xds_sni_support 6a1f8667dedc19947532720495b2932889236a12
PiperOrigin-RevId: 855765736
This change introduces a new experiment `call_tracer_send_initial_metadata_is_an_annotation`. When enabled, the `CallTracer::RecordSendInitialMetadata` method will now record a `SendInitialMetadataAnnotation` and call a new `MutateSendInitialMetadata` method on the underlying `CallTracerInterface`.
The `CallTracerInterface` and its implementations (including XorMetrics, OpenCensus, OpenTelemetry, and test fakes) have been updated to include the new `MutateSendInitialMetadata` virtual method. The existing `RecordSendInitialMetadata` implementations are modified to check the experiment flag and delegate to `MutateSendInitialMetadata` if the experiment is active.
A new `SendInitialMetadataAnnotation` class is added, which inherits from `CallTracerAnnotationInterface::Annotation`. This annotation type is used to capture the state of the initial metadata for immutable tracing purposes.
Additionally, `ForEachKeyValue` methods are added to `MetadataInfo` and `HttpAnnotation` to facilitate iterating over metadata key-value pairs for annotation recording. The experiment configuration files are updated to include the new experiment.
PiperOrigin-RevId: 854227812
Bypassing 1 test in end2end_test because we want earlier validation of the flakes.
Fixing the bug may take about 2-4 working days. We need to check for the stability of the suite and so we need these to run on Kokoro.
Disabled retries in async_end2end_test , but not enabled the suite because of some timeout failure.
Also, refactored the code to add a new function ApplyCommonChannelArguments
PiperOrigin-RevId: 854186178
streaming_throughput_test is edited to disabled retry interceptor. streaming_throughput_test has NOT been enabled. Have to debug a flake.
PiperOrigin-RevId: 853963781
Adapted from PR #40420
The original author left team and the PR couldn't be merged due to CLA check.
<!--
If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.
If your pull request is for a specific language, please add the appropriate
lang label.
-->
Closes#41355
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/41355 from yuanweiz:workspace adb60674979a5d722f45e13e7c75291f22722f41
PiperOrigin-RevId: 853745450
[PH2][Trivial][BUILD] Adding a util file to cpp end2end folder
Adding some temporary helper functions for that.
Closes#41361
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/41361 from tanvi-jagtap:2026_01_07_util_file 0702cb4958f80117f44c8bd796f58fa59ceba0c1
PiperOrigin-RevId: 853164713
When a `std::multimap` has multiple entries with the same key, calling `m.find(key)` returns an unspecified element.
Historically, this returns the first matching element. However, this is not guaranteed, and recent libc++ changes make this return an arbitrary element.
Using `m.equal_range(key)` is a replacement that will preserve the current behavior. The behavior of this is guaranteed to return a range of all matching elements in insertion order, and the beginning of the range is the same element as what's normally returned by `m.find(key)`.
Closes#41279
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/41279 from rupprecht:multimap-find 70b116441d03eff80523e010b25336f5a75c70c2
PiperOrigin-RevId: 852844558
This change renames test suites containing EXPECT_DEATH assertions to include "DeathTest" in their name, following GoogleTest best practices for handling death tests.
PiperOrigin-RevId: 852840775
[PH2][Tests] Enable cpp end2end tests that are working
Closes#41339
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/41339 from tanvi-jagtap:2026_01_04_bulk_enable_cpp d501d8c35778de3adf59b7e68e876caa7ffd5b45
PiperOrigin-RevId: 852185367
[PH2][Tests] Cpp end to end enabling multiple tests
Closes#41332
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/41332 from tanvi-jagtap:2026_01_02_bulk_enable_passing_tests 4976d566fbb0942f1f03202b6f45c5c216846dba
PiperOrigin-RevId: 851511191
[PH2][Tests] Cpp end to end enabling few tests
Closes#41327
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/41327 from tanvi-jagtap:2025_12_30_thread_stress_test 5dd5e21feb7425436bd479bf3ca0d62f0a6b63c5
PiperOrigin-RevId: 850655928
This reverts partial changes from https://github.com/grpc/grpc/pull/41240.
As we don't want to maintain a separate copy of BUILD targets for all of the xDS protos, because
(a) this will be a maintenance burden
(b) it could lead to ODR violations if another target depends on both copies of the xDS proto targets.
Closes#41302
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/41302 from rishesh007:remove_parse_headers 42134419d292d0b18ca1c1d71e7c3d1611c5115e
PiperOrigin-RevId: 850383567
Fix a few issues when build with OpenSSL versions
OpenSSL1.0.2 - copied some CRL related test code that was not valid assumptions for these tests.
OpenSSL1.1.1 - The regex is too sensitive, only do the regex check for BoringSSL
OpenSSL3 - We though the Invalid UTF8-SAN behavior should cause handshake failures for OpenSSL3 here and included different behavior, but that is still what is breaking. Let's revert that change.
Closes#41205
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/41205 from gtcooke94:fix_spiffe_portability 8818df50053944444c1093bdf500944b690422d3
PiperOrigin-RevId: 842526173
This is needed for gRFC A105 (https://github.com/grpc/proposal/pull/516). Specifically, see the "Interaction with xDS Circuit Breaking" section.
It's possible for an LB pick to be happening at the same time as the subchannel sees its underlying connection fail. In this case, the picker can return a subchannel, but when the channel tries to start a call on the subchannel, the call creation fails, because there is no underlying connection. In that case, the channel will queue the pick, on the assumption that the LB policy will soon notice that the subchannel has been disconnected and return a new picker, at which point the queued pick will be re-attempted with that new picker.
When the picker returns a complete pick, it can optionally return a `SubchannelCallTracker` object that allows it to see when the subchannel call starts and ends. In the current API, when the channel successfully creates a call on the subchannel, it will immediately call `Start()`, and then when the subchannel call later ends, it will call `Finish()`. However, when the race condition described above occurs, the `SubchannelCallTracker` object will be destroyed without `Start()` or `Finish()` ever having been called. This API allows us to handle call counter incrementing and decrementing for things like xDS circuit breaking: we check the counter in the picker to see that it's currently below the limit, we increment the counter in `Start()`, and decrement it in `Finish()`. If the subchannel call never starts, then the counter never gets incremented.
With the introduction of connection scaling functionality in the subchannel, this approach will no longer work, because the call may be queued inside of the subchannel rather than being immediately started on a connection, and the channel can't tell if that is going to happen. In other words, there's no longer any benefit to the `Start()` method, because it will no longer actually indicate that the call is actually being started on a connection. As a result, I am removing that method from the API.
For xDS circuit breaking in the xds_cluster_impl LB policy, we are now incrementing the call counter in the picker, and the `SubchannelCallTracker` object will decrement it when either `Finish()` is called or when the object is destroyed, whichever comes first.
For grpclb, the `Start()` method was used in an ugly hack to handle ownership of the client stats object between the grpclb policy and the client load reporting filter. The LB policy passes a pointer to this object down to the filter via client initial metadata, which contains a raw pointer and does not hold a ref. To handle ownership, the LB policy returns a `SubchannelCallTracker` that holds a ref to the client stats object, but when `Start()` is called, it releases that ref, on the assumption that the client load reporting filter will subsequently take ownership. I've replaced this with a slightly cleaner approach whereby the call tracker always holds a ref to the client stats object, thus guaranteeing that the client stats object exists when the client load reporting filter sees it, and the client load reporting filter takes its own ref when it runs. (An even cleaner approach would be to instead pass the client stats object to the filter via a call attribute, similar to how we pass the xDS cluster name from the ConfigSelector to the LB policy tree, but it doesn't seem worth putting that much effort into grpclb at this point.)
Closes#41099
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/41099 from markdroth:xds_circuit_breaking_counter_change eaa06bbdf1688c31c0d1e3b3cabe6a7d015fc075
PiperOrigin-RevId: 842261731
<!--
If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.
If your pull request is for a specific language, please add the appropriate
lang label.
-->
Closes#41121
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/41121 from pawbhard:temp_check 185a3d8cc4f617d6df66d4f1adc738ef9a4b13f6
PiperOrigin-RevId: 838668301
Pass a MemoryAllocator to the serialize function, so that the write memory can be allocated towards Resource Quota accounting. Add templates for SerializationTraits, to allow implementations to continue using an implementation of Serialize, which does not take the allocator as a parameter. This change is a no-op for now, because all the callers of Serialize pass nullptr for the allocator.
PiperOrigin-RevId: 826159627
This CL starts the work to export the new instrument domains system to OTEL.
Only counters are attempted at this point, the work is behind an experiment, and that experiment is disabled.
PiperOrigin-RevId: 825842970
This is a shared library target for gRPC Sleuth Python extension.
<!--
If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.
If your pull request is for a specific language, please add the appropriate
lang label.
-->
Closes#40965
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40965 from yousukseung:sleuth-so b6f99b496b46e8dd599b08662370d4fdf4050b9c
PiperOrigin-RevId: 825233373
- Use a print function instead of stdout/stderr
- Made existing main() into a library accessible via an API.
- Enabled multiple executions of the current main().
- Removed absl flags for better flag management when using the API.
- Consolidated SLEUTH_TOOL and absl flags (only behavioral change).
PiperOrigin-RevId: 823083768
This change introduces the ability for LatentSee events to carry additional, type-specific data. This data is stored in a variable-sized manner within the LatentSee bins and can be serialized to JSON as part of the event's arguments. The ZTrace collector is updated to log its events using this new LatentSee extra event mechanism.
PiperOrigin-RevId: 822286249
Skip the regex that is breaking in ossl3 builds
Fix invalid UTF-8 SAN test for OpenSSL 3.0
This change updates the InvalidUtf8San test case in spiffe_ssl_transport_security_test.cc to account for different behavior in OpenSSL 3.0. OpenSSL 3.0 is stricter about invalid UTF-8 in certificate Subject Alternative Names (SANs), causing the handshake to fail. The expectations for server and client success are adjusted accordingly for OpenSSL 3.0+. Additionally, EXPECT_EQ is changed to ASSERT_EQ when extracting the peer to prevent crashes if extraction fails.
Closes#40902
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40902 from gtcooke94:test_fixes e5e88926e2554716b621adaeb7e2af8cf17eea3c
PiperOrigin-RevId: 821934652