Commit Graph

4718 Commits

Author SHA1 Message Date
Craig Tiller bc949f8fb2 Integrate telemetry domains with channelz.
This change adds `MetricsDomainNode` and `MetricsDomainStorageNode` to channelz. `QueryableDomain` and `DomainStorage` now inherit from `channelz::DataSource`, exposing domain metadata, labels, and metric values through channelz.

PiperOrigin-RevId: 806081893
2025-09-11 19:46:42 -07:00
Sreenithi Sridharan b931270b88 Revert "[Python] Fix Python observability test breakage (#40481)" (#40662)
This reverts PR #40481

#40481 was work in progress and doesn't fix the mentioned observability test yet. It was wrongly submitted due to an earlier approval.

Closes #40662

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40662 from sreenithi:revert_wrong_commit bc8f55c2ed6c5fb8220f37827a43bb83a7d6511d
PiperOrigin-RevId: 805405106
2025-09-10 10:02:08 -07:00
Sreenithi Sridharan 5d81e88ae3 [Python] Fix Python observability test breakage (#40481)
#40417 has caused the Python Basic Tests job to fail continuously since this morning with the error
```
from grpc_observability import _open_telemetry_observability
  File "/var/local/git/grpc/py39/lib/python3.9/site-packages/grpc_observability/_open_telemetry_observability.py", line 23, in <module>
    from grpc_observability import _cyobservability
ImportError: /var/local/git/grpc/py39/lib/python3.9/site-packages/grpc_observability/_[cyobservability.cpython-39-x86_64-linux-gnu.so](https://www.google.com/url?q=http://cyobservability.cpython-39-x86_64-linux-gnu.so&sa=D): undefined symbol: _ZN9grpc_core17instrument_detail15QueryableDomain19AllocateDoubleGaugeESt17basic_string_viewIcSt11char_traitsIcEES5_S5_
```

This PR fixes it by adding the required dependency in grpcio-python-observability.

Passing Basic Tests Run using this fix:
https://btx.cloud.google.com/invocations/239da2ca-1394-42f7-aa5c-ac63b938b200/targets

Closes #40481

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40481 from sreenithi:fix_basic_test_breakage 124d6da56ccca7eae92a64d911ab6eb31f05175f
PiperOrigin-RevId: 805276991
2025-09-10 02:52:44 -07:00
Sergii Tkachenko 9e2283db67 [Python] aio: skip grpc/aio shutdown if py interpreter is finalizing (#40447)
This PR changes the logic of `shutdown_grpc_aio` to skip `_actual_aio_shutdown` python interpreter is already [being finalized](https://docs.python.org/3.14/glossary.html#term-interpreter-shutdown) (cleaning up resources, destroying objects, preparing for program exit, etc). `_actual_aio_shutdown` involves `PollerCompletionQueue` shutdown, followed by core [`grpc_shutdown`](https://grpc.github.io/grpc/core/grpc_8h.html#a35f55253e80714c17f4f3a0657e06f1b) API call.

Reasoning:
1. During finalizations, in come cases resources we're accessing may already be freed, and the order is not deterministic. Some of the resources being unloaded prior the  `_actual_aio_shutdown` call: `_global_aio_state`, `AsyncIOEngine` enum, or even python libraries like `sys`. This leads to errors like `AttributeError: 'NoneType' object has no attribute 'POLLER'`.
2. `PollerCompletionQueue.shutdown()` will try to wait on its poller thread to finish gracefully. In py3.14, `PythonFinalizationError` is raised when `Thread.join()` is called during finalization. I think the logic here is similar to (1): these threads may have already been deallocated.

Note that in some cases users were able to prevent `_actual_aio_shutdown` from being called by manually calling `init_grpc_aio` prior to initializing any grpc objects.  This resulted in an incorrect positive refcount, which prevents `_actual_aio_shutdown` from being run. Before the above finalization check was added this side-effect was sometimes misused to avoid deadlock on finialization (#22365).

This PR:
- Fixes #39520
- Fixes #22365
- Fixes #38679
- Fixes #33342
- Fixes #36655

Closes #40447

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40447 from sergiitk:fix/aio/shutdown 11114f6feffd7380e9fde56e7581eb19cf001597
PiperOrigin-RevId: 804971756
2025-09-09 10:40:10 -07:00
Eugene Ostroukhov 7949731064 [event_engine] Introduce a event_engine_poller_for_python experiment (#40243)
This commit introduces the `event_engine_poller_for_python` experiment, allowing for controlled rollout and testing of the EventEngine's Posix poller specifically within gRPC Python bindings.

**Crucially, this change does *not* alter the default behavior for builds where `GRPC_DO_NOT_INSTANTIATE_POSIX_POLLER` is *not* defined.** In such configurations, the Posix EventEngine poller will continue to be enabled unconditionally, preserving existing functionality.

The primary impact of this change is when `GRPC_DO_NOT_INSTANTIATE_POSIX_POLLER` *is* defined (e.g., in gRPC Python's build system). In this scenario, the enablement of the Posix poller transitions from being implicitly disabled to being configurable via the `event_engine_poller_for_python` experiment flag. This enables a controlled, experimental rollout of the EventEngine poller in environments that previously opted out of its direct instantiation.

Closes #40243

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40243 from eugeneo:python-no-backup-poller-experiment 17906e6501b8e6fe7d2ccc63439ec121ef47d43b
PiperOrigin-RevId: 804472655
2025-09-08 09:52:13 -07:00
Sreenithi Sridharan ee5325b9f1 [Python][Support 3.14] Enable 3.14 in Python Basic, Bazel and Distrib tests (#40403)
This PR enables Python 3.14 in all the different tests - Basic tests (Native Python tests), Bazel tests and Distrib tests to build Python 3.14 artifacts. In addition, it also updates all the public facing METADATA versions.

## Distribtests
Required pre-requisite changes to enable 3.14 artifacts are covered in #40289 .

## Bazel tests
Enabling Python 3.14 required updating the rules_python version to a more recent version that supports 3.14. This was done in #40602

## Basic tests
The following errors were caught by the Basic tests when running via Python 3.14 and resolved in this PR:

### 1) No running event loop for AsyncIO when run outside an async function
```
Traceback (most recent call last):
  File "src/python/grpcio/grpc/_cython/_cygrpc/aio/common.pyx.pxi", line 184, in grpc._cython.cygrpc.get_working_loop
RuntimeError: no running event loop
```
This was caught by the `tests_aio.unit.outside_init_test.TestOutsideInit` and `tests_aio.unit.init_test.TestInit` tests, and was also previously reported in #39507 with the root cause.

Following some investigation, the fix is being worked on by @sergiitk  in PR #40293. In order to parallelize the fix and this PR, these 2 tests are currently being skipped for Python 3.14 and above.

### 2) Pickling error from the `multiprocessing` library
```
_pickle.PicklingError: Can't pickle <function _test_well_known_types at 0x7f3937eee610>: it's not the same object as tests.unit._dynamic_stubs_test._test_well_known_types
when serializing dict item '_target'
when serializing multiprocessing.context.Process state
when serializing multiprocessing.context.Process object
```
This was caught by the `tests.unit._dynamic_stubs_test.DynamicStubTest` which runs test cases in a subprocess using the `multiprocessing` library.
Error root cause:
- The default start method of multiprocessing in linux has changed to `forkserver` instead of `fork` from Python 3.14.
- `forkserver` has a few extra restrictions for picklability as compared to `fork` (Ref: [Python Docs](https://docs.python.org/3.14/library/multiprocessing.html#the-spawn-and-forkserver-start-methods))
- All the [test case functions](https://github.com/grpc/grpc/blob/0243842d5d10f624bf8f09f45026dd300805502f/src/python/grpcio_tests/tests/unit/_dynamic_stubs_test.py#L115) in the DynamicStubTest that are provided as `target` to the `multiprocessing.Process` use decorators. This causes problems when pickling them.

Hence to resolve this, we manually set the 'start method' of `multiprocessing` to use the `fork` start method.

Closes #40403

PiperOrigin-RevId: 804290760
2025-09-07 23:58:12 -07:00
Craig Tiller 34611992c3 Convert ztrace to proto
PiperOrigin-RevId: 802878974
2025-09-03 23:40:59 -07:00
Pawan Bhardwaj fd1d6e0911 [xDS] Matcher API implementation (#39877)
Proto : https://github.com/cncf/xds/blob/main/xds/type/matcher/v3/matcher.proto
Will follow up with  more concrete classes as per usage. Added some basic to test e2e parse

Closes #39877

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/39877 from pawbhard:matcher e87d7ce6584c32a71a5610781d16e46cb78841d6
PiperOrigin-RevId: 802661365
2025-09-03 12:31:55 -07:00
Craig Tiller 30f993b1e8 Migrate Resource Quota telemetry to a dedicated InstrumentDomain.
Roll forward of a prior change, this change includes fixes and also memory reclamation support for orphaned domain storage.

PiperOrigin-RevId: 802204833
2025-09-02 10:44:54 -07:00
apolcyn 73c0f8ac9c [release] Bump dev version on to 1.76.0-dev (#40484)
As title

Closes #40484

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40484 from apolcyn:bump_dev_version_202508191952 e788be57e9dc7f5e8316bee4baadec26fba3f6e6
PiperOrigin-RevId: 798331971
2025-08-22 14:01:19 -07:00
Craig Tiller fcf69fba84 Automated rollback of commit 56976b0b3c.
PiperOrigin-RevId: 796900113
2025-08-19 09:13:22 -07:00
Craig Tiller 56976b0b3c Migrate Resource Quota telemetry to a dedicated InstrumentDomain.
This change introduces a new `ResourceQuotaDomain` and registers Resource Quota related counters (`rq_calls_dropped`, `rq_calls_rejected`, `rq_connections_dropped`) within this domain. Each `MemoryQuota` now holds a reference to a `ResourceQuotaDomain` Storage instance, allowing these metrics to be tracked per resource quota. The usage sites in `chttp2_transport.cc` and `parsing.cc` are updated to use the new per-quota telemetry storage. The old global stats definitions for these counters are removed.

Introduce gauges also, and use them to report current memory pressure.

PiperOrigin-RevId: 796613444
2025-08-18 16:08:16 -07:00
Sergii Tkachenko b9689621ea [Python] macOS build: fix unused-command-line-argument -stdlib=libc++ (#40446)
Fixes macOS compilation warnings:

```
clang: warning: argument unused during compilation: '-stdlib=libc++' [-Wunused-command-line-argument]
```

c- and cpp-specific arg filters were out of sync.

For Darwin platform, `-stdlib=libc++` is in EXTRA_ENV_COMPILE_ARGS, but not excluded during in BuildExt.build_extensions#new_compile().

This also adds a reminder note to keep these in sync when updating one or another.

Repro:

```sh
export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 GRPC_PYTHON_BUILD_WITH_CYTHON=1
python setup.py build_ext
```

Closes #40446

PiperOrigin-RevId: 796609793
2025-08-18 15:59:37 -07:00
Sergii Tkachenko 848ac537ad [Python] Allow local builds to skip _grpcio_metadata.py regeneration (#40436)
Now every time we build grpcio wheel locally, it removes the copyright
header from
[`src/python/grpcio/grpc/_grpcio_metadata.py`](https://github.com/grpc/grpc/blob/368c313ffe54a723cb70ac294f5f040f7096a7c4/src/python/grpcio/grpc/_grpcio_metadata.py).
This happens because setup.py command fully overrides the content of
this file with `__version__ = ...` (even if the version is the same).

This is not a problem on its own, but it gets pretty tedious to git
reset/stash this file every time.

This PR allows to `export
GRPC_PYTHON_BUILD_SKIP_METADATA_ON_VERSION_MATCH=1`, and
`_grpcio_metadata.py` will only be changed when there's an actual
version change.

I think it'll make sense to just keep this behavior by default (only
update the file when there version is different), but for now, for the
sake of not accidentally breaking CIs for this local-specific change,
let's guard this behavior with the
`GRPC_PYTHON_BUILD_SKIP_METADATA_ON_VERSION_MATCH` var.

Future improvement to consider: instead of comparing versions, we should
consider only updating the `__version__`, while preserving the rest of
the file.
2025-08-18 10:27:50 -07:00
Aditya Ajayshankar 67efd3a6ec [Python] gRPC AsyncIO: Improve CompletionQueue polling performance (#39993)
Enable integer exception checking for performance improvement. This also resolves Asyncio segfaults with free-threaded Python.

Takes care of Cython performance hint:
```
performance hint: src/python/grpcio/grpc/_cython/_cygrpc/aio/completion_queue.pyx.pxi:126:22:

Exception check after calling '_poll' will always require the GIL to be acquired.
Possible solutions:
	1. Declare '_poll' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
	2. Use an 'int' return type on '_poll' to allow an error code to be returned.
```

Details in https://cython.readthedocs.io/en/3.1.x/src/userguide/language_basics.html#error-return-values:

> There’s a known performance pitfall when combining `nogil` and `except *` `@cython.exceptval(check=True)`. In this case Cython must always briefly re-acquire the GIL after a function call to check if an exception has been raised. This can commonly happen with a function returning nothing (C `void`). Simple workarounds are to mark the function as `noexcept` if you’re certain that exceptions cannot be thrown, or to change the return type to `int` and just let Cython use the return value as an error flag (by default, `-1` triggers the exception check).

Closes #39993

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/39993 from aditya-1112:aio-segfault-fix bdc3310d4650dafaca5e97b1d4999e933674ee61
PiperOrigin-RevId: 796464140
2025-08-18 09:49:07 -07:00
AJ Heller ff8461db74 Begin moving gRPC socket_mutator files out of the iomgr folder
PiperOrigin-RevId: 792247693
2025-08-07 11:51:02 -07:00
Craig Tiller 806e186735 [telemetry] Prepare to introduce Concrete Types For Call Tracers
This change renames the existing interface types to have `Interface` in the name, and prepares the ground for concrete types for the call tracers.

PiperOrigin-RevId: 790173028
2025-08-02 11:42:16 -07:00
Hannah Shi c26420d425 [ObjC] cfsocket listener implementation (#40097)
1. update cfstream endpoint to open accepted socket
2. add cfsocket listener
3. enabled event engine server test in mac and ios
4. fix an issue cfstream endpoint not releasing streams
5. endpoint config is not supported
5. unix and vsock are not supported
6. e2e tests and samples will be added later

Closes #40097

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40097 from HannahShiSFB:cfstream-server bb504c91cb5ea23d55a1093848391fc31d9a1924
PiperOrigin-RevId: 789089100
2025-07-30 16:33:02 -07:00
Ashesh Vidyut 52bf7a663d [Python][Part 5] - Introducing Ruff (#40180)
### Description

## Part 5 of Introducing Ruff

* In this PR - the suppression for `D417`, `DTZ001`, `E402`, `E713`, `E722` and `EM101` has been removed on the root `ruff.toml`

## Related:
* Next: #40181
* Prev: #40180
* b/423755915

Closes #40180

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40180 from asheshvidyut:feature/setup-ruff-part-5 1b2e57d05f7d41053afec20b5ea337d2565fa7d3
PiperOrigin-RevId: 787933947
2025-07-28 03:28:13 -07:00
Ashesh Vidyut 82cf4e0557 [Python][Part 4] - Introducing Ruff (#40173)
### Description

## Part 4 of Introducing Ruff

* In this PR - the suppression for `C408`, `D100`, `D101`, `D202`,`D207`, `D209`, `D403`, `D404`,  `D410` and `D411` has been removed on the root `ruff.toml`

## Related:
* Next: #40180
* Prev: #40172
* b/423755915

Closes #40173

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40173 from asheshvidyut:feature/setup-ruff-part-4 27808176fea90679b7a7057a3c3746814192b571
PiperOrigin-RevId: 787931275
2025-07-28 03:18:35 -07:00
Vignesh Babu d5927d0a32 Reland https://github.com/grpc/grpc/pull/40231
PiperOrigin-RevId: 787189929
2025-07-25 11:58:23 -07:00
Ashesh Vidyut a1d4abd7fe [Python][Part 3] - Introducing Ruff (#40172)
### Description

## Part 3 of Introducing Ruff

* In this PR - the suppression for `ARG004`, `ARG005`, `B007`, `B011`, `B018`, `B027`,   `C402` and `C405` has been removed on the root `ruff.toml`

## Related:
* Next: #40173
* Prev: #40171 (not merged)
* b/423755915

Closes #40172

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40172 from asheshvidyut:feature/setup-ruff-part-3 f00ab4565e525ac6ff7bd8e888a0016c0d19bf1a
PiperOrigin-RevId: 787009943
2025-07-25 01:15:08 -07:00
Ashesh Vidyut 2ca9ac63ce [Python][Typeguard] Part 3 - Add Typeguard to AIO stack in tests (#40217)
### Description

Part 3 of Add Typeguard to AIO stack - runs only in tests, fixes type hints for  `grpc.aio._utils` and `grpc.aio._call`

### Testing

CI

### Related work

* Part1: #40201
* Part2: #40215

Closes #40217

This CL also has changes from https://github.com/grpc/grpc/pull/40286/files, because it was merged on Github without copybara.

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40217 from asheshvidyut:feature/type-hints/typeguard-aio-stack-part-3 cd82052353f2486538ccb0505d6b9db02e68cb9b
PiperOrigin-RevId: 786961247
2025-07-24 21:57:55 -07:00
Craig Tiller 1ca74279a2 [channelz] Rendering improvements for v2 entities
Add styling and some principled rendering to get v2 entity html looking a little more readable by humans.

PiperOrigin-RevId: 786961005
2025-07-24 21:54:34 -07:00
Ashesh Vidyut 6f804fffb5 [Python][Part 6] - Introducing Ruff (#40181)
### Description

## Part 6 of Introducing Ruff

* In this PR - the suppression for `EM102`, `EM103`, `F523`, `F541`, `F821`, `FIX004`, `FLY002`, `FURB188`, `G003`, `G004`, `INP001`, `ICN001`, `LOG015` and `N803` has been removed on the root `ruff.toml`

Closes #40181

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40181 from asheshvidyut:feature/setup-ruff-part-6 a82aae8073663bc525a7119c21f6ba3b821ab425
PiperOrigin-RevId: 786950190
2025-07-24 21:08:22 -07:00
Sergii Tkachenko 0497da859e [CI] Use python 3.9+ everywhere (#40139)
- Upgrade the base image of  https://us-docker.pkg.dev/grpc-testing/testing-images-public/bazel to newer https://gcr.io/oss-fuzz-base/base-builder@sha256:4f3ca10accd14292556601d70e457fa85ad57180c913484427869d3379a07684, which comes with python3.11

  Before:
  ```

  Python 3.8.3 (default, Mar 12 2024, 03:21:22)
  [Clang 15.0.0 (https://github.com/llvm/llvm-project.git bf7f8d6fa6f460bf0a16ffe
  ```

  After:
  ```
  Python 3.11.13 (main, Jul 16 2025, 03:42:11)
  [Clang 18.1.8 (https://github.com/llvm/llvm-project.git 3b5b5c1ec4a3095ab096dd78
  ```
- Refactor and improve  https://us-docker.pkg.dev/grpc-testing/testing-images-public/sanity. Removed building python 3.7 from source.
- Switch Windows builds to use `3.9.13` (previously `3.8.10`)
- Changed minimum python version in bazel builds from 3.8 to 3.9.
- Updated pylint to use python3.11.
- Various minor compatibility fixes.

There's a few other dependencies/settings that can be upgraded now that we're using 3.9+. I'll make them in a follow-up PR.

Closes #40139

PiperOrigin-RevId: 786775922
2025-07-24 11:31:19 -07:00
Gregory Cooke 783e053680 Spiffe xds (#40279)
Roll forward after rollback of #39708 with the change to move `JsonLoader` impls from the `spiffe_utils.h` to `spiffe_utils.cc`. There was potential to cause a linker issue with the impls in the header.

Closes #40279

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40279 from gtcooke94:spiffe_xds 66fce6de7a546d4cb638d79cacdd0f18718e52b4
PiperOrigin-RevId: 786762336
2025-07-24 10:56:46 -07:00
Ashesh Vidyut 4499b46e4f [Python][Typeguard] Part 2 - Add Typeguard to AIO stack in tests (#40215)
### Description

Part 2 of Add Typeguard to AIO stack - runs only in tests, fixes type hints for  `grpc.aio._interceptor` and `grpc.aio._utils`

### Type hint for Public API change for Experimental API

**Fixing the error in public API** - `ClientCallDetails` where `method` was `str` but actually it should be `bytes`.

It was detected by `typeguard` as well.

### Testing

CI

### Related Work
- Part 1: #40201
- Part 3: #40217
- b/423755915

Closes #40215

This CL has changes from https://github.com/grpc/grpc/pull/40286/files because it was merged to master on Github without copybara.

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40215 from asheshvidyut:feature/type-hints/typeguard-aio-stack-part-2 3fc7a9d6aff8d84f2ee004c7ba8303919546378c
PiperOrigin-RevId: 786606656
2025-07-24 15:20:04 +00:00
Tanvi Jagtap - Google LLC ff89e7b32d [Fix][Sanity] Fix master (#40305)
[Fix][Sanity] Fix master

Closes #40305

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40305 from tanvi-jagtap:fix_master 77aaeab5c0f49b2fc0ed72df546079190ceed47c
PiperOrigin-RevId: 786572880
2025-07-24 15:18:36 +00:00
Craig Tiller c675ef8859 Automated rollback of commit a9796dbe6f.
PiperOrigin-RevId: 786454401
2025-07-24 15:15:36 +00:00
Craig Tiller 24a1e480cb [sanity] Fix (#40286)
<!--

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.

-->
2025-07-22 22:02:01 -07:00
gRPC Team Bot a9796dbe6f Rollback channelz v2tov1 related changes due to multiple breakages
PiperOrigin-RevId: 786098574
2025-07-22 19:55:52 -07:00
Craig Tiller f8a881fa6c Reland channelz v2tov1 features
Includes:
- An experiment for the v1 service, start using only the v2 api from channelz, and downgrade using the conversion library.
- An experiment to move the C APIs that wrapped languages can use to implement channelz v1.
PiperOrigin-RevId: 786039931
2025-07-22 19:54:03 -07:00
Gregory Cooke 3af3e09105 Automated rollback of commit 889aaeae79.
PiperOrigin-RevId: 785820361
2025-07-22 05:58:39 -07:00
Vignesh Babu ff5c4493ea Revert https://github.com/grpc/grpc/pull/40231
PiperOrigin-RevId: 785577934
2025-07-21 14:33:18 -07:00
Gregory Cooke 889aaeae79 [Security - XDS] Add Spiffe Bundle Map support to providers (#39708)
This is a large PR, so I wanted to provide an outline:

In the end, this is basically just changing the piping of roots around gRPC. We used to just have a single `std::string root_certificate`. Now, we can have that **OR** a `SpiffeBundleMap`. Thus, the piping was changed to use `std::variant`. The `SpiffeBundleMap` is passed around as a `shared_ptr` to reduce copies while working within the existing complex lifetime management structure.

This PR pipes from the configuration of a provider to the OpenSSL integration layer in `ssl_transport_security.cc`. It _does not_ actually configure this value in OpenSSL or use this value to do verification yet, that will be a follow-up PR.
It also handles the live updates of roots, being either spiffe bundles or a raw certificate. There's a lot of existing complex conditionals here, so I tried to add named booleans to make the different states clear and make the code more readable.

In addition, I took many of the existing tests, copied them, and swapped root certificates for SpiffeBundleMaps. As a warning, several of the testing setups are pretty dense. Further confidence with this will be built in the follow-up PR when we are actually using these values for verification in end2end flows.

Closes #39708

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/39708 from gtcooke94:spiffe_xds 1e1503af150e697dc66f4a96ee6ba9990a703acb
PiperOrigin-RevId: 784333570
2025-07-17 15:19:41 -07:00
Craig Tiller 9ad02e32d8 Rollback channelz v2tov1 related changes
PiperOrigin-RevId: 784242817
2025-07-17 11:02:35 -07:00
Vignesh Babu 8462f347a0 [Filter Fusion] Integrate fused filters target into core gRPC (#40231)
The target is still a no-op for mobile platforms like android and ios

Closes #40231

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40231 from Vignesh2208:fusion-integrate dcf2ce1b6723e2e2827ea0f728d7cf2afde478af
PiperOrigin-RevId: 783907814
2025-07-16 15:04:12 -07:00
apolcyn 18dbb83657 [c-ares] update version to 1.34.5 (#39508)
Fixes https://github.com/grpc/grpc/issues/39026

A few notheworthy changes here besides the version bump itself:

- Reorder the way we pull in `ares.h` in various places, so that we make sure to pull in necessary windows header ahead of time. In older c-ares, the `ares.h` public header was more self-contained w.r.t. windows headers including `winsock2.h`. E.g. see [old way of inclusion](https://github.com/c-ares/c-ares/blob/6360e96b5cf8e5980c887ce58ef727e53d77243a/include/ares.h#L64) vs. [new way of inclusion](https://github.com/c-ares/c-ares/blob/42ddbc14ec008e738fa44aa2c16e74cad93742c2/include/ares.h#L52). I'm not crazy about this fix here but couldn't see a much cleaner way (we could maybe set `CARES_HAVE_WINSOCK2_H` in `port_platform.h` alternatively)

- Upated hand-crafted `config_windows/ares_config.h` to set newly required build defs for the c-ares build itself to work on windows

- Fix ruby macos cross-compilation build to correctly set `SYSTEM` Makefile var to `Darwin` (so that we pull in `config_darwin/ares_config.h`, so far we've been getting away with the linux build mode)

- Change ruby macos MINGW32 cross-compilation build to use our hand crafted `config_windows/ares_config.h` header

- Explicitly link `iphlpapi` on Windows. I think we used to pick this up during c-ares library build from [this pragma](https://github.com/c-ares/c-ares/blob/6360e96b5cf8e5980c887ce58ef727e53d77243a/include/ares.h#L71), but now that's [hidden under build define](https://github.com/c-ares/c-ares/blob/42ddbc14ec008e738fa44aa2c16e74cad93742c2/include/ares.h#L59)

Closes #39508

PiperOrigin-RevId: 783875246
2025-07-16 13:32:45 -07:00
y-yagi 4ea3102507 [Python] Remove compat_check_pypi from grpcio README.rst (#37452)
It seems that
[python-compatibility-tools.appspot.com](https://python-compatibility-tools.appspot.com/)
doesn't work now. And, cloud-opensource-python is archived already.

https://github.com/GoogleCloudPlatform/cloud-opensource-python
2025-07-16 10:58:40 -07:00
Sergii Tkachenko 818520abe3 [Python] Add typing-extensions dependency (#40137)
References:

- https://pypi.org/project/typing-extensions
- https://github.com/python/typing_extensions
- https://typing-extensions.readthedocs.io/en/latest

Closes #40137

PiperOrigin-RevId: 783638752
2025-07-16 00:33:50 -07:00
Craig Tiller 608e516b60 [channelz] Move legacy apis to use v2->v1
We have a set of C APIs that wrapped languages can use to implement channelz v1.
Migrate these to use the conversion library, and isolate them into a new file.

An experiment is added so we can do a gradual rollout.

PiperOrigin-RevId: 783581214
2025-07-15 20:48:27 -07:00
Ashesh Vidyut 9ac4b4d2f4 [Python] [Part 1] Add Typeguard to AIO stack in tests (#40201)
### Description

Add typeguard to AIO stack - runs only in tests

### Testing

To test if this change works on or not, I added return type `-> str` in this line -

https://github.com/grpc/grpc/blob/master/src/python/grpcio/grpc/aio/_server.py#L207

Then command

```
bazel test //src/python/grpcio_tests/tests_aio/unit:all
```

started failing with error of typeguard.

Closes #40201

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40201 from asheshvidyut:feature/type-hints/typeguard-aio-stack cea4d6b7dceb55238a53680be71b5c1f3f3a63e4
PiperOrigin-RevId: 783243843
2025-07-15 02:18:52 -07:00
Tanvi Jagtap - Google LLC 2eecbcc8a3 [PH2] Fixing circular dependency (#40204)
[PH2] Fixing circular dependency

`Http2SettingsManager` needs `frame.h`.
Our new validation code in frame.h needs `Http2Settings`.
So we split `Http2Settings` and `Http2SettingsManager` into 2 separate header files to resolve the circular dependency.

Closes #40204

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40204 from tanvi-jagtap:ph2_fixing_circular_dependency 17718955eb455aa8d20840d9d0a9a8712c63dd01
PiperOrigin-RevId: 783114803
2025-07-14 18:07:34 -07:00
Sergii Tkachenko b04d3821d4 [CI] Bump pylint to 2.17.7 (#40169)
In preparation for migrating it from python3.7 to python3.11.
Pylint version had to be upgraded because pylint==2.2.2 doesn't support python 3.11.

The image will be updated separately to remove compiling python3.7 from source in #40139.

Pylint v2.17.7 docs: https://pylint.readthedocs.io/en/v2.17.7

Closes #40169

PiperOrigin-RevId: 783026287
2025-07-14 13:45:05 -07:00
Ashesh Vidyut e2e1d63b33 Fix correct path for ruff.toml (#40175)
### Description

Minor fix of path of `ruff.toml` for tests.

Closes #40175

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40175 from asheshvidyut:fix-correct-path-for-ruff.toml 2eedddcbd760b63ba65e76a9858ba84bd1e0193d
PiperOrigin-RevId: 782030862
2025-07-11 10:36:13 -07:00
Ashesh Vidyut 96e3b1839b [Python][Part 1] - Introducing Ruff (#40160)
## Description

### Part 1 of Introducing Ruff

* This is Part 1 of introducing ruff series.
* The following PRs will remove some of the supressed rules introduced in this PR.
* This PR has all the folders which PyLint has currently.
* In the final part of these PRs, PyLint will be removed compeletly.

## Testing
CI

Closes #40160

PiperOrigin-RevId: 781990339
2025-07-11 08:29:05 -07:00
Ashesh Vidyut 91a2760ee0 [Python] grpcio_testing: handle UnboundLocalError in a server test helper (#40140)
## Description
This should fix the issue - https://github.com/grpc/grpc/issues/40125

Closes #40140

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/40140 from asheshvidyut:fix/issue-40125 05d16f7d8b7f4320c961f24a4015a53d1aa582f7
PiperOrigin-RevId: 781293805
2025-07-09 18:21:28 -07:00
Vignesh Babu 8d51dea38b Revert https://github.com/grpc/grpc/pull/39697 as it increase binary size of mobile builds
PiperOrigin-RevId: 780678045
2025-07-08 12:55:08 -07:00
Alisha Nanda 4806c33d8f Add experiment to pipeline secure endpoint reads so reading and unprotecting can occur in parallel.
PiperOrigin-RevId: 780258628
2025-07-07 14:23:40 -07:00