Commit Graph

5254 Commits

Author SHA1 Message Date
ZHANG Dapeng b32d2d2de9
xds: parse ClusterSpecifierPlugin from RouteConfiguration in xDS response
Implement the xds Client section of go/grpc-rls-in-xds#heading=h.9kitavdfxxiw
2022-01-06 10:22:57 -08:00
Eric Anderson 80c3be0f80
Bump protobuf to 3.19.2 2022-01-06 09:08:50 -08:00
ZHANG Dapeng 86b8b265ba
.github/workflows: publish test results for failed job
The GitHub Actions Linux Testing only reports limited information (can not see full stacktrace, time consumed, or stderr from child threads) when unit tests fail. Adding a step to upload the test report to Artifacts if the test fails. If the test is successful, no artifacts will be uploaded.
2022-01-05 10:31:22 -08:00
Daniel Norberg 24e345c06d
readme: grpc-netty-shaded runtime scope
We should recommend runtime scope for grpc-netty-shaded.

https://github.com/grpc/grpc-java/issues/8606#issuecomment-1004504316
2022-01-04 15:39:19 -08:00
sanjaypujare e474e3dc7e
buildscripts: always make sure we are using jdk8 (#8800) 2022-01-04 13:01:02 -08:00
Lidi Zheng 80f1be03f0
Use xds-test-server-5 as the GCE interop server (#8777) 2021-12-21 16:39:31 -08:00
ZHANG Dapeng 86ca55483b
Update README etc to reference 1.43.1 (#8775) 2021-12-21 15:18:52 -08:00
Mohan Li b244ba8d4c
xds: add skipNetCmd flag to fallback test client (#8765)
We are setting up fallback test based on TD. Currently the test client is compiled in google3, so we must run it in a container so that the client can have the GRTE dependency. However, container does not have `ip`, `iptables`, etc network command, so we plan to run the network command outside of the container. To do this, add a new flag `skipNetCmd` to skip network commands inside the test client.
2021-12-20 13:00:42 -08:00
ZHANG Dapeng 042f9879d4
all: remove deprecated StreamInfo.transportAttrs (#8768)
APIs such as `StreamInfo.getTransportAttrs()` were [deprecated](860e97d12a (diff-aa4049f54d6d5d462700e9221344184a37d2068b3ba7d715abd417b1df5bf883R114)) since 1.41.0. Removing now.
2021-12-20 09:46:25 -08:00
ZHANG Dapeng 63756ec951
core: remove unused method in AutoConfiguredLoadBalancer (#8769)
The method added in #5821 seems not used now.
2021-12-17 07:36:00 -08:00
Eric Anderson d9eb30cd92
Bump GSON to 2.8.9 2021-12-15 14:03:36 -08:00
ZHANG Dapeng 282a62e418
Update README etc to reference 1.43.0 (#8760) 2021-12-15 10:27:01 -08:00
ZHANG Dapeng 531db504ca
core: fix race condition in idleTimer & ManagedChannel#enterIdle
PR for Spikhalskiy/grpc-java@6d260b8

Hot fix of #8714
2021-12-14 17:55:48 -08:00
Eric Anderson efd968bcbb Upgrade Protobuf to 3.19.1 and Guava to 30.1.1
Protobuf uses Guava 30.1.1, so I upgrade it at the same time. It also
caused an update to rules_jvm_external and reworking the Bazel build.
Protobuf no longer requires bind() so they were dropped. Although
Protobuf's protobuf_deps() brings in rules_jvm_external, and so we don't
need to define it ourselves, it seems better to define it directly and
not depend on transitive deps since we use it directly.

Protobuf now has support for maven_install() by exposing
PROTOBUF_MAVEN_ARTIFACTS, which required reorganizing the WORKSPACE to
use maven_install() after loading protobuf. Protobuf still doesn't
define target overrides for itself so we still maintain those. When
reorganizing the WORKSPACE I noticed http_archive should ideally be
above io_grpc_grpc_java as most users will need it there, so I fixed
that since there were lots of other load()-reordering already.
2021-12-09 10:35:39 -08:00
Grant Oakley e28145ab6a
Enclose all operations using obtained Parcels in try-finally blocks that will recycle the Parcel in the case that any exception is thrown. (#8733) 2021-12-08 14:39:42 -08:00
apolcyn 24330bccff
Replace C2P resolver env var with experimental scheme suffix (#8744)
Java analogue of grpc/grpc#28294
2021-12-07 13:29:29 -08:00
Sergii Tkachenko 7aaa418ec7 rls: Fix RouteLookupConfig test arguments
This PR fixes a few cosmetic violations of the ErrorProne patterns
introduced in PR #8645: ParameterName, and TimeUnitMismatch.
2021-12-01 18:54:13 -05:00
John Cormie 27b03c66a6
Send empty shutdown flags to avoid a binder memory leak (#8728) 2021-11-30 16:00:43 -08:00
ZHANG Dapeng 65c00cf24e
Start 1.44.0 development cycle (#8729) 2021-11-30 11:53:56 -08:00
ZHANG Dapeng 2330922c38
rls: overhaul RouteLookupConfig validation (#8645)
The `RlsProtoData.RouteLookupConfig` class is out-of-date. 

- Some of the fields were long, but now are of `Duration` type. 
- Some of the fields are deleted. 
- The validation of some of the fields either have been changed or were wrong since beginning.

Now overhaul all the fields in `RlsProtoData.RouteLookupConfig` class based on the spec http://go/grpc-rls-lb-policy-design#heading=h.y3h669gfpown.

Also move the validation logic in json parsing rather than in the constructor of `RouteLookupConfig`.
2021-11-30 08:36:20 -08:00
ZHANG Dapeng cb4b91418c
javadoc: update new API `@since` version (#8727)
The @since version in commits 5a3b8e2 and a2398ce were missing and incorrect respectively.
2021-11-29 10:22:32 -08:00
ZHANG Dapeng a4334eb5c3
census: fix NPE in calling recordFinishedAttempt() (#8706)
Fix the NPE as shown in the following stacktrace:

```
Caused by: java.lang.RuntimeException: java.lang.NullPointerException with message: null
        at io.grpc.census.CensusStatsModule$ClientTracer.recordFinishedAttempt(CensusStatsModule.java:388) ~[grpc-census-1.42.0.jar:1.42.0]
        at io.grpc.census.CensusStatsModule$CallAttemptsTracerFactory.recordFinishedCall(CensusStatsModule.java:525) ~[grpc-census-1.42.0.jar:1.42.0]
        at io.grpc.census.CensusStatsModule$CallAttemptsTracerFactory.attemptEnded(CensusStatsModule.java:492) ~[grpc-census-1.42.0.jar:1.42.0]
        at io.grpc.census.CensusStatsModule$ClientTracer.streamClosed(CensusStatsModule.java:345) ~[grpc-census-1.42.0.jar:1.42.0]
        at io.grpc.internal.StatsTraceContext.streamClosed(StatsTraceContext.java:155) ~[grpc-core-1.42.0.jar:1.42.0]
        at io.grpc.internal.AbstractClientStream$TransportState.closeListener(AbstractClientStream.java:458) ~[grpc-core-1.42.0.jar:1.42.0]
        at io.grpc.internal.AbstractClientStream$TransportState.access$400(AbstractClientStream.java:221) ~[grpc-core-1.42.0.jar:1.42.0]
        at io.grpc.internal.AbstractClientStream$TransportState$1.run(AbstractClientStream.java:442) ~[grpc-core-1.42.0.jar:1.42.0]
        at io.grpc.internal.AbstractClientStream$TransportState.deframerClosed(AbstractClientStream.java:278) ~[grpc-core-1.42.0.jar:1.42.0]
        at io.grpc.internal.Http2ClientStreamTransportState.deframerClosed(Http2ClientStreamTransportState.java:31) ~[grpc-core-1.42.0.jar:1.42.0]
        at io.grpc.internal.MessageDeframer.close(MessageDeframer.java:233) ~[grpc-core-1.42.0.jar:1.42.0]
        at io.grpc.internal.MessageDeframer.closeWhenComplete(MessageDeframer.java:191) ~[grpc-core-1.42.0.jar:1.42.0]
        at io.grpc.internal.AbstractStream$TransportState.closeDeframer(AbstractStream.java:200) ~[grpc-core-1.42.0.jar:1.42.0]
        at io.grpc.internal.AbstractClientStream$TransportState.transportReportStatus(AbstractClientStream.java:445) ~[grpc-core-1.42.0.jar:1.42.0]
        at io.grpc.internal.AbstractClientStream$TransportState.transportReportStatus(AbstractClientStream.java:401) ~[grpc-core-1.42.0.jar:1.42.0]
        at io.grpc.internal.AbstractClientStream$TransportState.inboundTrailersReceived(AbstractClientStream.java:384) ~[grpc-core-1.42.0.jar:1.42.0]
        at io.grpc.internal.Http2ClientStreamTransportState.transportTrailersReceived(Http2ClientStreamTransportState.java:183) ~[grpc-core-1.42.0.jar:1.42.0]
        at io.grpc.netty.shaded.io.grpc.netty.NettyClientStream$TransportState.transportHeadersReceived(NettyClientStream.java:334) ~[grpc-netty-shaded-1.42.0.jar:1.42.0]
        at io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler.onHeadersRead(NettyClientHandler.java:372) ~[grpc-netty-shaded-1.42.0.jar:1.42.0]
        at io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler.access$1200(NettyClientHandler.java:91) ~[grpc-netty-shaded-1.42.0.jar:1.42.0]
        at io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler$FrameListener.onHeadersRead(NettyClientHandler.java:934) ~[grpc-netty-shaded-1.42.0.jar:1.42.0]
```

The NPE can happen when `ClientCall.Listener.onClose()` and `StatsTraceContext.streamClosed()` (or `ClientStreamListener.closed()`) are invoked concurrently in different threads.  Note that `CensusStatsModule$CallAttemptsTracerFactory.attemptEnded()` in the above stack trace would observe `callEnded==true` in such a race condition.

The following are the possible scenarios that the race between `ClientCall.Listener.onClose()` and `ClientStreamListener.closed()` can happen:

- Deadline exceeded but the underlying real stream is [not committed](https://github.com/grpc/grpc-java/blob/v1.42.0/core/src/main/java/io/grpc/internal/RetriableStream.java#L486-L495), the `ClientCall.Listener` may be closed earlier than the stream listener. (This is the case of the above stack trace, in which the inbound end-of-stream is received observing `callEnded==true`. Even if nothing inbound is received, there is still a chance that the NPE can happen.)
- DelayedClientTransport.PendingStream has created a realStream but `setStream(realStream)` is [not called yet](https://github.com/grpc/grpc-java/blob/v1.42.0/core/src/main/java/io/grpc/internal/DelayedClientTransport.java#L366-L372), when deadline exceeded. (This has little chance to happen, only for the very first RPC on the channel.)
- Hedging case.

In deadline-exceeded cases, the shorter the deadline is, the more likely the race can happen.
2021-11-29 08:48:51 -08:00
markb74 ee581bfdfa
buildscripts: add config for building grpc-binder artifact (#8722) 2021-11-23 18:11:54 +01:00
ZHANG Dapeng 5f3a5f8b37
xds: support xdstp scheme in resource URIs for federation (#8716)
Implement applying `server_listener_resource_name_template` and `client_listener_resource_name_template` with xdstp scheme, extracting authorities from xdstp resource URI and lookup authorities map in bootstrap.
2021-11-22 09:02:35 -08:00
ZHANG Dapeng a5f1fb51b8
core: have JsonUtil support parsing String value as number (#8711)
As documented in https://developers.google.com/protocol-buffers/docs/proto3#json,
the canonical proto-to-json converter converts int64 (Java long) values to string values in Json rather than Json numbers (Java Double). Conversely, either Json string value or number value are accepted to be converted to int64 proto value.

To better support service configs defined by protobuf messages, support parsing String values as numbers in `JsonUtil`.
2021-11-19 10:12:39 -08:00
yifeizhuang 8382bd8e04
xds: fix clusterImplLoadBalancer NPE when lrs is null (#8713) 2021-11-18 14:30:35 -08:00
ZHANG Dapeng dd0db6cf41
xds: terminate XdsServer start() thread when shutdownNow() is called
`XdsServerWrapper.start()` [blocks](https://github.com/grpc/grpc-java/blob/master/xds/src/main/java/io/grpc/xds/XdsServerWrapper.java#L162) until `LdsResourceWatcher`'s callback is called. If no callback is called due to whatever issue of the XdsClient, the server start() will be stuck forever, even we call `shutdownNow()`.

Changing the `shutdownNow()` behavior to unblock `start()` immediately.
2021-11-17 19:54:40 -08:00
beatrausch 5a3b8e2141
okhttp: introduced new TLS1.2 cipher suites and internal okhttp implementation for TLS1.3 prepared (#8650)
This introduces new TLS 1.2 cipher suites (#8610) and prepares the
internal okhttp implementation for TLS1.3. A new method for creating
internal ConnectionSpec was added to be able to use the newly introduced
cipher suites in the OkHttpChannelBuilder. Okhttp cipher suites
synchronized with the ones from netty.
2021-11-16 18:29:29 -08:00
Mohan Li a2398ce5db
alts: Make GoogleDefaultChannelCredentials take a CallCredentials (#8548)
DirectPath is going to support non-default service account. This commit
allows users to pass CallCredentials to GoogleDefaultChannelCredentials.
See design in go/directpath-file-credential-google-default-creds
2021-11-15 15:46:56 -08:00
sanjaypujare b746bab97b
buildscripts: rename xds-k8s to psm-security as part of tech-debt cleanup and name clarity (#8695) 2021-11-12 17:40:07 -08:00
yifeizhuang 71c5eb07d3
Update README etc to reference 1.42.1 (#8694) 2021-11-12 16:54:35 -08:00
yifeizhuang 881747a63d
xds: migrate udpa proto to xds directory (#8686)
fix https://github.com/grpc/grpc-java/issues/8631:
1. import udpa protos form new git repo `https://github.com/cncf/xds.git` instead of  `https://github.com/cncf/udpa.git`
2. use proto from xds directory not udpa directory in `https://github.com/cncf/xds.git`, details was here https://github.com/cncf/xds/issues/2#issuecomment-875838155
3. support both versions of TypeStruct
4. remove v1 orca service in old directory and use the new one v3, and refer to v3 in ORCA related area
2021-11-11 10:07:14 -08:00
ZHANG Dapeng ad0971ef5f
xds: fix parsing RouteLookupClusterSpecifier mistake (#8641)
- Partially revert the change of RlsProtoData.java  in #8612  by removing `public` accessor
- Have grpc-xds no longer strongly depend on grpc-rls. The application will need grpc-rls as runtime dependencies if they need route lookup feature in xds.
- Parse RouteLookupServiceClusterSpecifierPlugin config to the Json/Map representation of `io.grpc.lookup.v1.RouteLookupClusterSpecifier` instead of `io.grpc.rls.RlsProtoData.RouteLookupConfig`
2021-11-10 11:27:42 -08:00
ZHANG Dapeng b3579db574
xds: Migrate away deprecated fields in CsdsService (#8675)
Migrate deprecate `xds_config` field to `generic_xds_configs` 

https://www.envoyproxy.io/docs/envoy/latest/api-v3/service/status/v3/csds.proto#service-status-v3-clientconfig

As per grpc/proposal#267.

The c++ version is grpc/grpc#27794
2021-11-10 08:38:44 -08:00
ZHANG Dapeng 389b865b9b
xds: populate LRS ServerInfo to CdsUpdate (#8676)
Replace `String lrsServerName` with `ServerInfo lrsServerInfo` in `CdsUpdate`.

See http://go/grpc-xds-federation#heading=h.gh3gjftay27x for details.

This PR is only refactoring. Federation support is not implemented until the TODO [here](a5c526c12f/xds/src/main/java/io/grpc/xds/ClientXdsClient.java (L2280)) is addressed.

Resolves #8628
2021-11-09 16:37:54 -08:00
Kevin Wooten 6518d7bd6d
Copy macOS x86 artifacts to aarch during upload (#8680) 2021-11-09 10:36:04 -08:00
Eric Anderson b6eafbe695 netty: Add system property to disable Connection header check
A user has a proxy that is sending "Connection: close", which is against
the HTTP/2 spec, but will take time to fix.

Fixes #8674
2021-11-09 09:26:18 -08:00
yifeizhuang 0b0079c8a1
xds: fix xdsClient resource not exist for invalid resource, fix xdsServerWrapper start on resource not exist (#8660)
Fix bugs:
1. Invalid resource at xdsClient, the watcher should have been delivered an error instead of resource not found.
2. If the resource is properly determined to not exist, it shouldn't cause start() to fail. From A36 xDS for Servers:
"XdsServer's start must not fail due to transient xDS issues, like missing xDS configuration from the xDS server."
2021-11-08 15:21:59 -08:00
cfredri4 ab7f867a4a
xds: Fix incorrect (old) javadoc for BootstrapperImpl (#8671) 2021-11-08 10:25:03 -08:00
Eric Anderson fe9026ed8a kokoro: Increase xds-k8s timeout to 3 hours
The addition of the authz tests in 0d345721 is causing the tests to
exceed their timeout. By itself, the authz test takes about an hour in
this environment. Before the authz tests, xds-k8s was taking an hour
and a half.
2021-11-05 10:04:48 -07:00
Sergii Tkachenko d548a35ab9 Update README etc to reference 1.42.0 2021-11-05 13:01:50 -04:00
Eric Anderson 0d34572149 kokoro: Enable xds authz_test
It is successfully passing against prod:
https://source.cloud.google.com/results/invocations/e2be0996-ed4d-4a4c-90ad-20bc706f9f70/targets
2021-11-04 16:31:16 -07:00
yifeizhuang a5c526c12f
xds: remove filter chain uuid name generator (#8663)
Generating a uuid in filterChain breaks the de-duplication detection which causes XdsServer to cycle connections, so removing it.
An empty name is now allowed. The name is currently only used for debug purpose.
2021-11-04 14:10:03 -07:00
sanjaypujare c0b8eff984
interop-testing: assign server as soon as it is built instead of after start (#8662) 2021-11-04 12:31:11 -07:00
Sergii Tkachenko efec994f4c Update MAINTAINERS.md 2021-11-04 14:50:34 -04:00
yifeizhuang 93a77a78a9
Revert "xds: add xds end to end interop test (#8618)" (#8656)
This reverts commit 0000cba665.
2021-11-03 12:13:05 -07:00
Eric Anderson bc12a1eb66 RELEASING.md: Individual OSSRH account is no longer needed
Most of the OSSRH interactions are performed by a robot.
2021-11-03 11:26:27 -07:00
yifeizhuang 0000cba665
xds: add xds end to end interop test (#8618)
Add AbstractXdsInteropTest, XdsTestControlPlaneService and only ping-pong testcase in initial implementation.
AbstractXdsInteropTest sets up the test control plane, create xdsClient and xdServer using bootstrap override, test case extending AbstractXdsInteropTest is supposed to override the control plane config and run the verification.

XdsTestControlPlaneService only has static xds configurations, not able to keep states.

How to run:
 ./gradlew :grpc-interop-testing:installDist -PskipCodegen=true
 ./interop-testing/build/install/grpc-interop-testing/bin/xds-e2e-test-client
2021-11-02 13:20:41 -07:00
Terry Wilson c1e19af86d
grpclb: fallback timer only when not already using fallback backends. (#8646)
Addresses a problem where we initially only resolve addresses to the backends, but not the load balancer and then later resolve addresses to both. In this situation the fallback timer was started during the second instance even if it resulted in the timer later failing as we were already using fallback backends.

This change assures that a fallback time is only ever started if we are not already using the fallback backends.

This is a follow-up fix to #8253.
2021-11-02 12:47:47 -07:00
markb74 746501dff6
binder: SecurityPolicy updates (take 2). (#8637)
The previous attempt at this CL relied on guava's Hashing class which
is still in beta. This update compares Signature objects directly instead
of SHA256 hashs, removing the need for the Hashing class.

Add additional comments to the security policy class, to mention that
implementing new policies requires significant care.

With that in mind, add security policies to check the peer app's
signature, so people can create cross-app communication without
having to implement their own policy.

Finally, add the UntrustedSecurityPolicies class, since that's
inevitably a policy which is sometimes needed.
2021-11-01 18:57:30 +01:00