Commit Graph

733 Commits

Author SHA1 Message Date
Craig Tiller d1cb0c0874 [chaotic-good] Bring up core e2e tests (#35663)
Closes #35663

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35663 from ctiller:shush-e2e 0c1f82ed71
PiperOrigin-RevId: 605717663
2024-02-09 13:34:46 -08:00
Mark D. Roth 10e83973e7 [reorg] move resolver code to src/core/resolver (#35804)
This new directory combines code from the following locations:
- src/core/ext/filters/client_channel/resolver
- src/core/lib/resolver

Closes #35804

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35804 from markdroth:client_channel_resolver_reorg2 30660e6b00
PiperOrigin-RevId: 604665835
2024-02-06 09:07:56 -08:00
AJ Heller 71fa68f7fb [EventEngine] Add QueryExtension Interfaces for *SupportsFd (#35648)
This PR:
* adds FD extensions to the public headers
* Adds the query extension interface to EventEngine, Listener, and Endpoint, via a new `Extensible` interface
* Refactors the PosixEventEngine to use the Extensible interface.

Closes #35648

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35648 from drfloob:posix-ee-query-interface 7cae28e0b3
PiperOrigin-RevId: 601794970
2024-01-26 10:03:18 -08:00
Craig Tiller 19ad49d169 [bazel] disable fuzzer on mac (#35662)
Closes #35662

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35662 from ctiller:nononono 4f7d2fb893
PiperOrigin-RevId: 601448944
2024-01-25 08:03:46 -08:00
Craig Tiller 870a66d9a0 [chaotic-good] Connection setup & test suites (#35650)
Closes #35650

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35650 from ctiller:shush-tsan fd55ea1be3
PiperOrigin-RevId: 601221780
2024-01-24 13:46:08 -08:00
Craig Tiller 6b6ce36f74 [fuzzing] Allow server fuzzer to take multiple connection requests at the same time (#35645)
Closes #35645

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35645 from ctiller:shush-multipass e63e1e5ddb
PiperOrigin-RevId: 600998039
2024-01-23 21:19:49 -08:00
Craig Tiller 7507e3b644 [fuzzing] Teach server_fuzzer about the chaotic good protocol (#35643)
No explicit testing yet, just some building blocks

Closes #35643

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35643 from ctiller:shush-chaotic-protocol 48dcaa0632
PiperOrigin-RevId: 600928555
2024-01-23 15:43:34 -08:00
Craig Tiller 19f1b39829 [fuzzer] Eliminate use of mock_endpoint in server fuzzer (#35625)
Instead, connect a real client, which gives us the ability to exercise the listener portion of the code too.

Closes #35625

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35625 from ctiller:shush-connect b8f78993c6
PiperOrigin-RevId: 600836565
2024-01-23 10:40:03 -08:00
Craig Tiller e93f2dfbef [fuzzer] Separate scheduling from schedule creation for network input (#35618)
Closes #35618

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35618 from ctiller:shush ed7afaa4e8
PiperOrigin-RevId: 600557159
2024-01-22 13:43:52 -08:00
Craig Tiller 02c10df298 [api-fuzzer] Fix inproc channels (#35538)
Closes #35538

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35538 from ctiller:fff2 52b69968a0
PiperOrigin-RevId: 597848114
2024-01-12 08:43:34 -08:00
Mark D. Roth 0df505d9db [api_fuzzer] Cap the number of comma-delimited strings in the target URI to 1K.
PiperOrigin-RevId: 596739224
2024-01-08 16:54:43 -08:00
Craig Tiller 03403724f5 [fuzzing] Add ability for api-fuzzer to create inproc channels (#35277)
Closes #35277

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35277 from ctiller:inproc-fuzzing 853c11f144
PiperOrigin-RevId: 590420030
2023-12-12 19:55:27 -08:00
Craig Tiller a7e90045db [promises] Fix fuzzer found uncancelable call bug in client promise code (#34909)
Closes #34909

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/34909 from ctiller:lambda-mcfly 92f759d763
PiperOrigin-RevId: 589989462
2023-12-11 16:35:55 -08:00
Craig Tiller 2b1d06f037 [fuzzing] Add ability to listen to ports to api-fuzzer (#35273)
Unsure when this got dropped!

Closes #35273

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35273 from ctiller:server-port be94e30a06
PiperOrigin-RevId: 589919718
2023-12-11 13:04:19 -08:00
Craig Tiller f4219440c6
[server] Fix fuzzing detected memory leak (#34908) 2023-11-09 10:07:45 -08:00
Craig Tiller b7b75fca3f
[server-fuzzer] Fix behavior on failed transport creation (#34827) 2023-10-30 13:56:58 -07:00
Craig Tiller c2f49c2d3b
[promises] Fix some behaviors exposed by api_fuzzer (#34795)
1. we shouldn't spawn multiple promises to deal with cancellations (one
is enough)
2. lame_client needs to express that it will never read a message
2023-10-29 09:54:07 -07:00
Craig Tiller 888a7e87cc
[fuzzing] Fix msan error in fuzzer (#34783) 2023-10-24 09:41:17 -07:00
Craig Tiller 7c8b371955
[fuzzing] Fix fuzzer found bugs in promise based filter (#34723) 2023-10-19 10:10:33 -07:00
Craig Tiller 3f7d651922
[fuzzing] Fix fuzzer found bugs in client promise call (#34724) 2023-10-19 10:10:22 -07:00
Craig Tiller a0c1027bb3
[transport] Move transport interface to C++ (#34618)
Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2023-10-18 13:13:23 -07:00
Craig Tiller b6dbfc9163
[promises] Handle double scheduling of GRPC_OP_RECV_STATUS_ON_CLIENT (#34680) 2023-10-17 16:43:26 -07:00
Craig Tiller a54c7f7266
[fuzzing] Fix a case whereby a call can become permanently stuck after deadline expiry (#34681)
Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2023-10-13 09:13:13 -07:00
Craig Tiller eb9e57a03c
[fuzzing] Fix api-fuzzer found bug in ClientPromiseBasedCall (#34655)
A little debatable if it's a bug in the fuzzer or the call, but erring
on the side of compatibility (and we'll fix when we drop the batch api).
2023-10-12 16:49:08 -07:00
Yijie Ma bae0c705aa
[Deps] Update to Clang-16 (#34492)
<!--

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-10-11 16:26:32 -07:00
Craig Tiller 394659a849
[fuzzing] Fix build error (#34646) 2023-10-10 11:37:49 -07:00
Eugene Ostroukhov c4a35a28fd
[fuzzers] Fix warnings (#34630) 2023-10-09 13:27:10 -07:00
Craig Tiller c744f33790
[fuzzer] Add api fuzzing capabilities to client & server fuzzer (#34609)
Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2023-10-09 11:27:20 -07:00
Craig Tiller d0a4347419
[build] Fix compile error (#34613) 2023-10-06 08:23:10 -07:00
Craig Tiller 8391f19a22
[api-fuzzer] Move most of the functionality down into BasicFuzzer (#34605)
Prep to leverage this work in server_fuzzer, client_fuzzer
2023-10-05 16:52:35 -07:00
Craig Tiller 0814055337
[fuzzers] Expand client_fuzzer, server_fuzzer (#34596)
Allow multiple writes, and allow those writes to know about http2
(leverages the new framing layer for chttp2 recently written)
2023-10-05 15:22:39 -07:00
Craig Tiller 8eeb71cf82
[api-fuzzer] fix flipped conditional (#34604)
We've been inadvertently not creating channels with API fuzzer for a bit
2023-10-05 14:59:13 -07:00
Yash Tibrewal df1976b590
[server_fuzzer] Fix call details and metadata destruction point (#34579)
Fixes b/302517571
2023-10-02 19:14:33 -07:00
Mark D. Roth 7a06614f95
[resolver and LB policy APIs] reland: change address list to support multiple addresses per endpoint (#34531)
Re-land #33567, which was reverted in #34527.

First commit is a pure revert, second commit is a small fix needed to
avoid breaking internal callers.
2023-09-28 15:40:05 -07:00
Mark D. Roth 41f26de3b6
Revert "[resolver and LB policy APIs] change address list to support multiple addresses per endpoint" (#34527)
Reverts grpc/grpc#33567 due to import problems.
2023-09-28 12:15:35 -07:00
Mark D. Roth fd2e8c9462
[resolver and LB policy APIs] change address list to support multiple addresses per endpoint (#33567)
More changes as part of the dualstack design:
- Change resolver and LB policy APIs to support multiple addresses per
endpoint. Specifically, replace `ServerAddress` with
`EndpointAddresses`, which encodes more than one address. Per-address
channel args are retained at the same level, so they are now
per-endpoint. For now, `EndpointAddress` provides a single-address ctor
and a single-address accessor for backward compatibility, so
`ServerAdress` is an alias for `EndpointAddresses`; eventually, this
alias and the single-address methods will be removed.
- Add an `EndpointAddressSet` class, which represents an unordered set
of addresses to be used as a map key. This will be used in a number of
LB policies that need to store per-endpoint state.
- Change the LB policy API's `ChannelControlHelper::CreateSubchannel()`
method to take the address and per-endpoint channel args as separate
parameters, so that we don't need to construct a legacy `ServerAddress`
object as we create a new subchannel for each address in the endpoint.
- Change pick_first to flatten the address list.
- Change ring_hash to use `EndpointAddressSet` as the key for its
endpoint map, and to use the first address of the endpoint as the hash
key.
- Change WRR to use `EndpointAddressSet` as the key for its endpoint
weight map.

Note that support for multiple addresses per endpoint is guarded in RR
by the existing `round_robin_delegate_to_pick_fist` experiment and in
WRR by the existing `wrr_delegate_to_pick_first` experiment.

This PR does *not* include support for multiple addresses per endpoint
for the outlier_detection or xds_override_host LB policies; those will
come in subsequent PRs.
2023-09-28 09:32:36 -07:00
AJ Heller 3707b42bec
[reland][EventEngine] Move combiner executor usage to EventEngine (#34396)
Relands #31713
2023-09-19 14:41:17 -07:00
Craig Tiller 3717ff04ba
[chttp2] Split ping policy from transport (#33703)
Why: Cleanup for chttp2_transport ahead of promise conversion - lots of
logic has become interleaved throughout chttp2, so some effort to
isolate logic out is warranted ahead of that conversion.

What: Split configuration and policy tracking for each of ping rate
throttling and abuse detection into their own modules. Add tests for
them.

Incidentally: Split channel args into their own header so that we can
split the policy stuff into separate build targets.

---------

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2023-07-26 09:19:35 -07:00
Sergii Tkachenko de6ed9ba9f
[Python] Migrate from yapf to black (#33138)
- Switched  from yapf to black
- Reconfigure isort for black
- Resolve black/pylint idiosyncrasies 

Note: I used `--experimental-string-processing` because black was
producing "implicit string concatenation", similar to what described
here: https://github.com/psf/black/issues/1837. While currently this
feature is experimental, it will be enabled by default:
https://github.com/psf/black/issues/2188. After running black with the
new string processing so that the generated code merges these `"hello" "
world"` strings concatenations, then I removed
`--experimental-string-processing` for stability, and regenerated the
code again.

To the reviewer: don't even try to open "Files Changed" tab 😄 It's
better to review commit-by-commit, and ignore `run black and isort`.
2023-06-09 15:08:55 -07:00
AJ Heller 4fde5dabf6
[fuzzing] Extract and modernize ChannelArgs fuzzer configuration (#33161)
ChannelArgs fuzz configuration is expected to be used in other fuzzing
targets as well. This PR extracts the common code from the API fuzzer
and converts to use the C++ types.
2023-05-19 10:50:38 -07:00
Craig Tiller 239d3e6857
[fuzzing] Allow core_end2end_test_fuzzer, api_fuzzer to change experiments (#33147)
They were intended to be able to, but since these are currently frozen
across the process it wasn't possible.

Fix that for these fuzzers.
2023-05-16 12:47:55 -07:00
Craig Tiller cd44a2433e
[call] Dont take grpclb_client_stats from the app (#33118)
This metadata doesn't actually encode so passing it through from an app
will force a crash.
<!--

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-05-15 17:16:55 -07:00
Vignesh Babu 915d7c4a70
[Fuzzing] Bound RunAfter duration in fuzzing event engine (#33128)
Bounds duration to 1 year. Fixes b/258949216
2023-05-15 17:12:14 -07:00
Craig Tiller 997af8d073
[api_fuzzer] Attempt to clean up fuzzer memory leak (#33120)
<!--

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-05-15 13:25:08 -07:00
Craig Tiller 66d9f52fbd
[api-fuzzer] Fix memory leak (#33109)
ApiFuzzer::CreateChannel() called twice creates two channels but doesn't
delete the first.
Choose some reasonable behavior.
2023-05-15 11:16:35 -07:00
Craig Tiller 123811399b
[promises] Remove bad log statement (#33113)
Was leading to a nullptr deref, and we just don't need this one anymore.

<!--

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-05-15 10:32:05 -07:00
Craig Tiller 4674f2ccf7
[fuzz] Turn core end2end tests into fuzzers (#33013)
Add a new binary that runs all core end2end tests in fuzzing mode.

In this mode FuzzingEventEngine is substituted for the default event
engine. This means that time is simulated, as is IO. The FEE gets
control of callback delays also.

In our tests the `Step()` function becomes, instead of a single call to
`completion_queue_next`, a series of calls to that function and
`FuzzingEventEngine::Tick`, driving forward the event loop until
progress can be made.

PR guide:
---

**New binaries**
`core_end2end_test_fuzzer` - the new fuzzer itself
`seed_end2end_corpus` - a tool that produces an interesting seed corpus

**Config changes for safe fuzzing**
The implementation tries to use the config fuzzing work we've previously
deployed in api_fuzzer to fuzz across experiments. Since some
experiments are far too experimental to be safe in such fuzzing (and
this will always be the case):
- a new flag is added to experiments to opt-out of this fuzzing
- a new hook is added to the config system to allow variables to
re-write their inputs before setting them during the fuzz

**Event manager/IO changes**
Changes are made to the event engine shims so that tcp_server_posix can
run with a non-FD carrying EventEngine. These are in my mind a bit
clunky, but they work and they're in code that we expect to delete in
the medium term, so I think overall the approach is good.

**Changes to time**
A small tweak is made to fix a bug initializing time for fuzzers in
time.cc - we were previously failing to initialize
`g_process_epoch_cycles`

**Changes to `Crash`**
A version that prints to stdio is added so that we can reliably print a
crash from the fuzzer.

**Changes to CqVerifier**
Hooks are added to allow the top level loop to hook the verification
functions with a function that steps time between CQ polls.

**Changes to end2end fixtures**
State machinery moves from the fixture to the test infra, to keep the
customizations for fuzzing or not in one place. This means that fixtures
are now just client/server factories, which is overall nice.

It did necessitate moving some bespoke machinery into
h2_ssl_cert_test.cc - this file is beginning to be problematic in
borrowing parts but not all of the e2e test machinery. Some future PR
needs to solve this.

A cq arg is added to the Make functions since the cq is now owned by the
test and not the fixture.

**Changes to test registration**
`TEST_P` is replaced by `CORE_END2END_TEST` and our own test registry is
used as a first depot for test information.

The gtest version of these tests: queries that registry to manually
register tests with gtest. This ultimately changes the name of our tests
again (I think for the last time) - the new names are shorter and more
readable, so I don't count this as a regression.

The fuzzer version of these tests: constructs a database of fuzzable
tests that it can consult to look up a particular suite/test/config
combination specified by the fuzzer to fuzz against. This gives us a
single fuzzer that can test all 3k-ish fuzzing ready tests and cross
polinate configuration between them.

**Changes to test config**
The zero size registry stuff was causing some problems with the event
engine feature macros, so instead I've removed those and used GTEST_SKIP
in the problematic tests. I think that's the approach we move towards in
the future.

**Which tests are included**
Configs that are compatible - those that do not do fd manipulation
directly (these are incompatible with FuzzingEventEngine), and those
that do not join threads on their shutdown path (as these are
incompatible with our cq wait methodology). Each we can talk about in
the future - fd manipulation would be a significant expansion of
FuzzingEventEngine, and is probably not worth it, however many uses of
background threads now should probably evolve to be EventEngine::Run
calls in the future, and then would be trivially enabled in the fuzzers.

Some tests currently fail in the fuzzing environment, a
`SKIP_IF_FUZZING` macro is used for these few to disable them if in the
fuzzing environment. We'll burn these down in the future.

**Changes to fuzzing_event_engine**
Changes are made to time: an exponential sweep forward is used now -
this catches small time precision things early, but makes decade long
timers (we have them) able to be used right now. In the future we'll
just skip time forward to the next scheduled timer, but that approach
doesn't yet work due to legacy timer system interactions.

Changes to port assignment: we ensure that ports are legal numbers
before assigning them via `grpc_pick_port_or_die`.

A race condition between time checking and io is fixed.

---------

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2023-05-11 08:22:34 -07:00
Yijie Ma 1d10ca77ce
[Fuzzing] Migrate client and server_fuzzer to structured fuzzing (#32878)
- Added `fuzzer_input.proto` and `NetworkInput` proto message
- Migrated client_fuzzer and server_fuzzer to proto fuzzer
- Migrated the existing corpus and verified that the code coverage (e.g.
chttp2) stays the same

Probably need to cherrypick due to amount of files changed.

<!--

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-04-18 20:38:38 -07:00
Vignesh Babu a2c89d0b24
[fuzzing] Define a common fuzzing interface and move API fuzzer to it (#32853)
Requires cherrypick for grpc_fuzzer.bzl file.
2023-04-14 13:41:13 -07:00
Alisha Nanda 4e2f92bf9c
[metadata] Fix fuzzer bug with metadata arg. (#32787)
Bug: b/276525236.
2023-04-04 10:14:59 -07:00