Commit Graph

1878 Commits

Author SHA1 Message Date
Sergii Tkachenko 17b2df78ec
Start 1.57.0 development cycle (#10229) 2023-05-30 18:02:40 -07:00
Daniel Liu 5a27e3ead2
services, xds, orca: support EPS in client-side WRR (#10177) 2023-05-26 12:52:42 -07:00
Eric Anderson cb42405217 testing: Move some internal classes to testFixtures
These two classes are precisely the purpose of test fixtures. Move them
close to the classes they make easier to use in tests.
2023-05-25 14:03:42 -07:00
Terry Wilson dd2dc21de2
api: Stabilize io.grpc.CallCredentials (#10208) 2023-05-22 09:59:53 -07:00
Eric Anderson 29b8483fd6
Use test fixtures instead of sourceSets.test.output
This avoids the (often missing) evaluationDependsOn and fixes using
results from other projects without propagating those through
Configuration. It also reduces the number of useless classes pulled in
by down-stream tests, reducing the probability of rebuilds.

The expectation of fixtures is they help testing down-stream code that
use the classes in main. That applies to all the classes here except for
FakeClock and StaticTestingClassLoader. It would also apply to many
internal classes in grpc-testing, but let's consider cleaning that up
future work.
2023-05-16 12:10:13 -07:00
Eric Anderson 02a4cb5c69 Fix throwing LBProvider.parseLoadBalancingConfig() impls
LoadBalancers in general should never throw, but
parseLoadBalancingConfig() in particular has a return value to
communicate the error. Throwing can be a bit unpredictable, but at its
most trivial form causes a channel panic. There's no reason to throw
explicitly and calls to JsonUtil have to be protected by a try-catch
because it can throw.
2023-05-10 12:42:05 -07:00
Eric Anderson f229aed538 core: Hide RR's ReadyPicker and EmptyPicker
ReadyPicker hasn't been necessary since 111ff60e, when we stopped
calling super.pickSubchannel(). EmptyPicker was only used in tests, and
we can just compare the class name instead of doing an instanceof check.

Unfortunately, calling getClass() caused Java to start casting the
return value of pickerCaptor.getValue() based on its generics. Captors
don't verify the type they capture, so using any type other than
SubchannelPicker for the pickerCaptor is misleading and hides a cast.
2023-05-09 13:25:19 -07:00
Eric Anderson 847ea7cfc9 Upgrade Mockito to 3.12.4
MockitoAnnotations.initMocks() is deprecated.
2023-05-08 16:39:42 -07:00
Terry Wilson 3c01bfe77f
core: Optional address shuffle in PickFirstLoadBalancer (#10110)
If provided with the new PickFirstLoadBalancerConfig,
PickFirstLoadBalancer will shuffle the list of addresses it receives
from the name resolver.

PickFirstLoadBalancerProvider will now support the new config
if enabled by an env variable.
2023-04-28 15:50:18 -07:00
Terry Wilson fbc8679f7a
core: Sticky TRANSIENT_FAILURE in PickFirstLoadBalancer (#10106)
When the subchannel is transitioning from TRANSIENT_FAILURE to either
IDLE or CONNECTING we will not update the LB state. Additionally, if
the subchannel becomes idle we request a new connection so that the
subchannel will keep on trying to establish a connection.
2023-04-27 15:43:27 -07:00
Eric Anderson 8ca99f661d core: Pass Locality to toLowerCase() in GrpcUtil
We pretty much never want to use the system locality, across all our
code.
2023-04-24 10:53:12 -07:00
Eric Anderson 27edab007d Start 1.56.0 development cycle 2023-04-21 15:56:00 -07:00
Larry Safran 7255c8dfa8
retries:Remove early commit for transparent retries with none remaining. (#10066)
* retries:Remove early commit for transparent retries when no retries or no hedging remain.

Fixes #10011
2023-04-19 13:42:59 -07:00
Carl Mastrangelo 4e3ee4471e
all: use PerfMark.traceTask (#9950)
* all: use PerfMark.traceTask

* make linter happy
2023-04-18 10:46:54 -07:00
yifeizhuang 14ba959545
census: add delayed name resolution tracing annotation (#10044) 2023-04-14 11:44:50 -07:00
Terry Wilson f2b976266e Revert "core: ForwardingLoadBalancer to forward acceptResolvedAddresses() (#10050)"
This reverts commit 086edf0f20.
2023-04-14 10:12:33 -07:00
Terry Wilson 086edf0f20
core: ForwardingLoadBalancer to forward acceptResolvedAddresses() (#10050) 2023-04-13 18:23:11 -07:00
yifeizhuang fc4410f159
api, census: add new pendingStreamCreated on clientStreamTracer and new tracer annotation (#10014) 2023-04-11 13:49:33 -07:00
Eric Anderson 8d98e5ff7f core: Fix NPE race during hedging
The problem was one hedge was committed before another had drained
start(). This was not testable because HedgingRunnable checks whether
scheduledHedgingRef is cancelled, which is racy, but there's no way to
deterministically trigger either race.

The same problem couldn't be triggered with retries because only one
attempt will be draining at a time. Retries with cancellation also
couldn't trigger it, for the surprising reason that the noop stream used
in cancel() wasn't considered drained.

This commit marks the noop stream as drained with cancel(), which allows
memory to be garbage collected sooner and exposes the race for tests.
That then showed the stream as hanging, because inFlightSubStreams
wasn't being decremented.

Fixes #9185
2023-04-11 13:10:41 -07:00
Terry Wilson 3332199106
Start 1.55.0 development cycle (#9939) 2023-03-07 18:14:31 -08:00
Benjamin Peterson 4b6853b6dd
errorprone: enable UnnecessaryAnonymousClass (#9927)
The Java 7 compatibility rationale no longer holds.
2023-03-03 15:16:17 -08:00
Benjamin Peterson ae6c506f96
all: fix build with errorprone 2.18 (#9886)
errorprone cannot be updated past 2.10 because later versions do not support Java 8.

Fixes https://github.com/grpc/grpc-java/issues/9916.
2023-03-01 13:45:18 -08:00
yifeizhuang 8d12baa447
xds: add weighted round robin LB policy support (#9873) 2023-02-27 10:34:51 -08:00
Sergey Matyukevich 67d6600f71
core: add logger to OutlierDetectionLoadBalancer (#9880) 2023-02-14 13:27:21 -08:00
yifeizhuang 3d4d46d9ff
Revert "core: add subchannel list LB commons utility function, refactor for WRR (#9875)" (#9892)
This reverts commit 5a2adcc7c6.
2023-02-13 17:28:24 -08:00
Terry Wilson d42678a3bf
core: fix outlier detection default ejection time (#9889) 2023-02-13 14:40:31 -08:00
Terry Wilson fcb5c54e4b
Move name resolution retry from managed channel to name resolver (take #2) (#9812)
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
2023-02-03 18:23:32 -08:00
yifeizhuang 5a2adcc7c6
core: add subchannel list LB commons utility function, refactor for WRR (#9875) 2023-02-03 17:53:51 -08:00
Kun Zhang 04afea0fbd
test: new JDK fixed InetSocketAddress toString so we are updating our test (#9876)
The change was introduced in JDK 14 (f8440c33d2) so JDK 17 for us to care about.

Fixes internal issue: b/261217361
2023-02-02 21:35:24 -08:00
yifeizhuang 4876996d84
Start 1.54.0 development cycle (#9857) 2023-01-25 10:56:58 -08:00
Eric Anderson 44847bf4e9
Upgrade JUnit to 4.13.2
ExpectedException is deprecated, so I fixed the new warnings. However,
we are still using ExpectedException many places and had previously
supressed the warning. See
https://github.com/grpc/grpc-java/issues/7467 . I did not fix those
existing instances that had suppressed the warning, since it is
unrelated to the upgrade and we have been free to fix them at any time
since we dropped Java 7.
2023-01-20 09:33:11 -08:00
Eric Anderson 5a2c94bca1 core: Free unused MessageProducer in RetriableStream
This prevents leaking message buffers.

Fixes #9563
2023-01-20 07:48:35 -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
Eric Anderson 62d924745d core: Remove unused helper field from SubchannelImpl 2023-01-17 13:06:00 -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
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
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 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
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
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
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 ccb5d945c0
Start 1.53.0 development cycle (#9757) 2022-12-14 18:07:57 -08:00
Eric Anderson b51cd9fd99
core: Replace AtomicInteger.updateAndGet with compareAndSet
updateAndGet is only available in API level 24+. It is unclear why
AnimalSniffer didn't detect this.

This was noticed when doing the import, but the Android CI has also been
failing because of it.
2022-12-01 11:09:40 -08:00
Larry Safran c145473756
Improve error message when deadline is exceeded, making it clear which deadline (Context or CallOptions) was exceeded and making the grammar clearer. (#9713) 2022-11-30 13:58:57 -08:00
yifeizhuang b593871801
core: fix RejectedExecutionException in Retriable Stream (#9626)
Add big negative integer to pending stream count when cancelled. The count is used to delay closing master listener until streams fully drained.
Increment pending stream count before creating one. The count is also used to indicate callExecutor is safe to be used. New stream will not be created if big negative number was added, i.e. stream cancelled. New stream is created if not cancelled, callExecutor is safe to be used, because cancel will be delayed.
Create new streams (retry, hedging) is moved to the main thread, before callExecutor calls drain.
Minor refactor the masterListener.close() scenario.
2022-11-22 13:04:06 -08:00
RapperCL 096898a46e
ManagedChannelImpl.SubchannelImpl args check bug (#9651)
Previously it could trigger NPE without the string saying which argument
was null.
2022-11-10 16:15:13 -08:00
Sergii Tkachenko eb1e5a11c6 Start 1.52.0 development cycle 2022-11-07 11:56:25 -08:00
Terry Wilson ba182c3e02
core: round_robin to use acceptResolvedAddresses()
Switching to new API to allow eventual deprecation of
handleResolvedAddresses()
2022-11-03 12:40:05 -07:00
yifeizhuang 7007d78b71
doc: improve java doc ManagedChannelOrphanWrapper (#9636) 2022-10-20 11:16:53 -07:00
Eric Anderson 5b62d22802 Start 1.51.0 development cycle 2022-09-26 16:37:56 -07:00