Commit Graph

247 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
AJ Heller ba2f74a84c [EventEngine] Dump all thread stacks when the thread pool is wedged
This should help us debug rare flakes where the thread pool waits indefinitely

PiperOrigin-RevId: 601546451
2024-01-25 13:25:36 -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
Yijie Ma 5bf0971972 [EventEngine] Fix issues found when enabling `event_engine_dns` experiment in OSS (#35530)
Using `AF_UNSPEC` for both IPv4 and IPv6 queries does not work in all cases. Specifically, for `localhost:<>`, c-ares only returns the IPv6 record i.e. `::1`.

<!--

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 #35530

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35530 from yijiem:enable-oss-ee-dns-posix 452b5a2d81
PiperOrigin-RevId: 599989537
2024-01-19 18:42:26 -08:00
Mark D. Roth a3e24ed692 [FuzzingEventEngine] add time padding to avoid busy loops (#35447)
We encountered an api_fuzzer test case that adds a huge number of addresses that all immediately fail to connect, but it set max_backoff to 0, so there was a giant busy loop where pick_first was constantly trying to connect to subchannels with no delay.  The FuzzingEventEngine was getting stuck in a tick loop, always accumulating more tasks that needed to be executed immediately, so it could never make forward progress on the test case.

This PR fixes the problem by adding a fixed 1us delay if the task's delay is 0 and the test case has not provided any more fixed delays.

(Unfortunately, I cannot include the test case that triggered the problem in this PR, because it winds up exceeding the RBE stdout limit.)

Fixes b/310664846.

Closes #35447

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35447 from markdroth:api_fuzzer_busy_loop_fix 90055d3d92
PiperOrigin-RevId: 595853516
2024-01-04 18:28:32 -08:00
Yijie Ma 90cdff5a3c [EventEngine] Returns error instead of assertion when hostname is empty (#35306)
<!--

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 #35306

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35306 from yijiem:dns-empty-hostname 9c7f67c27a
PiperOrigin-RevId: 591028370
2023-12-14 13:03:55 -08:00
Yijie Ma 1abfc97502 [EventEngine] Posix NativeDNSResolver implementation (#35153)
<!--

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 #35153

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35153 from yijiem:native_dns_resolver a4107f7d81
PiperOrigin-RevId: 588543137
2023-12-06 14:25:38 -08:00
Vignesh Babu 84678829af [EventEngine] Add public methods to allow EventEngine Endpoints to support optional Extensions.
PiperOrigin-RevId: 587071965
2023-12-01 11:43:08 -08:00
AJ Heller be4d2a6d8b [core] Ensure ChannelArgs::SetObject only allows conforming shared_ptr<T> classes (#35008)
ChannelArgs shared_ptr only supports types that extend `enable_shared_from_this`. `args.SetObject<shared_ptr<X>>(x)` with a non-comforming type X will now fail with something like:

```
./src/core/lib/channel/channel_args.h:453:12: error: no matching member function for call to 'Set'
    return Set(ChannelArgNameTraits<T>::ChannelArgName(), std::move(p));
           ^~~
test/core/channel/channel_args_test.cc:352:32: note: in instantiation of function template specialization 'grpc_core::ChannelArgs::SetObject<X>' requested here
  grpc_core::ChannelArgs b = a.SetObject(x);
                               ^
..
```

Closes #35008

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35008 from drfloob:channel-args-cant-set-unsupported-shared-ptr-type dc93f27ac7
PiperOrigin-RevId: 586766674
2023-11-30 13:17:27 -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
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
AJ Heller 66d928c440
[EventEngine] Fix local work queueing logic with multiple pools (#34786)
This fixes a bug which could happen if multiple WorkStealingThreadPools
existed (wstpA and wstpB), and a thread in wstpA called
`wstpB->Run(closure)`. Previously, this would have scheduled the closure
on the current wstpA thread worker's local queue.

`bm_thread_pool` results look unchanged on RBE.
2023-10-24 17:27:45 -07:00
AJ Heller ffe6634163
[EventEngine] Lock-free fix for WinSocket/IOCP notification race (#34577)
This is a lock-free refactoring of
https://github.com/grpc/grpc/pull/34497.

---------

Co-authored-by: drfloob <drfloob@users.noreply.github.com>
2023-10-13 13:49:15 -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 ec49866463
[fuzzing] Fix timeout in retry_exceeds_buffer_size_in_delay (#34627)
Fix b/304114403

- adds a new experimental tracer useful for diagnosing ping timeout
failures in unit tests
- adds a pair of experimental tracers for fuzzing event engine
- fix the behavior of FuzzingEventEngine so that a RunAfter(0, ...) runs
in the same tick
- up the rate of sends (reduce the send delay) so we guarantee to be
able to send 200kb/sec in fuzzed e2e unit tests

---------

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2023-10-11 09:07:14 -07:00
Mark D. Roth be1cf357ba
[FuzzingEventEngine] fix TickForDuration() bug and add test (#34633)
The `TickForDuration()` method was using `grpc_core::Timestamp::Now()`
to get the current time, but that was not in sync with the `now_` value
inside the Fuzzing EE itself, with the result that after two subsequent
250ms increments, timers were not being properly fired. I've added a
test that demonstrates this failure without the fix.
2023-10-11 08:25:57 -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
Hannah Shi e5d41f2a1f
[ObjC] cf event engine supports resolve recursively from on_resolve callback (#34385)
If the client calls LookupHostname again within the on_resolve callback,
it re-acquires the `request_mu_` before releasing it which results in
deadlock.

With this PR it extracts the request and releases the lock before
calling on_resolve callback so it won't deadlock any more.
2023-09-21 21:58:53 -07:00
Craig Tiller 86b931c354
[work-serializer] Dispatch on run experiment (relanding) (#34372)
Reverts grpc/grpc#34371
2023-09-15 12:46:04 -07:00
AJ Heller 2467562e4b
[EventEngine] Delete OriginalThreadPool, remove work_stealing experiment (#34315)
This has been stable for a bit, everywhere that the EventEngine is
enabled. Going forward, I think the event_engine_{client|listener}
experiments can probably be used to regulate thread-pool-specific
issues.

---------

Co-authored-by: drfloob <drfloob@users.noreply.github.com>
2023-09-15 10:28:11 -07:00
Craig Tiller d589caa679
Revert "[work-serializer] Dispatch on run experiment" (#34371)
Reverts grpc/grpc#34274

(needs some changes internally)
2023-09-15 09:10:31 -07:00
Craig Tiller 1705470950
[work-serializer] Dispatch on run experiment (#34274)
Co-authored-by: ctiller <ctiller@users.noreply.github.com>
Co-authored-by: Mark D. Roth <roth@google.com>
2023-09-15 07:49:42 -07:00
Craig Tiller 3e3c828f91
[fuzzing] Add TickUntil variants to FuzzingEventEngine (#34308)
Sometimes we just want to wait until a specific time
2023-09-11 13:04:02 -07:00
AJ Heller 108af0a94f
[EventEngine] Improve lock contention in WorkStealingThreadPool (alternative) (#34065)
Proposed alternative to https://github.com/grpc/grpc/pull/34024.

This version has a simpler, faster busy-count implementation based on a
sharded set of atomic counts: fast increment/decrement operations,
relatively slower summation of total counts (which need to happen much
less frequently).
2023-08-17 17:00:02 -07:00
Yousuk Seung 48aa2ff1e5
[fix] don't leak when a range times out unacked (#34064)
<!--

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-08-15 19:04:05 -07:00
Mario Jones Vimal 1c0f5d32a0
[core/gpr] Move subprocess to gpr and add subprocess creation using execve (#33983)
Move subprocess util to gpr.
Add support for communication with the subprocess.
This is required to support authentication using an executable.
2023-08-07 12:53:00 -07:00
Hannah Shi 239a5fce2d
[ObjC] dns service resolver for cf event engine (#33971)
re-submit of #33233 with refactored tests

1. split ios event engine tests to client tests (require oracle engine)
and unit test
2. disable dns server setup in
[dns_test.cc](https://github.com/grpc/grpc/blob/master/test/core/event_engine/test_suite/tests/dns_test.cc#L127)
for ios test, this is what's caused the revert.
3. disable dns_test in cf_event_engine_test for MacOS
2023-08-04 15:51:42 -07:00
Craig Tiller 5325b65d84
Revert "[core/gpr] move subprocess to gpr" (#33972)
Reverts grpc/grpc#33870 - since it breaks memory usage tooling.
2023-08-02 20:40:12 -07:00
Mario Jones Vimal f10a8e3418
[core/gpr] move subprocess to gpr (#33870)
Move subprocess util to gpr.
Add support for communication with the subprocess.
This is required to support authentication using an executable.
2023-08-02 13:19:08 -07:00
AJ Heller 48f455a9a0
Revert "[ObjC] dns service resolver for cf event engine" (#33964)
Reverts grpc/grpc#33233. This is failing 100% of builds
https://source.cloud.google.com/results/invocations/248656d3-15ac-4d42-a2f8-6bec5c411e67/targets
2023-08-02 10:08:06 -07:00
Hannah Shi cd85d7edf2
[ObjC] dns service resolver for cf event engine (#33233)
Implement DNS using dns service for iOS.

Current limitation:
1. Using a custom name server is not supported.
2. Only supports `LookupHostname`. `LookupSRV` and `LookupTXT` are not
implemented.
3. Not tested with single stack (ipv4 or ipv6) environment
4. ~Not tested with multiple ip records per stack~ manually tested with
wsj.com
5. Not tested with multiple interface environment
2023-08-01 08:49:05 -07:00
Yijie Ma 7524e899d1
Revert "[CI breakage] Skip some dns tests as a temporary workaround" (#33882)
Reverts grpc/grpc#33819

Verified that it passed these jobs:
`grpc/core/master/linux/grpc_basictests_c_cpp_dbg`
`grpc/core/master/linux/grpc_basictests_c_cpp_opt`
`grpc/core/master/linux/grpc_portability`
2023-07-26 15:06: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
Yijie Ma e74b7d8262
[CI breakage] Skip some dns tests as a temporary workaround (#33819)
Those tests are failing on CIs which do not have twisted installed. Skip
them for now and will fix the docker images next.


<!--

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-07-21 18:50:48 -07:00
Yijie Ma a7bf07e86a
[EventEngine] PosixEventEngine DNS Resolver (#32701)
This PR implements a c-ares based DNS resolver for EventEngine with the
reference from the original
[grpc_ares_wrapper.h](../blob/master/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h).
The PosixEventEngine DNSResolver is implemented on top of that. Tests
which use the client channel resolver API
([resolver.h](../blob/master/src/core/lib/resolver/resolver.h#L54)) are
ported, namely the
[resolver_component_test.cc](../blob/master/test/cpp/naming/resolver_component_test.cc)
and the
[cancel_ares_query_test.cc](../blob/master/test/cpp/naming/cancel_ares_query_test.cc).
The WindowsEventEngine DNSResolver will use the same EventEngine's
grpc_ares_wrapper and will be worked on next.

The
[resolve_address_test.cc](https://github.com/grpc/grpc/blob/master/test/core/iomgr/resolve_address_test.cc)
which uses the iomgr
[DNSResolver](../blob/master/src/core/lib/iomgr/resolve_address.h#L44)
API has been ported to EventEngine's dns_test.cc. That leaves only 2
tests which use iomgr's API, notably the
[dns_resolver_cooldown_test.cc](../blob/master/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc)
and the
[goaway_server_test.cc](../blob/master/test/core/end2end/goaway_server_test.cc)
which probably need to be restructured to use EventEngine DNSResolver
(for one thing they override the original grpc_ares_wrapper's free
functions). I will try to tackle these in the next step.
<!--

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-07-21 13:24:16 -07:00
AJ Heller 112421760a
[EventEngine] Eliminate busy loop in the work stealing lifeguard's shutdown (#33386)
Co-authored-by: drfloob <drfloob@users.noreply.github.com>
2023-07-21 09:25:47 -07:00
AJ Heller b33a0781fa
[build] Private visibility for internal EE library (#33764) 2023-07-20 09:22:33 -07:00
Yijie Ma 73605f4eac
[EventEngine] Change `GetDNSResolver` to return `absl::StatusOr<std::unique_ptr<DNSResolver>>` (#33744)
Based on the discussion at:
595a75cc5d..e3b402a8fa (r1244325752)


<!--

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-07-19 14:23:26 -07:00
AJ Heller eb5c4da829
[EventEngine] Only use fork handlers when enabled via an environment variable (#33582)
Co-authored-by: drfloob <drfloob@users.noreply.github.com>
2023-07-05 13:01:51 -07:00
Hannah Shi c6e4a60f8f
[ObjC] run cf event engine test suit on ios (#33534)
Run cf event engine test suit on ios

CC: @sampajano  @mikefan1991
2023-06-25 20:11:56 +00:00
Yijie Ma 6e95cebbd0
[EventEngine] Simplify `EventEngine::DNSResolver` API (#33459)
This change simplifies `EventEngine::DNSResolver`'s API based on the
proposal:
[go/event-engine-dns-resolver-api-changes](http://go/event-engine-dns-resolver-api-changes).
Note that this API change + the implementation described in
[go/event-engine-dns-resolver-implementation](http://go/event-engine-dns-resolver-implementation)
has already been tested against our main test suites and are passing
them.


<!--

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-06-22 12:19:20 -07:00
Craig Tiller d4be39a6ab
[fuzzing] Use a smaller max delay for writes than run-after (#33455)
We want writes to participate in event re-ordering, but it's unlikely
that we can sustain one byte per 500ms on all tests and keep them
passing (which is the degenerate case right now).

Tune write delays down to 50ms for the moment, though I expect we'll
want to talk about going lower.
2023-06-15 10:44:47 -07:00
Craig Tiller 2055cce132
[fuzzing] Fix bug on endpoint shutdown whereby we leave read requests dangling (#33406)
Fix fuzzer found bug b/286716972

Follows up on https://github.com/grpc/grpc/pull/33266 but gets the edge
case right of when there's a read queued before the peer closes - in
that case we weren't waking up the read.
2023-06-14 12:22:44 -07:00
Craig Tiller 14c63c70af
[fuzzing] Fix recursive mutex acquisition in fuzzing event engine (#33404)
Fixes internal fuzzing bug b/286717107
2023-06-12 16:31:35 +00:00
Yadong 18c42a21af
[core] Add support for vsock transport (#33309)
Revert "Revert "[core] Add support for vsock transport"
(https://github.com/grpc/grpc/pull/33276)"
This reverts commit
c5ade3011a.

And fix the issue which broke the python build.

@markdroth @drfloob please review this PR. Thank you very much.

---------

Co-authored-by: AJ Heller <hork@google.com>
2023-06-07 13:55:53 -07:00
Craig Tiller 72da46fa5c
[fuzzing] Handle closing after the final write in fuzzing-event-engine (#33266)
If an endpoint closes it should still report any pending writes.
2023-06-05 12:00:32 -07:00
AJ Heller 87afec2696
[Reland][EventEngine] Make the thread pool quiesce 10x faster, and add a small stress test" (#33316) (#33317) 2023-06-01 13:20:57 -07:00
AJ Heller 925ff588a3
Revert "[EventEngine] Make the thread pool quiesce 10x faster, and add a small stress test" (#33316)
Reverts grpc/grpc#33223. Breaks internal build.

```
work_stealing_thread_pool.cc:180:27: error: format specifies type 'double' but the argument has type 'gpr_cycle_counter' (aka 'long') [-Werror,-Wformat]
```
2023-06-01 11:28:21 -07:00