Commit Graph

4735 Commits

Author SHA1 Message Date
sanjaypujare bfc67bfcf4
xds: remove the env var GRPC_XDS_EXPERIMENTAL_NEW_SERVER_API (#7914) 2021-02-23 11:15:22 -08:00
Eric Anderson 6fb84bc61c Call the HTTP/2 close() so that GOAWAY is issued 2021-02-22 22:45:24 -08:00
Eric Anderson f2eb0af550 netty: Allow handshakes to be interrupted by channel shutdown
If a handshake is ongoing during shutdown, this would substantially
reduce the time it takes to shut down. Previously, you would need to use
channel.shutdownNow() to have fast shutdown behavior, which is an
unnecessary use of the variant.

When the current approach was written WriteBufferingAndExceptionHandler
didn't exist and so it was hard to predict how the pipeline would react
to events (particularly because of HTTP/2 handler's re-definition of
close()). Now that WBAEH exists, this is more straight-forward.
2021-02-22 22:45:24 -08:00
Chengyuan Zhang 22d1af0c89
xds: implement simple safe and allocation-free xx_hash (#7912)
Implement a simple allocation-free xx_hash utility class without using sun.misc.Unsafe. The hash function mainly targets on xDS use case, which is mostly small strings (endpoint address, headers, etc) and primitive types.

In gRPC's use case, string characters need to be treated as ASCIIs to make the produced hash values match other implementations (Envoy, gRPC-Go, C-core, etc) would produce.

The hashing implementation and tests are borrowed from OpenHFT's XxHash implementation (https://github.com/OpenHFT/Zero-Allocation-Hashing/blob/master/src/main/java/net/openhft/hashing/XxHash.java, see commit 658079a50903c32c54f2ab5c86243244b3ac60ed), which is under Apache 2.0 license. For more details, see https://github.com/OpenHFT/Zero-Allocation-Hashing.

The code is made to be in third_party directory with LISENCE and NOTICE files.
2021-02-22 11:07:25 -08:00
sanjaypujare 6a581f282b
xds: implement the new filterChainMatch algorithm (#7910) 2021-02-19 15:29:27 -08:00
Eric Anderson a55e034732 interop-testing: Specify ca-cert with transport-agnostic Credentials API 2021-02-19 09:30:24 -08:00
Eric Anderson 2e0e238fb2 okhttp: Consume mTLS and Trust/KeyManager Credentials API 2021-02-19 09:30:24 -08:00
Eric Anderson 0eab1c9176 netty: Consume mTLS and Trust/KeyManager Credentials API 2021-02-19 09:30:24 -08:00
Eric Anderson d937ec5baf api: Add mTLS and Trust/KeyManager Credentials API 2021-02-19 09:30:24 -08:00
ZHANG Dapeng 132a40a1cf
xds: implement fault injection interceptor in XdsNameResolver 2021-02-18 14:35:45 -08:00
Sergii Tkachenko e5e9c7a714 xds: sync envoy proto to commit ac9a2637336decdcc52c24add5e8fc39edebb962 2021-02-18 16:11:04 -05:00
ZHANG Dapeng 29864f4fad
xds: gate HttpFilter parsing by env flag 2021-02-17 18:55:43 -08:00
Kristofer Karlsson 3c4d3d2bb2 Move pendingDeadline.cancel out of synchronized block 2021-02-17 15:14:28 -08:00
ZHANG Dapeng e73f31a561
rls: fix rls oobChannel grpclb config service name
The serviceName field in oobChannel grpclb config should not be null, otherwise it will default to the lbHelper.getAuthority(), which perviously defaulted to the lookup service before #7852, but has been overridden to the backend service for authentication in #7852.
2021-02-17 10:10:50 -08:00
yifeizhuang 97b705614b
xds: add proto leakage check at gradle build (#7899) 2021-02-16 16:19:06 -08:00
Eric Anderson 1161ad9ed8 alts: Make concurrent handshake limit part of ALTS instead of TSI
The handshake limit is more a property of ALTS than TSI. This allows
other TSI implementations to accept a high connection rate (b/179376431)
2021-02-12 17:11:21 -08:00
Doug Fawley 3752b9e365
add timeout test case to xds interop tests (#7888) 2021-02-12 14:25:20 -08:00
yifeizhuang 0d2ea9365a
interop-testing: fix alts handshaking race (#7896) 2021-02-12 09:50:49 -08:00
sanjaypujare 8030c3a11d
xds: Implement XdsServingStatusListener as per the new xDS server gRFC (#7876) 2021-02-12 09:22:26 -08:00
Chengyuan Zhang 7b70161eef
xds: XdsClient support for hashing based load balancing (#7859)
This change adds two parts to XdsClient for receiving configurations that support hashing based load balancing policies:

- Each Route contains a list of HashPolicys, which specifies the hash value generation for requests routed to that Route.
- Each Cluster resource can specify lb policy other than "round_robin". If it is "ring_hash", it contains the configuration for mapping each RPC's hash value to one of the endpoints.
2021-02-11 23:54:28 -08:00
yifeizhuang 986a36b947
examples: add ALTS example README.md (#7861) 2021-02-11 16:37:39 -08:00
Chengyuan Zhang f4ef5acfd9
gradle, README: Bump protobuf-gradle-plugin version to 0.8.15 (#7891) 2021-02-11 15:41:18 -08:00
Eric Anderson 2140480736 Start 1.37.0 development cycle 2021-02-11 13:53:10 -08:00
ZHANG Dapeng 7d9ee8f051
rls: fix wrong server field in lookup request again
The previous fix #7878 didn't work because the server field is expected to be full hostname (without port number). Need strip the port part from the authority.
2021-02-10 16:33:59 -08:00
yifeizhuang 7f7821c616
interop-testing: add fake altsHandshakerService for test (#7847) 2021-02-09 16:56:26 -08:00
martin-schaub 514101d90c
alts: Introduce AltsContext to allow outside packages accessing ALTS information 2021-02-09 09:16:28 -08:00
Serhii Zabelnykov 9ba419adc0
api: add nullable annotation to trailersFromThrowable (#7856) 2021-02-08 23:39:38 -08:00
ZHANG Dapeng 23bb2ebf31
all: publish grpc-rls
Making `io.grpc:grpc-rls` a maven artifact from next release.
2021-02-08 21:39:54 -08:00
ZHANG Dapeng cb3317b1fd
rls: fix wrong lookup request server field
The server filed in lookup request as specified in go/dynamic-request-routing/#heading=h.eqjtcpo6u8ep should be the original target, not the RLS server where the lookup request is sent to.
2021-02-08 15:53:36 -08:00
ZHANG Dapeng 2cd45e7a24
rls: forcefully close rls channel when lb is shutdown
RLS RPC deadline is configured by service config, and could be extremely long. When RLS lb is shutdown, any pending RLS PRC should be cancelled. Now using shutdownNow() to forcefully close the RLS channel.
2021-02-08 15:52:53 -08:00
ZHANG Dapeng b1daad6f30
xds: remove GRPC_XDS_EXPERIMENTAL_V3_SUPPORT env flag 2021-02-08 13:42:43 -08:00
Chengyuan Zhang 14332d294c
xds: be tolerant for unspecified locality fields in bootstrap (#7872) 2021-02-05 17:30:07 -08:00
Chengyuan Zhang 01ed082281
xds: clean up value-typed classes (#7863)
This change cleans up most value-typed classes in EnvoyProtoData, which represent immutable xDS configurations used in gRPC. This introduces AutoValue for reducing the amount of boilerplate code for pure data classes.

Not all value-typed classes in xDS have been migrated, some would need more invasive refactoring and would be done next. This change is a pure no-op refactoring. No behavior change should be introduced.

For more details, see PR description.
2021-02-05 12:48:38 -08:00
Eric Anderson f0cf435b85 README.md: Document protobuf-gradle-plugin config for lite
This is part of the examples and other documentation, but a user
starting with the README would find things not working and it be very
unclear why.

Realized this was an issue because of
https://stackoverflow.com/q/66028045/4690866 .
2021-02-03 13:07:23 -08:00
Chengyuan Zhang 0dc37ab77d
xds: reimplement stats management (#7848)
This change reimplements stats recording for the client side:

1. Implemented the new stats objects: ClusterDropStats and ClusterLocalityStats, which match C-core's implementation. The XdsClient APIs for accessing stats objects are

- addClusterDropStats(String clusterName, String edsServiceName)
- addClusterLocalityStats(String clusterName, String edsServiceName, Locality locality)

2. Eliminated the LRS LB policy and incorporate locality load recording in ClusterImplLoadBalancer. The endpoint addresses resolved in ClusterResolverLoadBalancer will attach the locality in each address attributes. In ClusterImplLoadBalancer, its helper's createSubchannel() will populate the address locality and then call XdsClient.addClusterLocalityStats(...) to obtain the per-locality stats object for recording RPCs. This stats object is attached to the created subchannel's attribute. Therefore, ClusterImplLoadBalancer receives Picker update from its child LB policy, the Picker's subchannel will always have the per-locality stats object attached. Helper.pickSubchannel(...) will populate the per-locality stats object and wrap it into the stream tracer for counting RPCs. Note the subchannel's shutdown() is wrapped to call the stats object's Release().
2021-02-03 10:45:59 -08:00
Rui Liu 563288f0ad
netty: Log expected STREAM_CLOSED exceptions for already closed streams at FINE level
See this PR in netty: https://github.com/netty/netty/pull/9798 . It's
possible that one peer has closed the stream, yet another frame from
peers arrives after it. This is largely harmless, as explained in the PR
from netty repository. If we don't do this, the log will be polluted with
these harmless logs.

Example that would no longer be logged:

```
Jan 25, 2021 6:23:51 PM io.grpc.netty.NettyServerHandler onStreamError
WARNING: Stream Error
io.netty.handler.codec.http2.Http2Exception$StreamException: Received DATA frame for an unknown stream 27
        at io.netty.handler.codec.http2.Http2Exception.streamError(Http2Exception.java:147)
        at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.shouldIgnoreHeadersOrDataFrame(DefaultHttp2ConnectionDecoder.java:596)
        at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onDataRead(DefaultHttp2ConnectionDecoder.java:239)
        ...
```
2021-02-02 12:21:55 -08:00
Sergii Tkachenko 461b10a907 services: add support for channelz.GetServer() 2021-02-01 19:33:16 -05:00
Martin Schaub 4c5559d54f Make clearer that AltsAuthContext is internal by renaming 2021-02-01 16:31:33 -08:00
Sergii Tkachenko 7f3ddca30f xds: sort FILES in import.sh scripts alphabetically 2021-02-01 18:43:41 -05:00
ZHANG Dapeng 92e7fd370b
core: user is responsible to override authority for resolvingOobChannelBuilder
ManagedChannelImpl should not override authority for createResolvingOobChannel(target, creds), because ManagedChannelImpl does not know what target and creds are.
2021-01-29 09:50:59 -08:00
yifeizhuang ef76337f5c
core: add more delayedStream tests (#7843)
Add more delayedStream tests related to #7750, where we changed to call realStream.start() synchronously with setting realStream.
2021-01-29 09:42:10 -08:00
ZHANG Dapeng 9bb9fef6b0
rls: use channel creds to create resolvingOobChannel 2021-01-29 09:29:39 -08:00
ZHANG Dapeng 9437783838
core: enhance ManagedChannelBuilder.overrideAuthority()
Enhance `ManagedChannelBuilder.overrideAuthority()` to make it impossible to use a different authority to a backend by wrapping ClientTransportFactory.newClientTransport() and setting ClientTransportOptions’ authority. To avoid confusing the LB policy, it would need to keep the original addresses to return during `Subchannel.getAddresses()`

The class `OverrideAuthorityNameResolverFactory` is deleted and its logic is moved into `ManagedChannelImpl`.
2021-01-29 09:29:06 -08:00
sanjaypujare 64676198c5
xds: implement all string matcher types for SAN list matching (#7801) 2021-01-29 08:32:17 +05:30
ZHANG Dapeng 45a151810c
all: implement Helper.createResolvingOobChannelBuilder(target, creds)
- Add APIs to `ClientTransportFactory`:
```java
public interface ClientTransportFactory {
  /**
   * Swaps to a new ChannelCredentials with all other settings unchanged. Returns null if the
   * ChannelCredentials is not supported by the current ClientTransportFactory settings.
   */
  SwapChannelCredentialsResult swapChannelCredentials(ChannelCredentials channelCreds);

  final class SwapChannelCredentialsResult {
    final ClientTransportFactory transportFactory;
    @Nullable final CallCredentials callCredentials;
  }
}
```

- Add `ChannelCredentials` to constructor args of `ManagedChannelImplBuilder`:
 ```java
public ManagedChannelImplBuilder(
      String target, @Nullable ChannelCredentials channelCreds, @Nullable CallCredentials callCreds, ...)
  ```
2021-01-28 09:49:53 -08:00
ZHANG Dapeng a6df2b2ff4
xds: parse HttpFault filter from LDS/RDS response 2021-01-27 20:45:18 -08:00
Chengyuan Zhang 09869528f8
xds: fix bug of missing cluster_service_name conversion in v2 ClusterStats (#7849) 2021-01-27 18:18:22 -08:00
Chengyuan Zhang 14a38ef9b5
interop-testing: implement test client support for xDS timeout test (#7837)
Changes the xDS interop test client to support timeout test.

- Synced xDS test proto messages with grpc-proto.
- Changed RpcConfig to be the configuration for per test method type. Added timeoutSec for its deadline configuration.
- Changed accumulated stats to include RPC status instead of just succeeded/failed.
2021-01-27 17:09:01 -08:00
yifeizhuang ac2ead70b4
core: delay CallCredentialsApplyingTransport shutdown until metadataApplier finalized (#7813)
Improve the CallCredentialsApplyingTransport shutdown lifecycle management. Right now CallCredentialsApplyingTransport shutdown the delegated real transport too early. It should be waiting for the metadataAppliers to finish because they may execute asynchronously. In addition, there is no shutdown check on CallCredentialsApplyingTransport for newStream(). The degraded lifecycle implementation may cause RejectionExecutionException, or accepting new RPCs after the underlying transport is already closed during channel shutdown.

We added listener on metadataApplier to notify completion, a magic counter to track the pending metadataApplier for delaying shutdown, also added shutdown check for newStream().
2021-01-26 12:01:16 -08:00
Eric Anderson dbd903c018
core: Rewrite builder class signatures to avoid internal class
This provides us a path forward with #7211 (hiding
AbstractManagedChannelImplBuilder and AbstractServerImplBuilder) while
providing users a migration path to manage the ABI breakage (#7552). We
do a .class hack so that recompiling avoids the internal class reference
yet the old methods are still available.

Leaving the classes as-is causes javac to compile two versions of each
method, one returning the public class (e.g. ServerBuilder) and one
returning the internal class (e.g., AbstractServerImplBuilder). However,
we rewrite the signature that is used at compile time so that new
compilations will not reference internal-returning methods.

This is intended to be temporary, just to give a migration path. Once we
have given users some time to recompile we will remove this rewriting
and change the generics to use public classes.
2021-01-25 17:29:12 -08:00