Commit Graph

5682 Commits

Author SHA1 Message Date
Eric Anderson 9de989bd64 okhttp: Avoid DNS lookup in test
Our tests assume localhost is in /etc/hosts or uses some other form of
local-only resolution. But that wouldn't apply to "host". What was
happening is this was causing a DNS resolution, which would fail, and
the InetSocketAddress would be "unresolved". Thus, the equivalent and
faster code would be `InetSocketAddress.createUnresolved("host", 1234)`.
But there doesn't seem to be any reason to avoid localhost in this test,
so swap to the more typical solution instead.

This should avoid flakes like:
```
io.grpc.okhttp.OkHttpClientTransportTest > invalidAuthorityPropagates FAILED
    org.junit.runners.model.TestTimedOutException: test timed out after 10 seconds
        at java.base@11.0.17/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
        at java.base@11.0.17/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:929)
        at java.base@11.0.17/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1529)
        at java.base@11.0.17/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:848)
        at java.base@11.0.17/java.net.InetAddress.getAllByName0(InetAddress.java:1519)
        at java.base@11.0.17/java.net.InetAddress.getAllByName(InetAddress.java:1378)
        at java.base@11.0.17/java.net.InetAddress.getAllByName(InetAddress.java:1306)
        at java.base@11.0.17/java.net.InetAddress.getByName(InetAddress.java:1256)
        at java.base@11.0.17/java.net.InetSocketAddress.<init>(InetSocketAddress.java:220)
        at app//io.grpc.okhttp.OkHttpClientTransportTest.invalidAuthorityPropagates(OkHttpClientTransportTest.java:1687)
```
2023-01-19 10:51:20 -08:00
yifeizhuang f1f40b0b23
Update README etc to reference 1.52.1 (#9849) 2023-01-19 10:26:16 -08:00
Larry Safran 3cbd948bad
Restore "netty:Auto adjust BDP ping frequency" with fix (#9847)
* Revert "Revert "netty:Auto adjust BDP ping frequency (#9650)" (#9821)"

This reverts commit a2bbe84198.

* Eliminate half RTT delay in sending BDP Pings when starting up.
* Eliminate delay for bdp ping when current read would push us over the threshold.
2023-01-18 18:27:56 -08:00
Alexander Polcyn ecc7cf35a2 Address internal linter suggestions 2023-01-18 13:33:19 -08:00
pandaapo 0f4b767660
core: Add grpc-previous-rpc-attempts to the initial response metadata (#9686)
Fixes #9641
2023-01-17 15:33:45 -08:00
Sergii Tkachenko f2533f4fd8
xds interop: Fix buildscripts not continuing on a failed test suite (#9833)
Apparently there's a difference between bash 3 and bash 4.
OSX comes with bash 3 out-of-box, so for whoever wrote this logic
it "worked on my machine".

The `((` construct returns a 0 exit code if the value is non-zero.
Since the value starts at 0 and we do a post-increment,
it will always fail the first time.
Changing it to a pre-increment should fix it.
2023-01-17 13:15:40 -08:00
Eric Anderson 62d924745d core: Remove unused helper field from SubchannelImpl 2023-01-17 13:06:00 -08:00
Sergii Tkachenko 42ba00ba65
Revert "xds interop: Fix buildscripts not continuing on a failed test suite (#9817)" (#9831)
This reverts commit d83a599c97.

Reverted in favor of better syntax suggested here: https://github.com/grpc/grpc-node/pull/2323#pullrequestreview-1248043432. This fix will be sent as another PR for the convenience of backporting.
2023-01-17 11:36:31 -08:00
Larry Safran ed71b0a520
Update README etc to reference 1.52.0 (#9815) 2023-01-13 12:44:21 -08:00
Sergii Tkachenko d83a599c97
xds interop: Fix buildscripts not continuing on a failed test suite (#9817)
Apparently there's a difference between bash 3 and bash 4.
OSX comes with bash 3 out-of-box, so for whoever wrote this logic
it "worked on my machine".
2023-01-13 12:42:45 -08:00
apolcyn 23d34cdd84
testing: create test client for XDS federation integration tests (#9798)
This client can be used as a part of XDS federation integration tests. It can concurrently perform RPCs with different stubs using different underlying XDS servers.

For example, one might perform proxyless service mesh and DirectPath RPCs in the same process with flags like:

```
--server_uris=xds:///${PSM_TARGET},google-c2p:///${DIRECTPATH_TARGET} \
--credentials_types=INSECURE_CREDENTIALS,compute_engine_channel_creds \
--test_case=rpc_soak \
--soak_iterations=10  \
--soak_max_failures=0  \
--soak_per_iteration_max_acceptable_latency_ms=2500 \
--soak_overall_timeout_seconds=300
```
2023-01-13 11:55:08 -08:00
Eric Anderson 89b823c550 core: Synchronize access to retry's throttle
Use a volatile to publish the value even though it is final. TSAN
ignores the final aspect of a field, which is fair since another thread
may not see the parent's pointer become updated and use a stale value.
The lack of synchronization was clearly against lastServiceConfig's
documentation.

Fixes #9267
2023-01-13 11:19:15 -08:00
Larry Safran a2bbe84198
Revert "netty:Auto adjust BDP ping frequency (#9650)" (#9821)
This reverts commit f5e8459748.
2023-01-13 10:36:03 -08:00
yifeizhuang 2b9bd6cdac
core: delay retriable stream master listener close until all sub streams are closed (#9754)
This helps to prevent retryable stream from using calloptions.executor when it shouldn't, e.g. call is already notified closed. It is done by delaying notifying upper layer (through masterListener).
2023-01-12 14:51:13 -08:00
Eric Anderson ce86090322 xds: Include unknown type in channel logger warning
This makes the log statement more useful and easier to determine whether
this was expected behavior.
2023-01-12 11:04:20 -08:00
yifeizhuang 82ca98f338
xds:fix cancel xds watcher accidentally removes the url (#9809)
Fix a bug. When any of the xds subscribers for a resource has the last watcher cancelled, the bug will accidentally remove that resource type from the map, which make xds stream not accepting response update for that resource type entirely(pass through, no ACK/NACK will send).
2023-01-11 15:33:48 -08:00
Eric Anderson eb391fd66c Bump to Gradle 7.6 and update plugins
As normal, Android versions weren't touched as it tends to be special to
upgrade.

The errorprone plugin handles errorproneJavac for us now, since it
hasn't changed in five years. VERSION_CATALOGS is already enabled by
default and graduated out of preview.

Fixes #9802
2023-01-11 08:17:17 -08:00
Eric Anderson ec5bc6b1eb Drop Bazel 4 support
Bazel 6 has been released, and we track the two most recent major
versions.
2023-01-11 08:15:47 -08:00
Stefan Puhlmann 56a4186f0a Testing that Netty clients fail for mismatching TLS common names
Netty is known to not use SSL hostname verfication by default[1], although
this is enabled for gRPC channels. This change validates that
functionality by porting a test with a similar purpuse for OkHttp.

* [1]: https://github.com/netty/netty/issues/8537
2023-01-10 09:11:29 -08:00
yifeizhuang 45554def76
interop test: fix project evaluation order (#9800) 2023-01-09 15:49:07 -08:00
Eric Anderson d761fc6db9 okhttp: Remove unnecessary client certs in TlsTest
This simplifies the tests and makes them more clear. basicTls_succeeds
was added to confirm excluding the client cert functions.
2023-01-09 14:57:25 -08:00
Eric Anderson a40e4343f5 okhttp: Use normal server cert when testing trust checking
Previously, untrustedServer_fails could have been failing for the same
reason as unmatchedServerSubjectAlternativeNames_fails. The
implementation could have been broken and not checking the cert chain
but still checking the hostname. We'd either need to override the
authority to match the badserver cert or use the normal server
certificates. It is best to use the normal server certificates as
mtls_succeeds confirms the configuration is correct and so our test is
failing for the right reason.
2023-01-09 10:28:35 -08:00
Chris Povirk c0de130ac6 Change ArgumentCaptor.forClass(null) to ArgumentCaptor.forClass(Foo.class)
The former will [soon throw NullPointerException][notnull].

[notnull]: fe1cb2de09 (diff-8d274a9bda2d871524d15bbfcd6272bd893a47e6b1a0b460d82a8845615f26daR31)
2023-01-09 07:15:23 -08:00
Eric Anderson cc5378453f
api: Early-detect null bytes from Metadata.Marshaller
See #9706
2023-01-05 17:36:24 -08:00
Eric Anderson d17a2db4bd Upgrade to Checkstyle 8.28
Trying to upgrade Gradle to 7.6 improved the checkstyle plugin such that
it appears to have been running in new occasions. That in turn exposed
us to https://github.com/checkstyle/checkstyle/issues/5088. That bug was
fixed in 8.28, which also fixed lots of other bugs. So now we have
better checking and some existing volations needed fixing. Since the
code style fixes generated a lot of noise, this is a pre-fix to reduce
the size of a Gradle upgrade.

I did not upgrade past 8.28 because at some point some other bugs were
introduced, in particular with the Indentation module. I chose the
oldest version that had the particular bug impacting me fixed. Upgrading
to this old-but-newer version still makes it easier to upgrade to a
newer version in the future.
2023-01-05 17:07:04 -08:00
yifeizhuang d07ecbe037
xds: refactor LoadReportClient with xds v2 dropped (#9788) 2023-01-05 12:49:23 -08:00
Sergii Tkachenko 040e2831e4
xds: fix the EDS dups test so it doesn't assume address order (#9786) 2023-01-04 10:47:07 -08:00
panxuefeng f40231e147
buildscripts: Enhancement for LoongArch64 (#9778) 2023-01-04 09:11:23 -08:00
Sergii Tkachenko f4cda008ee
buildscripts: drop xDS v2 interop test (#9783)
This disables xDS v2 support interop test.
xDS v2 support dropped in https://github.com/grpc/grpc-java/pull/9760.

Internal ref cl/499306755
2023-01-03 15:37:12 -08:00
Eric Anderson f0614e5a76 bazel: Export deps from maven stand-in targets
If an artifact on Maven Central exposes a type from gRPC on its API
surface, then consumers of that artifact need that gRPC API in the
compile classpath. Bazel handles this by making hjars for transitive
dependencies, but if the dependencies are runtime_deps then Bazel won't
generate hjars containing the needed symbols.

We don't export netty-shaded because the classes already don't match
Maven Central. If an artifact on Maven Central is exposing a
netty-shaded class on its API surface, it wouldn't work anyway since the
class simply doesn't exist for the Bazel build.

Fixes #9772
2023-01-03 13:36:27 -08:00
Larry Safran 51ee3eb6ab
xds: Disallow duplicate addresses in the RingHashLB. (#9776)
* xds: Disallow duplicate addresses in the RingHashLB.
Removed test that was previously checking for specific expected behavior with duplicate addresses.
2023-01-03 13:11:46 -08:00
yifeizhuang 3c5c2be712
xds: drop xds v2 support (#9760) 2022-12-28 10:35:44 -08:00
Larry Safran f5e8459748
netty:Auto adjust BDP ping frequency (#9650)
* netty:Auto adjust BDP ping frequency

* Change setDataSizeAndSincePing to set time to current time rather than 1 second (or nanosecond) previous.
2022-12-21 18:00:06 -08:00
Ashitha Santhosh 0194ae9a41
Static authorization server interceptor implementation (#8934)
* Static authorization server interceptor implementation

* Resolving comments

* Remove RbacParser file

* update error logs

* checkstyle fixes

* Add InternalRbacFilter

* formatting

* javadoc

* format test file

* resolving comments

* minor formatting

* Update comment
2022-12-21 15:30:42 -08:00
Larry Safran 530cf905b1
xds:Fix test flakiness by adding a timeout to verify. (#9771)
* xds:Fix test flakiness by adding a timeout to verify.
* Add a note warning about multiple threads in the test.
2022-12-21 14:29:17 -08:00
Larry Safran fe19152108
Eds weight allowed between max signed and max unsigned int (#9765)
* Enforce individual weights and sum of weights not exceeding the max unsigned int value
2022-12-20 13:07:10 -08:00
Eric Anderson 7c73baa450 Revert "Move name resolution retry from managed channel to name resolver. (#9758)"
This reverts commit 43bc578f20. It breaks
API without stair-stepping and needs to be tweaked architecturally.
2022-12-20 08:35:31 -08:00
Eric Anderson f08300e0e3 bazel: Include `@Generated` dep for autovalue
Fixes #9755
2022-12-19 19:51:29 -05:00
Kun Zhang 6adae08597
test: fix internal ErrorProne failure (#9761) 2022-12-19 12:54:24 -08:00
Terry Wilson 43bc578f20
Move name resolution retry from managed channel to name resolver. (#9758)
This change has these main aspects to it:

1. Removal of any name resolution responsibility from ManagedChannelImpl
2. Creation of a new RetryScheduler to own generic retry logic
     - Can also be used outside the name resolution context
3. Creation of a new RetryingNameScheduler that can be used to wrap any
   polling name resolver to add retry capability
4. A new facility in NameResolver to allow implementations to notify
   listeners on the success of name resolution attempts
     - RetryingNameScheduler relies on this
2022-12-16 15:30:57 -08:00
Larry Safran 46ed02ed72
xds:Update logic to match A57 (#9745)
* xds:Change timer creation logic to wait until the adsStream is ready before creating the timer to mark resources absent.

* xds:When the ads stream is closed only send errors to subscribers that haven't yet gotten results to match spec.

* Use a blocking queue to avoid the 2-second sleep.
For some inexplicable reason the following call.verifyRequest fails only for the V2 test and only from command line not IDE unless there is some Thread.sleep, even if it is only 1-millis.
2022-12-15 14:54:35 -08:00
Larry Safran ccb5d945c0
Start 1.53.0 development cycle (#9757) 2022-12-14 18:07:57 -08:00
Greg e325dc9112
Replace ctx.host_configuration.host_path_separator with ctx.configuration.host_path_separator. (#9742)
Replace ctx.host_configuration.host_path_separator with ctx.configuration.host_path_separator.

This is because

1. we're removing ctx.host_configuration
2. host_path_separator's value doesn't depend on the configuration (the API is misleading by embedding it under ctx.configuration). So this is a no-op.

Internal ref cl/494008561.
2022-12-14 12:13:31 -08:00
yifeizhuang 2a0b86f7cd
binder: BinderInternal.setIBinder() is public static (#9743) 2022-12-09 15:21:47 -08:00
yifeizhuang 9b5ca70f85
doc: add fake control plane xds test comments (#9735) 2022-12-07 14:53:06 -08:00
yifeizhuang 786417085c
xds: Nack xds response when weighted cluster total weight sums zero (#9738) 2022-12-07 13:16:21 -08:00
Mohan Li bf0b92a963
Log xDS node ID with verbosity INFO (#9731)
Log xDS node ID so that we can better debug DirectPath issues.

b/260634412
2022-12-06 08:06:00 -08:00
Larry Safran e14cba0bae
Update clarifying comment per code review. (#9730) 2022-12-02 16:04:17 -08:00
Larry Safran 3e5fa7c5df
xds:Fix ConcurrentModificationException in PriorityLoadBalancer (#9728)
Fix ConcurrentModificationException in PriorityLoadBalancer by making copy of children values to iterate rather than directly using children in for loop.
2022-12-02 15:15:48 -08:00
Eric Anderson 79f4411d20 xds: Remove outdated comment about observing total weight
total_weight is deprecated and serves no value.
2022-12-02 15:09:21 -08:00