Commit Graph

4975 Commits

Author SHA1 Message Date
yifeizhuang 1eb1d157a7
xds: allow injecting bootstrapOverride in xdsNameResolverProvider (#8358) 2021-08-11 10:12:20 -07:00
skyguard1 96a5c25056
rls: fix routeLookupClient may be null in RlsLoadBalancer.requestConnection() (#8379) 2021-08-09 20:22:44 -07:00
Eric Anderson 51d1484c3c api: Document that NameResolvers shouldn't block
Fixes #8190
2021-08-09 16:41:26 -07:00
yifeizhuang bb06739cd7
xds: refactor xdsServer wrapper, modify filter chain matching handler for server routing config (#8333)
This is split from #8318, refactoring changes include:
1. FilterChainMatchingHandler
1.1. Previously filter chain match is built-in in XdsServerCredential for xdsServer. (But it does not have to be XdsServerCredential.) The protocol negotiator associated with the XdsServerCredential does the filter chain match computation. Now filter chain match is through a FilterChainMatchingHandler and it always run. As a result, it sets attributes of sslContextProviderSupplier from xds config in protocol negotiation event.
1.2. The previous protocol negotiator associated with the XdsServerCredential is modified to just lookup the config in the attribute set above and decide to use xds config credential or fallback credential.
1.3. Previously credential is a must in XdsBuilder. Now credential becomes optional to allow routing config to be fetched. Xds TCP listener update will always be used to run filter chain match.
Later, we will add routing config in filter chain match and apply http filter configs by installing ConfigApplyingInterceptor.
2. Removed xdsClientWrapperForServerXds, unnecessarily complicated. 
3. Changed event attribute key. Previously filter chain matching happens in the xdsClientWrapperForServerXds, the xds client wrapper is passed to negotiation handler via attributes to allow protocol negotiator to trigger the filter chain matching computation.
Now the attributes becomes an atomic config selector reference that xdsServerWrapper will inject by watching xds resources updates via xds client.
4. Previously there are multiple server states enum in xdsServerWrapper, this is removed because it is unnecessarily complicated. But there are still isServing status to avoid re-start delegate upon listener update.
5. Previously xdsServerWrapper ignores any xds updates once initial started, now we allow dynamic update to happen even if server is up. This is done via updating config selector atomic reference upon listener update.
6. Previously xdsServerWrapper synchronizes on the server object, this is modified to syncContext to be more manageable.
2021-08-09 09:32:36 -07:00
ZHANG Dapeng cbda32a3c1
core: fix RetriableStream edge case bug introduced in #8386 (#8393)
While adding regression tests to #8386, I found a bug in an edge case: while retry attempt is draining the last buffered entry, if it is in the mean time committed and then we cancel the call, the stream will never be cancelled. See the regression test case `commitAndCancelWhileDraining()`.
2021-08-06 18:32:55 -07:00
Eric Anderson 20ac1999d4
stub: Mark Stub-based MetadataUtils methods deprecated
We don't want other APIs to copy the stub-based API to attach the
interceptor. The API has a shorter name, but isn't actually all that
easier to use and isn't fluent like using the interceptor API.

These are _very_ old methods, so we won't be quick to delete them. Seems
we should have them deprecated at least a year or two; they are easy to
maintain in the mean time.

See API Review notes in #1789
2021-08-06 14:14:17 -07:00
Eric Anderson 7942f35c47 binder: Disable flaky SecurityPolicy tests
Not using `@Ignore` because the tests can probably run successfully
under Bazel.

See #8391
2021-08-06 12:20:39 -07:00
Eric Anderson 0e7e0b4f57 api: Clarify Server APIs can be used before start()
Fixes #8349
2021-08-06 11:26:17 -07:00
ZHANG Dapeng 3668f2e52c
core: fix bug RetriableStream cancel() racing with start() (#8386)
There is a bug in the scenario of the following sequence of events:

- `call.start()` 
- received retryable status and about to retry
- The retry attempt Substream is created but not yet `drain()` 
- `call.cancel()`

But `stream.cancel()` cannot be called prior to `stream.start()`, otherwise retry will cause a failure with IllegalStateException. The current RetriableStream code must be fixed to not cancel a stream until `start()` is called in `drain()`.
2021-08-05 18:22:37 -07:00
Nick Ufer 9dd0c66929 netty: removes TODO in test for NettyServer 2021-08-05 11:27:27 -07:00
ZHANG Dapeng c77083f013
core: fix old ClientStreamTracer.Factory creating tracers twice (#8381)
Fix a bug introduced in #8355 : old ClientStreamTracer.Factory implementation creates tracers twice.
2021-08-04 14:32:49 -07:00
sanjaypujare 0d80c33bce
xds: log error and fail start() if server-listener-resource-name-template not set or not using xds_v3 (#8375) 2021-08-03 13:01:09 -07:00
Eric Anderson 57bd087cdf buildscripts: Build android instrumentation tests in android CI
Binder's :build was missing. Cronet build failed without specifying
Java 8 because of the transitive Guava dependency.
2021-08-02 16:52:30 -07:00
Eric Anderson f781d24ddd Mostly revert "Run binderchannel android tests. (#8306)"
This partilaly reverts commit 5e18ff208a.
It leaves the compilation fix that was made to
BinderClientTransportTest.

Running instrumentation tests via firebase requires a `--app` argument.
However, we don't have such an app and it isn't immediately clear how
we'll go about making one. Revert the change to let android-testing to
start passing again.

This problem wasn't noticed before merging the original commit because
android-testing is a post-commit CI.
2021-08-02 16:13:33 -07:00
ZHANG Dapeng 1833587597
binder: fix binder build (#8366)
The binder module fail to compile because in #8355, the class BinderClientTransportTest was not refactored correspondingly.
2021-08-02 15:54:55 -07:00
Eric Anderson 75691c8588 build.gradle: Remove non-standard MANIFEST.MF attributes
Including the build user's name doesn't provide much value and may
surprise some people. Built-JDK is actually wrong, as it is reporting
Gradle's Java version, not the javac version. And Source-/Target-
Compatibility isn't useful if nobody looks at it. Generally people just
look at the bytecode version itself, which is much more reliable and
doesn't have questions as to whether it should be '8' or '1.8'.
2021-08-02 14:14:02 -07:00
Eric Anderson 62b4364a77 api: Fix Javadoc reference to NameResolver.Args
NameResolver.Helper was a short-lived class that didn't get very far. We
chose NameResolver.Args instead and didn't mirror LoadBalancer.
2021-08-02 13:09:40 -07:00
Eric Anderson f6ce672369 Revert "core: correcting a minor resource releasing issue"
This reverts commit b9becb5c8e. It is the
caller's responsibility to close their InputStream. The change ended up
closing the passed InputStream.
2021-08-02 11:32:14 -07:00
ZHANG Dapeng 860e97d12a
all: API refactoring in preparation to support retry stats (#8355)
Rebased PR #8343 into the first commit of this PR, then (the 2nd commit) reverted the part for metric recording of retry attempts. The PR as a whole is mechanical refactoring. No behavior change (except that some of the old code path when tracer is created is moved into the new method `streamCreated()`).

The API change is documented in go/grpc-stats-api-change-for-retry-java
2021-07-31 18:33:02 -07:00
Eric Anderson b2764595e6 netty: Refine workaround for Netty header processing for transparent retries
Nginx and C core don't do graceful GOAWAY and retries have matured such
that transparent retries may soon be on by default. Refining the
workaround thus can reduces error rate for users.

Fixes #8310
2021-07-30 16:42:21 -07:00
ZHANG Dapeng d836f38979
core: add real transport test for retry buffer limit (#8354)
The unit tests in RetriableStreamTest do not really test buffer limit from end to end, because the buffer limit is implemented using ClientStreamTracer.Factory, and the tracer callback outboundMessageSize() is only triggered in AbstractClientStream after message serialization. In fact, it was broken without failing any existing tests (#8343 (comment))

This PR adds a retry buffer limit test that runs through the AbstractClientStream code path.
2021-07-28 18:59:50 -07:00
yifeizhuang 343eed1c04
Start 1.41.0 development cycle (#8351) 2021-07-28 15:27:55 -07:00
April Kyle Nassi 1867e2caa5
Update MAINTAINERS.md (#8352)
moved 2 to emeritus list
2021-07-28 14:45:19 -07:00
Ran 1e858921e1
xds: stop checking if protos are null (#8347) 2021-07-27 13:37:26 -07:00
Sergii Tkachenko bf6db5a77c
xds: sync envoy proto to commit 62ca8bd2b5960ed1c6ce2be97d3120cee719ecab (#8346)
* xds: sync envoy proto to commit 62ca8bd2b5960ed1c6ce2be97d3120cee719ecab
* Suppress warnings for newly deprecated xDS proto fields

Sync to the latest update to pick up https://github.com/envoyproxy/envoy/pull/16942 for forward compatibility with upcoming xDS Rate Limiting features.
Internal Envoy import CL for `62ca8bd2b5960ed1c6ce2be97d3120cee719ecab`: cl/381356375

Suppressed warnings for newly deprecated xDS proto fields:
1) `PerXdsConfig xds_config` to be replaced with `GenericXdsConfig generic_xds_configs`, but this work yet to be planned
2) `HttpConnectionManager`'s `uint32  setXffNumTrustedHops` to be replaced with `TypedExtensionConfig OriginalIpDetectionExtensions`: https://github.com/envoyproxy/envoy/pull/14855
2021-07-26 20:01:42 -04:00
sanjaypujare ced7bc62a3
xds: accept an empty defaultValidationContext to support TD sending an LDSupdate like that (#8345) 2021-07-26 16:58:08 -07:00
Lidi Zheng 39b7415bc0
Fix a typo in xds_url_map.cfg (#8344) 2021-07-26 16:41:34 -07:00
ZHANG Dapeng 438f8d9e78
interop-testing: extend XdsTestServer features to support retry test
Extend XdsTestServer features as specified in go/xds-retry-interop-test

See also xds retry interop test case implementation grpc/grpc#26746, grpc/grpc#26791

Previously, rpc-behavior values in the request headers are handled in tow different places, one in interceptor and the other in service implementation via Context. I moved all the rpc-behavior handling in interceptor, Context is not needed any more.
2021-07-26 12:04:58 -07:00
Lidi Zheng b3a26b732e
Add xDS k8s url-map Kokoro job (#8340)
Related PR grpc/grpc#26764
Related CL cl/386366746

This test suite will be run every 6 hours, and takes around 30 minutes. The script is copied from xds-k8s.sh, and removed the generation of server image.
2021-07-26 10:14:27 -07:00
John Cormie ecac0da655
Clarify the ServerCallHandler API contract. (#8339)
- Focus the summary fragment
- Clarify that implementations don't just have access to "call" and
"headers" while running -- they in fact take ownership of these
arguments from the caller.
- Make explicit the caller's obligation to the returned Listener.
- Clarify that "{@code call} will be closed with an error" is actually
an obligation placed on the caller (who may be a user-defined
ServerInterceptor).
2021-07-26 09:58:15 -07:00
sanjaypujare 38cba5c8dd
xds: add all validations related to security as described in A29 gRFC (#8331) 2021-07-25 22:51:50 -07:00
ZHANG Dapeng f3642422b4
xds: support xds retry policy (#8304) 2021-07-22 12:04:06 -07:00
Chengyuan Zhang f2ed41aca0
Bump Protobuf Gradle Plugin to 0.8.17 (#8336) 2021-07-21 19:30:38 -07:00
yifeizhuang 4c1272febd
api: use <scheme,provider> map in nameResoverRegistry (#8323)
An improvement that makes name resolver provider scheme matching more explicit in name resolver registry.
2021-07-21 10:03:55 -07:00
Eric Anderson a282019902
netty: Use charset=utf-8, not encoding=utf-8 for error pages
This has been wrong since the introduction of the code in df357cb8.
Noticed as part of https://github.com/grpc/grpc-go/pull/4491 . The error
text is generally ASCII, so this probably doesn't matter much.
2021-07-19 13:32:11 -07:00
Robert Turner b9becb5c8e
core: correcting a minor resource releasing issue
This change adds a traditional try/finally block around readers and
streams to control the closing of those objects when the method has
completed rather than relying on the GC to deal with them.

This issue was flagged by an analysis tool via binary analysis of the
grpc-core package as part of a dependency from another project.
2021-07-15 17:08:00 -07:00
ZHANG Dapeng 9ed444ea2a
xds: add hint of fault injection to injected failures (#8326) 2021-07-14 19:37:25 -07:00
markb74 5e18ff208a
Run binderchannel android tests. (#8306) 2021-07-14 13:10:28 +02:00
markb74 eb802cf6b1
Add an asAndroidAppUri() method to AndroidComponentAddress. (#8312)
This returns the address as an "android-app://" uri, which can be
used with AndroidAppNameResolverProvider.
2021-07-14 11:01:07 +02:00
ZHANG Dapeng 4429ec2b78
core: add perAttemptRecvTimeout to retry policy (#8301) 2021-07-12 14:53:48 -07:00
Eric Anderson 9b55aed12e testing: Make more obvious that GrpcServerRule has been replaced
The previous text did explain to use GrpcCleanupRule, but a user just
skimming might not read the long paragraph. Now we have a TL;DR.
2021-07-12 14:46:12 -05:00
sanjaypujare 629748da61
xds: fix the race condition in SslContextProviderSupplier's updateSslContext and close (#8294) 2021-07-09 10:48:18 -07:00
sanjaypujare 3965315039
xds: implement filter-chain uniqueness check as per grfc A36 (#8295) 2021-07-08 17:22:43 -07:00
John Cormie d95eebe1a8
Document the BinderChannel status code mapping. (#8291)
Document the BinderChannel status code mapping.
2021-07-08 16:38:29 -07:00
yifeizhuang 6857d1b482
fix ServerBuilder callExecutor javadoc about direct executor (#8305) 2021-07-08 13:57:14 -07:00
ZhouyihaiDing 22aa8fcef1 Add Info log for gRPC LB's init response 2021-07-08 13:41:49 -05:00
Eric Anderson dd2a422193 binder: Remove unused import 2021-07-08 09:48:43 -05:00
markb74 d4ecc7cdb4
More exposed APIs to support internal transition. (#8303)
All maked with Internal to make it clear these APIs shouldn't
be used normally.
2021-07-05 13:12:49 +02:00
Eric Anderson 0cabf5672a compiler: Add GrpcGenerated annotation to generated class
This can be used by annotation processors to avoid processing the
gRPC-generated code. The normal Generated annotation only has SOURCE
retention, so isn't available to annotation processors.

I don't include the service name within the annotation as that assumes
we'll never have need for any other type of generated class. If there's
a request for exposing service name via an annotation in the future, we
can make an RpcService annotation or the like.

Fixes #8158
2021-07-02 22:11:40 -07:00
Eric Anderson 603135791a gitattributes: Show diffs for golden generated code
'binary' in gitattributes is a macro for '-text -diff' where -text
disables EOL modification and -diff disables textual diffs. However,
these are text files, so we'd actually rather like to have diff.
2021-07-02 22:11:40 -07:00