Commit Graph

7927 Commits

Author SHA1 Message Date
Matthew Stevenson 99b0e54877
[ssl] Disable slow SSL transport security tests for UBSAN builds. (#33824)
This PR is expected to fix the flakes of
`//test/core/tsi:ssl_transport_security_test` when built under UBSAN.

Why is this needed? There are several tests in
`ssl_transport_security_test.cc` that involve doing many expensive
operations and PR #33638 recently added one more (namely, repeatedly
signing with an ECDSA key). The slow tests are already altered for MSAN
and TSAN, and now we need to do the same for UBSAN.
2023-07-24 10:44:00 -07:00
Vignesh Babu f4f3a907f3
[import] Fix missing dependency in experiments_tag_test (#33827) 2023-07-24 10:26:45 -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
Vignesh Babu f85b7c79ee
[experiments] Fix processing of platform specific test tags (#33749)
Also adds a unit test: experiments_tag_test which should fail if the
appropriate tags are not set for it.
2023-07-21 16:06:01 -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 0155478ae7
[test] Increase timeout for ssl_transport_security_test (#33789)
This test appears to be timing out more often lately. 

Example:
https://fusion2.corp.google.com/ci/kokoro/prod:grpc%2Fcore%2Fpull_request%2Flinux%2Fbazel_rbe%2Fgrpc_bazel_rbe_ubsan/activity/980ac4a8-da71-4b9b-838e-e9ea235820a1/log
2023-07-20 10:51:23 -07:00
Craig Tiller 5b46c8bdba
[fuzzing] Increase deadline, fix b/291630910 (#33768) 2023-07-20 10:29:11 -07:00
Craig Tiller 4c7107794d
[promises] Handle the case that a rejection happens without reporting to the app (#33782)
Promises code can prevent these bad requests from even reaching the
application, which is beneficial but this test needs a minor update to
handle it.

---------

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2023-07-20 10:03:50 -07:00
Craig Tiller 25ed074b0d
[bad_client] Increase timeout (saw this exceeded internally) (#33781)
Unblocks promises rollout
2023-07-20 10:00:27 -07:00
Craig Tiller e821494739
[test] Increase deadline after observed failure internally (#33778)
(needed to unblock promises rollout)
2023-07-20 10:00:00 -07:00
AJ Heller b33a0781fa
[build] Private visibility for internal EE library (#33764) 2023-07-20 09:22:33 -07:00
Craig Tiller 112a29c6af
[fuzzing] Increase deadline (#33765)
Fix b/290782226
2023-07-19 16:54:12 -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
Matthew Stevenson fae2982647
[ssl] Fix SSL stack to handle large handshake messages whose length exceeds the BIO buffer size. (#33638)
There is a bug in the SSL stack that was only partially fixed in #29176:
if more than 17kb is written to the BIO buffer, then everything over
17kb will be discarded, and the SSL handshake will fail with a bad
record mac error or hang if not enough bytes have arrived yet.

It's relatively uncommon to hit this bug, because the TLS handshake
messages need to be much larger than normal for you to have a chance of
hitting this bug. However, there was a separate bug in the SSL stack
(recently fixed in #33558) that causes the ServerHello produced by a
gRPC-C++ TLS server to grow linearly in size with the size of the trust
bundle; these 2 bugs combined to cause a large number of TLS handshake
failures for gRPC-C++ clients talking to gRPC-C++ servers when the
server had a large trust bundle.

This PR fixes the bug by ensuring that all bytes are successfully
written to the BIO buffer. An initial quick fix for this bug was planned
in #33611, but abandoned because we were worried about temporarily
doubling the memory footprint of all SSL channels.

The complexity in this PR is mostly in the test: it is fairly tricky to
force gRPC-C++'s SSL stack to generate a sufficiently large ServerHello
to trigger this bug.
2023-07-18 16:35:56 -07:00
Mark D. Roth 083bbee480
[LB policies] revert changes for dualstack design (#33718)
This reverts the following PRs: #32692 #33087 #33093 #33427 #33568

These changes seem to have introduced some flaky crashes. Reverting
while I investigate.
2023-07-14 15:59:42 -07:00
Craig Tiller e9ba954eef
[owners] Remove CODEOWNERS for ctiller where its no longer necessary (#33704) 2023-07-14 08:25:17 -07:00
Mark D. Roth ec39600872
[WRR] fix bugs that caused us to re-enter blackout period upon updates (#33694)
As per gRFC A58, when WRR sees a subchannel report READY, it reset the
non_empty_since value, thus restarting the blackout period. However,
there were two cases where we were incorrectly triggering this code:
1. When WRR got an updated address list that contained addresses that
were already present on the old list and whose subchannels were already
in READY state, the initial notification for those subchannels on the
new list was READY, which incorrectly triggered resetting the
non_empty_since value.
2. Due to a bug in the outlier_detection policy, whenever an update was
propagated down through the OD policy without actually enabling OD, it
would incorrectly send a duplicate connectivity state notification for
the subchannels. This meant that a subchannel that was already in state
READY would report READY again, which would also incorrectly trigger
resetting the non_empty_since value.

This PR makes two changes:
1. Fix the bug in outlier_detection that caused it to generate the
spurious duplicate READY updates.
2. Fix WRR to reset the non_empty_since value when a subchannel goes
READY only if the subchannel has seen a previous state update and only
if that previous state was not READY. (The duplicate READY notifications
should not actually happen anymore now that the OD policy has been
fixed, but better to be defensive.)

Fixes b/290983884.
2023-07-13 15:35:17 -07:00
Mario Jones Vimal a934848de5
[core/security] Add Custom Token Lifetime - Service Acc Impersonation (#33351)
Adds access token lifetime configuration for workload identity
federation with service account impersonation for both explicit and
implicit flows.

Changes: 
1. Adds a new member "service_account_impersonation" to the
ExternalAccountCredentials class. "token_lifetime_seconds" is a member
of "service_account_impersonation".
2. Adds validation checks, like token_lifetime_seconds should be between
the minimum and maximum accepted value, during the creation of an
ExternalAccountCredentials object.
3. Appends "lifetime" to the body of the service account impersonation
request.

Tests:
1. Modifies a test to check if the default value is passed when
"service_account_impersonation" is empty.
2. Adds tests to check if the token_lifetime_seconds value is propagated
to the request body.
3. Adds tests to verify that an error is thrown when
token_lifetime_seconds is invalid.
2023-07-13 11:42:26 -04:00
Craig Tiller 7223a9e5fe
[fuzzing] Increase deadline (#33663)
Fix b/290886936
2023-07-12 10:31:39 -07:00
Craig Tiller 86d7c8125e
[fuzzing] Increase deadline (#33658)
Resolves b/290812157
2023-07-11 15:41:37 -07:00
Craig Tiller 8845e290db
[filter-test] Enhancements for better testing (#33652)
- Support call finalizers in filter test.
- Add an accessor to the filter implementation from the channel, so that
it can be interrogated by tests.
- Matcher to ensure that some metadata is *not* in a metadata batch

(functionality needed to support the additional testing we talked about
this morning)

---------

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2023-07-11 15:27:27 -07:00
Craig Tiller b7077f4bbf
[hpack] Rollforward huffman read optimization (#33657)
Rollforward in first commit, fixes in subsequent.
2023-07-11 15:26:54 -07:00
Craig Tiller 57c697d8ae
Revert "[hpack] Huffman read optimization" (#33655)
Reverts grpc/grpc#33269
2023-07-11 12:58:49 -07:00
Craig Tiller 4ce51fe45d
[hpack] Huffman read optimization (#33269)
In real services most of our time ends up in the `Read1()` function,
which populates one byte into the bit buffer.
Change this to read in as many as possible bytes at a time into that
buffer.

Additionally, generate all possible (to some depth) parser geometries,
and add a benchmark for them. Run that benchmark and select the best
geometry for decoding base64 strings (since this is the main use-case).

(gives about a 30% speed boost parsing base64 then huffman encoded
random binary strings)

---------

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2023-07-11 08:41:15 -07:00
Vignesh Babu 974798a427
[tracing] Fix flakiness in tcp_posix_test (#33639)
tcp_posix_test is incorrectly assuming that all endpoint_writes with
timestamps enabled will be successfully traced. Remove the timestamps
checking related tests to prevent flakes when the test is enabled
internally.
2023-07-10 12:59:57 -07:00
Craig Tiller ed587f2b07
[hpack] Reduce parse table size in the rare case of a parse error (#33637)
Most of the time parsing succeeds, and only rarely do we see an error.

This change reduces the parse memento size from 120 bytes to 56 bytes.

---------

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2023-07-10 11:21:51 -07:00
Craig Tiller dc5c99c9b4
[fuzzing] Increase deadline (#33600)
Similar pattern to many others.. increase this deadline to have the
fuzzer pass.

---------

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2023-07-07 12:39:55 -07:00
Craig Tiller d3d4d5309d
[end2end] Fix fuzzer found deadline bug (#33633)
fix b/290140776
2023-07-07 09:43:35 -07:00
Craig Tiller cdfbb0ced7
[end2end] Fix fuzzer found deadline bug (#33629)
Fixes b/288888511
2023-07-07 09:43:11 -07:00
Craig Tiller e28729fe0a
[end2end] Fix fuzzer found deadline bug (#33630)
fix b/288965746
2023-07-07 09:42:48 -07:00
Craig Tiller f417da77a6
[end2end] Fix fuzzer found deadline bug (#33631)
fix b/288718007
2023-07-07 09:07:18 -07:00
Craig Tiller 4b7a360041
[end2end] Fix fuzzer found deadline bug (#33632)
fix b/289593034
2023-07-07 09:06:20 -07:00
nanahpang 0cc9d16e9c
[chaotic-good] Implement a promise-based endpoint for chaotic-good transport to read & write to EventEngine::Endpoint. (#33257)
This PR is continuing the work of prototyping in
https://github.com/grpc/grpc/pull/31592, and the design doc is at
[link](https://docs.google.com/document/d/1vRy0yse-d1heLQRmLPo_0figsTPXJAnNN84tBCAne_s/edit?pli=1&resourcekey=0-JvUPdq0LaZq8gMkgT9Pzlw#heading=h.qgvc5vr55ytg).

<!--

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-06 17:18:48 -07:00
Yash Tibrewal 9984f1bd5b
Revert "Revert "Revert "Revert "[HTTP2] Fix inconsistencies in keepalive configuration ( #33428)" (#33512)"" (#33601)
Reverts grpc/grpc#33599

Needs to be cherry-picked
2023-07-06 15:13:12 -07:00
Craig Tiller 08f1cc3ba8
[end2end] Explain failures a little better (#33621)
I'd been adding the following stanza regularly to debug flakes/fuzz
failures:

```
  Expect(1, CoreEnd2endTest::MaybePerformAction{[&](bool success) {
           Crash(absl::StrCat(
               "Unexpected completion of client side call: success=",
               success ? "true" : "false", " status=", server_status.ToString(),
               " initial_md=", server_initial_metadata.ToString()));
         }});
```

it was helpful because it indicated why a call batch finished
successfully and helped quickly identify next steps.

It occurred to me however that this would better be done inside of the
framework, and for *all* ops that have outputs, so this PR does just
that. Any time a batch with an op that outputs information finishes
successfully but unexpectedly we now display those outputs in human
readable form in the error message.

Sample output:
```
[ RUN      ] CorpusExamples/FuzzerCorpusTest.RunOneExample/0
RUN TEST: Http2SingleHopTest.SimpleDelayedRequestShort/Chttp2SimpleSslFullstack
E0101 00:00:05.000000000  396633 simple_delayed_request.cc:37]         Create client side call
E0101 00:00:05.000000000  396633 simple_delayed_request.cc:41]         Start initial batch
E0101 00:00:05.000000000  396633 simple_delayed_request.cc:47]         Start server
E0101 00:00:05.000000000  396633 cq_verifier.cc:364]                   Verify tag(101)- for 600000ms
test/core/end2end/cq_verifier.cc:316: Unexpected event: OP_COMPLETE: tag:0x1 OK
with:
  incoming_metadata: {}
  status_on_client: status=4 msg=Deadline Exceeded trailing_metadata={}
checked @ test/core/end2end/tests/simple_delayed_request.cc:51
expected:
  test/core/end2end/tests/simple_delayed_request.cc:50: tag(101) success=true
```
2023-07-06 14:31:13 -07:00
Craig Tiller d139c4a014
[metadata] Add an experiment to ensure a unique refcount on parsed slice strings (#33205)
The intuition here is that these strings may end up in the hpack table,
and then unnecessarily extend the lifetime of the read blocks.

Instead, take a copy of these short strings when we need to and allow
the incoming large memory object to be discarded.

---------

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2023-07-05 20:57:03 -07:00
Craig Tiller c5bb43ab61
[chttp2] Eliminate grpc_chttp2_stream_map (#33503)
No need for a bespoke type anymore... and a step along the path to
C++ification.

---------

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
2023-07-05 15:07:31 -07:00
Yash Tibrewal c0889a4f23
[fuzz] Increase call timeout for retry_unref_before_recv (#33608)
Noticed this failing on an internal cl due to deadline exceeded errors.
<!--

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-05 14:38:32 -07:00
Craig Tiller 43f67d3640
[fuzzing] Allow hpack fuzzers to supply config (#33242)
<!--

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: ctiller <ctiller@users.noreply.github.com>
2023-07-05 14:20:47 -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
Vignesh Babu 63037989ca
[experiments] Add specification of different default values for different platforms. (#33543)
It introduces the following syntax:

The following would mark the experiment as broken on ios, false on
windows and debug on posix. If a platform is un-specified, the default
for that platform will be set to false. Refer to
test/core/experiments/fixtures/test_experiments_rollout.yaml for
examples which are tested.

- name: experiment_1
   default:
      &nbsp; ios: broken
      &nbsp; windows: false
      &nbsp; posix: debug
      
It also supports the already existing syntax and interprets it as just
specifying one default for all platforms.
    
Supported platform tags: ios, windows, posix
2023-07-05 10:36:37 -07:00
Esun Kim 415f2f9ee3
[Core] Improve HPACK (#33597) 2023-07-05 13:04:31 +09:00
Yash Tibrewal 523d9a2135
Revert "Revert "Revert "[HTTP2] Fix inconsistencies in keepalive configuration ( #33428)" (#33512)" (#33599)
Reverts grpc/grpc#33586

Looks like this has to be cherry-picked
2023-07-04 19:25:17 -07:00
Yash Tibrewal 8d9164fc16
Revert "Revert "[HTTP2] Fix inconsistencies in keepalive configuration ( #33428)" (#33512) (#33586)
Along with an experiment this time

<!--

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-30 16:27:30 -07:00
Bjorn Svensson ac874c2c83
[core] Add a channel argument to set DSCP on streams (#28322)
This adds a new channel argument `GRPC_ARG_DSCP` which allows users to
create classified gRPC streams with a
Differentiated Services Code Point (DSCP) marking on the IP frames.

The channel argument is handled on both clients and servers, but
currently only on posix based systems.

Fixes #17225

**Background**:
In addition to what is already described is #17225, when gRPC is used in
telco systems there is often a need to classify streams of importance.
There can be multiple hops between two endpoints (e.g. between 2 telecom
operators) and some streams that are more important than others (e.g.
emergency call related or similar). By marking the IP packets using DSCP
the aware routers can make a sound decision of the prioritization.

This PR propose to use DSCP as the configuration value since its common
for both IPv4/IPv6, an alternative would be to use a config name that
includes TOS and Traffic Class.
There might be more needed regarding documentation and end2end testing,
but there I need some advice.

**References**
https://datatracker.ietf.org/doc/html/rfc2474
https://www.iana.org/assignments/dscp-registry/dscp-registry.xhtml

<!--

Your pull request will be routed to the following person by default for
triaging.
If you know who should review your pull request, please remove the
mentioning below.

-->

@yashykt
2023-06-30 16:10:21 -07:00
Eugene Ostroukhov e0bc8a2c85
[xDS LB] xDS pick first support (#33540) 2023-06-30 14:06:08 -07:00
Mark D. Roth 15db5cd16a
[resolvers] use proper %-encoding of authority by default (#33571)
- Change the `ResolverFactory::GetDefaultAuthority()` method to %-encode
the authority by default, so individual resolver impls don't need to
remember to do this.
- Remove the hack in the xds resolver for setting the authority to
everything after the last `/` character.
- Change the `unix`, `unix-abstract`, and `vsock` resolvers to use a
real authority instead of hard-coding to "localhost".
2023-06-29 13:00:03 -07:00
Vignesh Babu bf3ffcf600
[experiments] A unit test for the experiments framework (#33334)
Adds a test for the experiments codegen. It updates the codegen to parse
test_experiments.yaml and test_experiments_rollouts.yaml files and
generate test_experiments.h and test_experiments.cc files along with an
experiments_test.cc file. The experiments test verifies the returned
value of IsExperimentEnabled with the expected value.
2023-06-29 12:21:11 -07:00
Matthew Stevenson 278978d6f0
[tls] Remove use of SSL_CTX_set_client_CA_list for TLS server credentials. (#33558)
This PR does the following: for the TLS server credentials, stops
calling `SSL_CTX_set_client_CA_list` by default in
`ssl_transport_security.cc`, and gives users a knob to re-enable calling
this API.

## What does the `SSL_CTX_set_client_CA_list` API do?

When this API is called, a gRPC TLS server sends the following data in
the ServerHello: for each certificate in the server's trust bundle, the
CA name in the certificate.

This API does not change the set of certificates trusted by the server
in any way. Rather, it is just providing a hint to the client about what
client certificate should be sent to the server.

## Why are we removing the use of `SSL_CTX_set_client_CA_list` by
default for the TLS server credentials?

Removing the use of this API by default has 2 benefits:
1. Calling this API makes gRPC TLS unusable for servers with a
sufficiently large trust bundle. Indeed, if the server trust bundle is
too large, then the server will always fail to build the ServerHello.
2. Calling this API is introducing a huge amount of overhead (1000s of
bytes) to each ServerHello, so removing this feature will improve
connection establishment latency for all users of the TLS server
credentials.
2023-06-29 09:48:15 -07:00