Commit Graph

54389 Commits

Author SHA1 Message Date
Yousuk Seung e1cb290ef8
[tracing] Add member getters to HttpAnnotation (#34592) (#34905)
So that users can process annotations other than calling ToString().




<!--

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.

-->
2023-11-09 14:35:21 -08:00
Alisha Nanda a2128da294
[chttp2] Remove absl::optional for TaskHandle (#34892) 2023-11-09 14:28:16 -08:00
Yijie Ma 720d7a0653
[EventEngine] WindowsDNSResolver Implementation (#34400)
Design is documented at
[go/windows-dns-resolver-issue](http://go/windows-dns-resolver-issue)
(note that the design doc is slightly outdated regarding the shared
ownership model of the virtual socket that was implemented in
13bd2b404e).

Passed `//test/cpp/naming:resolver_component_tests_runner_invoker` and
`//test/cpp/naming:cancel_ares_query_test`:
```
C:\Users\yijiem\projects\grpc>bazel --output_base=C:\bazel6 test --dynamic_mode=off --verbose_failures --test_env=GRPC_EXPERIMENTS=event_engine_dns --test_env=GRPC_VERBOSITY=debug --test_env=GRPC_TRACE=cares_resolver --enable_runfiles=yes --nocache_test_results //test/cpp/naming:resolver_component_tests_runner_invoker
INFO: Analyzed target //test/cpp/naming:resolver_component_tests_runner_invoker (1 packages loaded, 8 targets configured).
INFO: Found 1 test target...
INFO: From Compiling src/core/lib/event_engine/windows/windows_engine.cc:
C:\bazel6\execroot\com_github_grpc_grpc\src/core/lib/channel/channel_args.h(287): warning C4312: 'reinterpret_cast': conversion from 'int' to 'void *' of greater size
Target //test/cpp/naming:resolver_component_tests_runner_invoker up-to-date:
  bazel-bin/test/cpp/naming/resolver_component_tests_runner_invoker.exe
INFO: Elapsed time: 230.374s, Critical Path: 228.54s
INFO: 9 processes: 2 internal, 7 local.
INFO: Build completed successfully, 9 total actions
//test/cpp/naming:resolver_component_tests_runner_invoker                PASSED in 221.2s

Executed 1 out of 1 test: 1 test passes.
```

```
C:\Users\yijiem\projects\grpc>bazel --output_base=C:\bazel6 test --dynamic_mode=off --verbose_failures --test_env=GRPC_EXPERIMENTS=event_engine_dns --test_env=GRPC_VERBOSITY=debug --test_env=GRPC_TRACE=cares_resolver --enable_runfiles=yes --nocache_test_results //test/cpp/naming:cancel_ares_query_test
INFO: Analyzed target //test/cpp/naming:cancel_ares_query_test (0 packages loaded, 0 targets configured).
INFO: Found 1 test target...
Target //test/cpp/naming:cancel_ares_query_test up-to-date:
  bazel-bin/test/cpp/naming/cancel_ares_query_test.exe
INFO: Elapsed time: 49.656s, Critical Path: 48.00s
INFO: 6 processes: 2 internal, 4 local.
INFO: Build completed successfully, 6 total actions
//test/cpp/naming:cancel_ares_query_test                                 PASSED in 43.0s

Executed 1 out of 1 test: 1 test passes.
```

<!--

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.

-->
2023-11-09 14:22:31 -08:00
Alisha Nanda b0e0659bab
Revert "[experiments] Explicit requirement check" (#34911)
Reverts grpc/grpc#34880, needs to be cherry-picked in.
2023-11-09 11:23:58 -08:00
Alisha Nanda 972d2c4665
[chttp2] Remove unused fields from chttp2_transport (#34891) 2023-11-09 10:25:20 -08:00
Craig Tiller f4219440c6
[server] Fix fuzzing detected memory leak (#34908) 2023-11-09 10:07:45 -08:00
Mark D. Roth c5c46a1640
[memory test] add benchmark for xDS channel with multiple addresses (#34902)
The plumbing is a little messy here, but I didn't see an obvious way to
improve it without a lot of work.
2023-11-09 07:25:44 -08:00
AJ Heller 920882fbd9
[EventEngine] Respect requested thread pool size (#34904)
The current fixed minimum starting thread count (2 threads), combined
with the fixed thread spawn rate limit of 1/sec, was causing test issues
with some new EventEngine integrations.

For example, this test had a race wherein the alarm destructor was
expected to run within 1 second. In 5% of runs, the 2 EventEngine
threads were otherwise occupied, and it would take around 1 second to
spawn a new thread.

1e15d00ec4/test/cpp/common/alarm_test.cc (L418-L435)
2023-11-08 17:41:52 -08:00
Craig Tiller 3964acc806
[promises] Add an intra-activity mutex type (#34824)
Modeled after mutexes in the Rust ecosystem: the mutex owns the data
provided, and acquisition of the mutex returns a handle with which to
manipulate that data.

This fits in nicely with the execution environment we've established
whereby we may want to pass the lock from lambda to lambda for some
time.

---------

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2023-11-08 16:41:26 -08:00
Craig Tiller 88011e05f5
[experiments] Explicit requirement check (#34880)
Add a config to experiments & rollouts to allow dependent experiments to
be flagged.

We're getting past the point where it's possible to reason about which
experiments need to be turned off if we disable some other experiment,
and so this provides some additional rollout safety.

Can be specified in both experiments and rollouts: experiments.yaml
makes the most sense and we should default to it, but rollouts.yaml lets
us put dependencies between internal & external dependencies internally
and that's gonna be a little useful.

---------

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2023-11-08 16:05:03 -08:00
nanahpang 1e15d00ec4
[chaotic-good] Add client transport error handling. (#34611)
This is a follow-up PR of #34191, which handles the error condition of
endpoints failed to write/read in chaotic-good client transport.

This PR needs to be merged after #34191.

<!--

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.

-->
2023-11-08 14:42:20 -08:00
Craig Tiller e58268525a
[chttp2] Reland: Fix bug in timeout encoding (#34812) 2023-11-08 14:36:06 -08:00
Vignesh Babu 77e9fe49aa
Revert "[security] Support a list of SSL ECs" (#34900)
Breaks internal tests
2023-11-08 14:05:02 -08:00
Alisha Nanda a9291f59fb
[hpack] Dynamically allocate error for hpack parser (#34889)
And cache-align InterSliceState.
2023-11-08 14:00:50 -08:00
Yijie Ma d3828ebfbd
[Fork] Add ObjectGroupForkHandler fork-handling system (#33733)
<!--

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.

-->

---------

Co-authored-by: Bradley Hess <bdhess@google.com>
Co-authored-by: AJ Heller <hork@google.com>
2023-11-07 17:48:13 -08:00
Alisha Nanda f87ce8b413
[hpack] Do not inline elements for encoder hpack table (#34890) 2023-11-07 15:13:45 -08:00
Alisha Nanda 4b091c1fa0
[chttp2] Cache-align BDP estimator (#34893) 2023-11-07 15:13:28 -08:00
Terry Wilson 12df94b848
[interop] Add grpc-java 1.59.0 to client_matrix.py (#34764) 2023-11-07 15:05:46 -08:00
Mark D. Roth 1e111df8be
[grpclb_e2e_test] more test improvements and flake fixes (#34896)
- Fix deadlock in load reporting tests.
- Add timeout to `WaitForLoadReport()`. (Note: this required changing
from `grpc::internal::Mutex` and friends to `grpc_core::Mutex` and
friends.)
- Fix balancer stream shutdown machinery.
- Change `ServerThread` to be a class instead of a struct.
2023-11-07 14:47:15 -08:00
Michael P. Nitowski e3b7f577e0
[observability] Switch from datetime.utcnow to time.perf_counter (#34829)
datetime.utcnow() raises a deprecation warning on Python 3.12, so this
change prevents that deprecation warning while also switching to a
monotonic clock for calculating RPC latency

<!--

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.

-->

cc @XuanWang-Amos
2023-11-07 12:42:20 -08:00
Sergii Tkachenko 434a5c8e72
[PMS Interop] ADS detection: minor wording change (#34895)
Now we log pretty much identical message:

```
client_app.py:320] [psm-grpc-client-7768f6597-nvtgl] Detected successful calls to xDS control plane: trafficdirector.googleapis.com:443
client_app.py:292] [psm-grpc-client-7768f6597-nvtgl] ADS: Detected successful calls to xDS control plane trafficdirector.googleapis.com:443
```

This PR will log the latest channel state in the first message, similar
to what we do in `find_server_channel_with_state`:


52c08f4498/tools/run_tests/xds_k8s_test_driver/framework/test_app/client_app.py (L367-L371)

After the change:

```
client_app.py:320] [psm-grpc-client-6566595cff-8wrfd] Detected successful calls to xDS control plane trafficdirector.googleapis.com:443, channel: <Channel channel_id=4 target=trafficdirector.googleapis.com:443 call_started=9 calls_failed=8 state=READY>
client_app.py:292] [psm-grpc-client-6566595cff-8wrfd] ADS: Detected successful calls to xDS control plane trafficdirector.googleapis.com:443
```
2023-11-07 10:54:07 -08:00
Yousuk Seung 52c08f4498
[tracing] Only set tracers to stream when sampled. (#34870)
Generating an annotation is often expensive, there's no need to annotate
when not sampled.




<!--

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.

-->
2023-11-06 21:18:39 -08:00
Esun Kim d77e5c0dd3
[Build] Dropped Bazel 5.x and Upgraded Bazel 6.4.0 (#34813)
- Dropped Bazel 5.x support aligned with [Foundational C++ support
policy:
Bazel](https://opensource.google/documentation/policies/cplusplus-support).
- Upgraded Bazel 6 to 6.4.0 (the latest)
- Updated gRPC Bazel documentation to be aligned with the policy above.
2023-11-06 15:47:29 -08:00
Mark D. Roth 8a000f45f8
[grpclb and fake resolver] clean up e2e tests and simplify fake resolver (#34887)
Changes to fake resolver:
- Add `WaitForReresolutionRequest()` method to fake resolver response
generator to allow tests to tell when re-resolution has been requested.
- Change fake resolver response generator API to have only one mechanism
for injecting results, regardless of whether the result is an error or
whether it's triggered by a re-resolution.

Changes to grpclb_end2end_test:
- Change balancer interface such that instead of setting a list of
responses with fixed delays, the test can control exactly when each
response is set.
- Change balancer impl to always send the initial LB response, as
expected by the grpclb protocol.
- Change balancer impl to always read load reports, even if load
reporting is not expected to be enabled. (The latter case will still
cause the test to fail.) Reads are done in a different thread than
writes.
- Allow each test to directly control how many backends and balancers
are started and the client load reporting interval, so that (a) we don't
waste resources starting servers we don't need and (b) there is no need
to arbitrarily split tests across different test classes.
- Add timeouts to `WaitForAllBackends()` functionality, so that tests
will fail with a useful error rather than timing out.
- Improved ergonomics of various helper functions in the test framework.

In the process of making these changes, I found a couple of bugs:
- A bug in pick_first, which I fixed in #34885.
- A bug in grpclb, in which we were using the wrong condition to decide
whether to propagate a re-resolution request from the child policy,
which I've fixed in this PR. (This bug probably originated way back in
#18344.)

This should address a lot of the flakes seen in grpclb_e2e_test
recently.
2023-11-06 14:42:43 -08:00
nanahpang 3869ef09a5
[chaotic-good] Add chaotic good client transport read (roll-forward) (#34806)
Roll forward #34657, which was reverted in #34761.  

Previous error in CMake:
```
[ RUN      ] ClientTransportTest.AddOneStreamMultipleMessages
unknown file: Failure

Unexpected mock function call - returning directly.
    Function call: Call(CANCELLED: )
Google Mock tried the following 1 expectation, but it didn't match:

/[var/local/git/grpc/test/core/transport/chaotic_good/client_transport_test.cc:484](https://cs.corp.google.com/piper///depot/google3/var/local/git/grpc/test/core/transport/chaotic_good/client_transport_test.cc?l=484): EXPECT_CALL(on_done, Call(absl::OkStatus()))...
  Expected arg #0: is equal to OK
           Actual: CANCELLED: 
         Expected: to be called once
           Actual: never called - unsatisfied and active

/[var/local/git/grpc/test/core/transport/chaotic_good/client_transport_test.cc:484](https://cs.corp.google.com/piper///depot/google3/var/local/git/grpc/test/core/transport/chaotic_good/client_transport_test.cc?l=484): Failure
Actual function call count doesn't match EXPECT_CALL(on_done, Call(absl::OkStatus()))...
         Expected: to be called once
           Actual: never called - unsatisfied and active

real 0.24
user 0.00
sys 0.00

2023-10-20 01:50:32,776 FAILED: cmake/build/client_transport_test --gtest_filter=ClientTransportTest.AddOneStreamMultipleMessages  GRPC_POLL_STRATEGY=epoll1 [ret=139, pid=1663532, time=0.3sec]
```
<!--

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.

-->
2023-11-06 12:24:06 -08:00
Luwei Ge 1dbbdb5820
[TSI] not configure SNI if it looks like an IP address (#34878)
IP addressed are not allowed as host names. So we want to ignore the
given server_name_indication when it looks like an IP.
2023-11-06 12:22:24 -08:00
Mark D. Roth 1324ce42ea
[pick_first] fix race condition for detecting idleness (#34885)
This fixes a bug accidentally introduced in #33753. The symptom is that
if we exit idle and then get a new address list before any of the
subchannels in the old list can report their initial connectivity state,
we will incorrectly ignore the new address list.
2023-11-06 10:05:16 -08:00
Craig Tiller 78825f79ca
[event-engine] Fix channelz tests to hermetically clean up callbacks (#34883)
EventEngine experiments, especially with `work_serializer_dispatch` tend
to cause callbacks to occur later than we've previously seen, so tests
that verify global data structures tend to become flakier when these are
introduced.

Here, the fix is waiting for EventEngine to be closed before starting
the new test.

Whilst here, make some adjustments to the test for better readability on
what's going on:
- if we fail a request to an echo service, we do not actually expect the
messages to match, so don't report that
- if we expect a value of 1 or 2, AnyOf is a better tool: it will report
the actual value too

---------

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2023-11-06 07:00:04 -08:00
Craig Tiller ffa5728e9d
[clang-format] spam cleanup (#34881)
Eliminate spam from clang-format script.
Also add a shuffle to the file list - saves about a second of runtime on
my machine by making sure clusters of hard files are distributed evenly
amongst CPUs.
2023-11-06 06:59:36 -08:00
Luwei Ge eaa72802a0
[security] Support a list of SSL ECs (#34867)
Addresses #23235
2023-11-03 14:17:28 -07:00
Gregory Cooke 0d4e1ef5df
[Security - Revocation] Crl Directory Watcher Implementation (#34749)
This adds the directory reloader implementation of the CrlProvider. This
will periodically reload CRL files in a directory per [gRFC
A69](https://github.com/grpc/proposal/pull/382)

Included in this is the following:
* A public API to create the `DirectoryReloaderCrlProvider`
* A basic directory interface in gprpp and platform specific impls for
getting the list of files in a directory (unfortunately prior C++17,
there is no std::filesystem, so we have to have platform specific impls)
* The implementation of `DirectoryReloaderCrlProvider` takes an
event_engine and a directory interface. This allows us to test using the
fuzzing event engine for time mocking, and to implement a test directory
interface so we avoid having to make temporary directories and files in
the tests. This is notably not in `include`, and the
`CreateDirectoryReloaderCrlProvider` is the only way to construct one
from the public API, so we don't expose the event engine and directory
details to the user.

---------

Co-authored-by: gtcooke94 <gtcooke94@users.noreply.github.com>
2023-11-03 20:48:05 +00:00
apolcyn 2e205d8fbf
[csharp] Attempt to fix download flakes in C# distrib tests (#34854)
Attempt to fix
https://source.cloud.google.com/results/invocations/46cb13f1-7532-4c37-af5d-40e013dafc4c/targets/%2F%2Ftools%2Fbazelify_tests%2Ftest:distribtest_csharp_linux_x64_ubuntu2204/log
flakes

Fix taken from https://github.com/dotnet/runtime/issues/27792
2023-11-03 13:18:14 -07:00
Matthew Stevenson 52f9e011f3
[tls] Allow skipping server cert verification when no default roots are present. (#34859)
This PR fixes a bug identified in #29667, where the TLS channel
credentials still require a trust bundle even if the user has explicitly
opted to not verify the server certificate. This PR is based on #29810.
2023-11-03 10:23:10 -07:00
Gregory Cooke 0b1e381d56
[Security] Fix bug for layered composite creds (#34860)
Address https://github.com/grpc/grpc/issues/12554

The API for `duplicate_without_call_credentials` says 
```
// Creates a version of the channel credentials without any attached call
// credentials. This can be used in order to open a channel to a non-trusted
// gRPC load balancer.
```

As the impl stands right now, because of that description, in the case
of layered composite creds, I think the right behavior would be to call
down until you get the base cred with no call cred.

In discussing with the team, we do wonder if the use-case of layered
composite creds is really something that should be a feature, or if we
should be checking during the creation of composite creds to make sure
we aren't layering composite creds? @markdroth can you give your
thoughts?
2023-11-03 10:34:18 -04:00
Craig Tiller edfb0387d6
[metadata] Don't ref entire read for unknown metadata added to hpack table (#34863) 2023-11-02 16:42:57 -07:00
AJ Heller b94e1ecb4e
[build] Decrease clang_format CI verbosity (#34865) 2023-11-02 15:06:08 -07:00
Stanley Cheung ff2c0313e3
[PSM Interop] Add flag to enable CSM Observability in c++ image (#34866)
Roll forward of #34832, 3rd attempt. Will run a grpc import cherry-pick
to make sure the next import is going to be clean.
2023-11-02 14:59:16 -07:00
Stanley Cheung 9303b86010
Revert "[PSM Interop] Add flag to enable CSM Observability in c++ image" (#34858)
Reverts grpc/grpc#34840
2023-11-02 10:42:07 -07:00
Ben Beasley 4580cfdce3
[Python] Do not call PyEval_InitThreads (#34857)
Since Python 3.7, it’s called by
[`Py_Initialize`](https://docs.python.org/3/c-api/init.html#c.Py_Initialize)
and doesn’t need to be called manually, so this removal has no effect.

Since Python 3.9, it does nothing, and in [Python
3.13](https://docs.python.org/3.13/whatsnew/3.13.html), it [will be
removed](https://github.com/python/cpython/issues/105182), which makes
this change necessary.

References:

https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads

https://github.com/python/cpython/issues/105182

----

Together with the changes discussed in
https://github.com/grpc/grpc/issues/33918 and with a [Cython
fix](https://github.com/cython/cython/pull/5791) to be released in
3.0.5, this allowed us to build and test our `grpc` package with Python
3.13.0a1 and Cython 3.0.4.


<!--

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.

-->
2023-11-02 10:17:51 -07:00
Stanley Cheung a62c2607a6
[PSM Interop] Add flag to enable CSM Observability in c++ image (#34840)
Roll forward of #34832 (reverted in #34837).

Need #34836 to be  merged first.
2023-11-01 18:52:57 -07:00
AJ Heller 64207f8b08
[EventEngine] Enable EventEngine Listener experiment for Posix builds (#34851)
Previously disabled due to

* a problem in the core/end2end http_proxy_fixture (fixed in
https://github.com/grpc/grpc/pull/34838)
* a race with the EventEngine in the bad_server_response test (fixed in
https://github.com/grpc/grpc/pull/34816)
2023-11-01 14:37:22 -07:00
AJ Heller a0ad04d41c
[build] Exclude experiments from RBE Build Tests PR job (#34852)
This only affects pull requests for the `Bazel RBE Build Tests` job. The
equivalent master CI job will still build all end2end tests, including
experiments.
2023-11-01 14:21:47 -07:00
AJ Heller 1566fa42f4
[build] Exclude end2end experiment variations from distribtests (#34850) 2023-11-01 13:53:20 -07:00
AJ Heller c85cdfe656
[test] Fix http_proxy end2end test fixture (#34838)
Built upon @Vignesh2208 's work in #33156

This adds ref counting to the http_proxy fixture object, fixing test
flakes identified by the introduction of EventEngine listeners. Proxy
objects were either being deleted twice, or sometimes not at all,
resulting in two different sorts of flakes.
2023-11-01 12:13:28 -07:00
Mark D. Roth 15037d7c4a
[experiments] extend expiration for dualstack experiments (#34846) 2023-11-01 11:58:52 -07:00
AJ Heller 0c58f1551c
[build] Speed up the strict_build CI job (#34841)
The `bazel_build_with_strict_warnings_linux` job was taking nearly an
hour to complete. This change brings it down to ~20m by splitting up the
build targets into 7 separate RBE actions.

---------

Co-authored-by: drfloob <drfloob@users.noreply.github.com>
2023-11-01 10:06:01 -07:00
AJ Heller 50b654894a
[build] Speed up clang_format (#34839)
This reduces clang-format duration to under 10s on my 128 core machine.
Previously I stopped the process at 10 minutes. Major changes:

Eliminates 18,000 files
```
find ... \
    -and -not -path '*/cmake/build/*' \
    -and -not -path '*/huffman_geometries/*' \
```

Also, this now runs `$CPU_COUNT` number of parallel clang-format
processes with a roughly equal number of files. Previously, this script
was formatting one file at a time in separate processes (`xargs -n 1`).
2023-11-01 09:10:29 -07:00
Stanley Cheung fb5a3fad57
[PSM Interop] Exclude PSM interop test target from being built by cmake (#34836)
We added the `:grpcpp_csm_observability` dependency to the
`test/cpp/interop:xds_interop_<client|server>` target in
https://github.com/grpc/grpc/pull/34832, but those targets cannot be
built by cmake.

Cmake error:
https://source.cloud.google.com/results/invocations/5e30e5f6-684b-4103-b831-b154cb9ad712/targets/%2F%2Ftools%2Fbazelify_tests%2Ftest:runtests_cpp_linux_dbg_build_only/log

So we are trying to see if we can exclude those 2 targets from being
built by cmake
2023-10-31 20:16:17 -07:00
Vignesh Babu c4b9a9a8fc
Revert "[PSM Interop] Add flag to enable CSM Observability in c++ image" (#34837)
Reverts grpc/grpc#34832. Broke import
2023-10-31 18:27:29 -07:00
Roman-Byshliaha-Bose e256508e4b
[CMake] Link with librt only when platform toolchain has it (#34255)
Not all POSIX platforms have rt as a separate library. QNX has rt as
part of libc (same as pthreads).
Add condition to check if the library can be found and link with it only
in positive scenario.

A solution for: https://github.com/grpc/grpc/issues/34254
2023-10-31 16:09:58 -07:00