Commit Graph

1658 Commits

Author SHA1 Message Date
Sergii Tkachenko b571f23ad2
core: Inline AbstractServerImplBuilder 2020-09-18 16:31:08 -04:00
Chengyuan Zhang bf7a42dbd1
api, core: delete io.grpc.LoadBalancer.loadBalancingConfig attribute (#7440) 2020-09-18 12:54:48 -07:00
Chengyuan Zhang 80f6d874cf
core: lint remove redundant field (#7433) 2020-09-16 15:32:20 -07:00
Sergii Tkachenko d5dcfa737a
all: remove deprecated internal OverrideAuthorityChecker 2020-09-11 19:14:25 -04:00
Sergii Tkachenko b927278f22 core: cleanup AbstractManagedChannelImplBuilderTest 2020-09-11 17:07:45 -04:00
ZHANG Dapeng 234125ee39
core: re-organize RealChannel with updateConfigSelector()
As mentioned in https://github.com/grpc/grpc-java/pull/7413#issuecomment-690756200 `RealChannel` did not manage `configSelector`, and therefore `configSelector.get()`, `configSelector.set()` and `drainPendingCalls()` were scattered everywhere in `ManagedChannelImpl`. This PR re-organizes `RealChannel` to manage `configSelector`.
2020-09-11 09:35:18 -07:00
ZHANG Dapeng 73dd3672fc
core: fix drainPendingCalls might be called twice
Fixing the bug: if two consecutive name resolution updates are queued together in SynchronizationContext, drainPendingCalls() might be called twice and be broken.
2020-09-10 15:11:19 -07:00
ZHANG Dapeng f3a1a3ff10
core: refactor handle config update with ConfigSelector
Get rid of `ServiceConfigInterceptor` and handle config update with `ConfigSelector` inside `ClientCallImpl`.
2020-09-10 10:32:46 -07:00
ZHANG Dapeng 1411e6f61e
core: fix pending call not drained when shutdown
There was bug that new pending calls were not drained after channel is shutdown. The bug was worked around by #7354 .

Fixing by making sure new calls fail immediately if the channel is already shutdown.
2020-09-09 17:47:10 -07:00
Sergii Tkachenko b03f148ed9 core, netty: server builders extend a public API class 2020-09-03 16:26:04 -04:00
Sergii Tkachenko 07b812b1f5 api, core: create ForwardingServerBuilder and ServerImplBuilder 2020-09-03 16:26:04 -04:00
Sergii Tkachenko c29ad76dae Explain test value for flow control window 2020-09-02 14:51:39 -04:00
Sergii Tkachenko b0f0ed080e core: InProcessChannelBuilder extends a public API class 2020-09-02 13:28:52 -04:00
Sergii Tkachenko c7f876d016 core: add default implementation of managed channel builder 2020-09-02 13:28:52 -04:00
ZHANG Dapeng 09367030ae
all: fix lint 2020-08-28 13:00:44 -07:00
ZHANG Dapeng 24a1095fd8
core: refactor to delete RetryPolicy.DEFAULT
We used `null` and `RetryPolicy.DEFAULT` for the value of `retryPolicy` in `RetriableStream` to distinguish the state between name resolution not being completed and name resolution being completed but no retry policy. After the change #7259 , name resolution is always completed when creating a `RetriableStream`, so the distinction will be gone. It will be cleaner to get rid of `RetryPolicy.DEFAULT` and simply use `null` for absence of RetryPolicy. `RetryPolicy.Provider` will be deleted in upcoming PR.
2020-08-26 22:22:25 -07:00
Eric Anderson eca8bf8e62 Start 1.33.0 development cycle 2020-08-26 16:13:21 -07:00
Chengyuan Zhang c30505df04
core, alts, cronet: fix ByteBuffer covariant method usages (#7349)
Java 9 introduces overridden methods with covariant return types for the following methods in java.nio.ByteBuffer:

- position​(int newPosition)
- limit​(int newLimit)
- flip​()
- clear​()
- mark​()
- reset​()
- rewind​()

In Java 9 they all now return ByteBuffer, whereas the methods they override return Buffer, resulting in exceptions like this when executing on Java 8 and lower:

java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer

This is because the generated byte code includes the static return type of the method, which is not found on Java 8 and lower because the overloaded methods with covariant return types don't exist (the issue appears even with source and target 8 or lower in compilation parameters).
The solution is to cast ByteBuffer instances to Buffer before calling the method.
2020-08-25 17:21:34 -07:00
ZHANG Dapeng f36f0e9046
core: disable usage of PendingCall due to a bug
#7259 failed internally and there seems to be a bug. Temporarily disable PendingCall.
2020-08-24 10:13:14 -07:00
ZHANG Dapeng 50d8be70b0
core: use DelayedClientCall for awaiting configSelector in ManangedChannelImpl
ManagedChannelImpl.newCall() will return a DelayedClientCall until the name resolver updates the configSelector reference.

The configSelector follows the same service config error handling rules.

Made the following assumption:
If there is no service config in resolution result, then there must be no config selector in the resolution result. Actually we ignore any config selector in the resolution result if there is no service config.
2020-08-21 12:44:14 -07:00
ZHANG Dapeng a91acec2d4
core: fix a bug for hedging with throttling (#7337)
Resolves #7222: If a hedging substream fails triggering throttling threshold, the call should be committed.

Refactored RetryPlan to two separate classes RetryPlan and HedgingPlan.
2020-08-18 23:12:25 -07:00
Eric Anderson 676e5d2509 core: Remove unused mocks 2020-08-11 14:30:20 -07:00
Eric Anderson 020fb36753 Fix lint warnings 2020-08-07 14:49:50 -05:00
Eric Anderson e92b2275f9 Update to Error Prone 2.4
Most of the changes should be semi-clear why they were made. However, BadImport
may not be as obvious: https://errorprone.info/bugpattern/BadImport . That
impacted classes named Type, Entry, and Factory. Also
PublicContructorForAbstractClass:
https://errorprone.info/bugpattern/PublicConstructorForAbstractClass

The JdkObsolete issue is already resolved but is not yet in a release.
2020-08-06 10:56:16 -05:00
Eric Anderson 80d62bfce2 Upgrade to Mockito 3.3.3
verifyZeroInteractions has the same behavior as verifyNoMoreInteractions. It
was deprecated in Mockito 3.0.1 and replaced with verifyNoInteractions, which
does not change behavior depending on previous verify() calls. All instances
were replaced with verifyNoInteractions, except those in
ApplicationThreadDeframerTest which were replaced with verifyNoMoreInteractions
since there is a verify() call in `@Before`.
2020-08-06 10:49:23 -05:00
ZHANG Dapeng afcce8d3c0
core: Add DelayedClientCall
Adding `DelayedClientCall` in preparation of implementing `ConfigSelector` in core. 

`DelayedClientCall` is implemented exactly in the same way as `DelayedStream`. Only added logic to monitor initial DEADLINE. Note that `ClientCall.cancel()` is not thread-safe and will cause exceptions if trying to start call after it, which is different from in the stream where cancel() is thread-safe and wouldn't trigger any checkState()s. The initial DEADLINE monitor should not call `ClientCall.cancel()` directly.
2020-08-04 16:54:34 -07:00
ZHANG Dapeng 6ec9387cbc
core: refactor ClientTransportProvider to ClientStreamProvider
Replace the two APIs of ClientCallImpl.ClientTransportProvider with a single API: newStream().
2020-07-24 09:40:53 -07:00
Eric Gribkoff 7d97443cd7
Start 1.32.0 development cycle (#7214) 2020-07-15 13:51:06 -07:00
Eric Anderson 3224c21afa core: Hide Javadoc for Internal* in-process transport classes
The first such class was added in fd5f4aac6.
2020-07-13 15:51:12 -05:00
ZHANG Dapeng 791b48e79d
Revert "core: Fix migrating deframer compatibility with RetriableStream"
This reverts commit bcb287b in #7195.
2020-07-10 08:43:30 -07:00
Eric Anderson bcb287bb15 core: Fix migrating deframer compatibility with RetriableStream
Fixes #7168
2020-07-09 16:46:00 -05:00
Eric Anderson 825c34f606 core: Delay client listener exception notification until normal close
This should avoid messages being leaked when a Listener throws an exception and
the executor is shut down immediately after the call completes. This is related
to #7105 but a different scenario and we aren't aware of any user having
observed the previous behavior.

Note also this does _not_ fix the similar case of reordering caused by
delayedCancelOnDeadlineExceeded().
2020-07-09 12:20:41 -05:00
Jihun Cho c6bd97245c
core: disable MigratingThreadDeframer (#7177) 2020-07-01 15:39:13 -07:00
Eric Anderson 2dab629a0a api: Deprecate ManagedChannelBuilder.nameResolverFactory
It has been our intention for years to remove nameResolverFactory. We should
make it clear to users to avoid new code depending on it and so they can tell
us why they need it so we can provide replacements.
2020-06-30 14:34:35 -05:00
Jihun Cho be79f55079
core: add PerfMark tasks/events for MigratingThreadDeframer (#7146) 2020-06-23 16:09:51 -07:00
Eric Anderson 295d927d8b core: Add migrating deframer
This provides a substantial ~3x performance increase to Netty async
streaming with small messages. It also increases OkHttp performance for
the same benchmark 40% and decreases unary latency by 3µs for Netty and
10µs for OkHttp.

We avoid calling listener after closure because the Executor used for
RPC callbacks may no longer be available. This issue was already
present in the ApplicationThreadDeframer, but full-stream compression is
not really deployed so was unnoticed.

DirectExecutor saw a 5-6µs latency increase via MigratingDeframer.
DirectExecutor usages should see no benefit from MigratingDeframer, so
disable it in that case.
2020-06-18 15:48:29 -05:00
Jihun Cho f5258dca17
api,core: add LoadBalancer.Helper#createResolvingOobChannelBuilder api (#7136) 2020-06-17 12:36:14 -07:00
Anar Sultanov 1a42c8aea1
core: Catch uncaught exceptions in ServerImpl
A cleanup regarding #6162
2020-06-16 11:29:40 -07:00
ZHANG Dapeng 959769aad8
core: always propagate RetriableStream.Sublistener.onReady()
This fixes #6817 for the normal retry case, although it makes the hedging issue #7089 more broken, and there is still space of optimization for normal retry.
2020-06-04 13:35:51 -07:00
Elliotte Rusty Harold 417d7700dd
deps: Update guava to 29.0 (#7079) 2020-06-03 13:48:02 -07:00
Chengyuan Zhang 683eed671e
core: turn Channel into TF if resolver gives empty addresses with policy selection cannot handle it (#7073)
The original service config error handling design was unclear about the case when an updated resolution result with valid service config and empty address is returned to Channel, and the selected LB policy does not accept empty addresses. Existing implementation silently triggers resolver backoff after LB policy is changed, while leaving Channel being CONNECTING state, if there was an old service config resolved. This change converge the behaviors of whether the received service config is the first one or an update to a previous config, in both cases, Channel goes into TRANSIENT_FAILURE if the selected LB policy cannot handle empty addresses.
2020-05-29 18:23:37 -07:00
Jihun Cho 7d2d2ec035
core: fix PerfMark task mismatch (#7069) 2020-05-27 12:16:57 -07:00
Chengyuan Zhang d667a67d15
Start 1.31.0 development cycle (#7050) 2020-05-19 16:46:16 -07:00
Eric Anderson b1ca6e8d27 Automate release process for example-hostname 2020-05-12 14:30:27 -07:00
Jihun Cho 6cde3b220b
all: fix lint warnings (#7016) 2020-05-07 15:43:53 -07:00
Reginald McDonald 16b6145064
inprocess,core: add ability to pass status cause to client
Closes #5439
2020-05-06 11:08:15 -07:00
ZHANG Dapeng 0044f8ce56
all: migrate gradle build to java-library plugin
- Use gradle configuration `api` for dependencies that are part of grpc public api signatures.
- Replace deprecated gradle configurations `compile`, `testCompile`, `runtime` and `testRuntime`.
- With minimal change in dependencies: If we need dep X and Y to compile our code, and if X transitively depends on Y, then our build would still pass even if we only include X as `compile`/`implementation` dependency for our project. Ideally we should include both X and Y explicitly as `implementation` dependency for our project, but in this PR we don't add the missing Y if it is previously missing.
2020-05-04 16:44:30 -07:00
ZHANG Dapeng ce9d217920
all: introduce gradle util functions to manage guava dependency
Define util function to exclude guava's transitive dependencies jsr305 and animal-sniffer-annotations, and always manually add them as runtimeOnly dependency. error_prone_annotations is an exception: It is also excluded but manually added not as runtimeOnly. It must always compile with guava, otherwise users will see warning spams if guava is in the compile classpath but error_prone_annotations is not.
2020-05-01 22:59:28 -07:00
Jihun Cho 50a829ad9d
rls: caching rls client (#6966) 2020-05-01 12:02:05 -07:00
Chengyuan Zhang a423900491
api, core, services: make ProtoReflectionService interceptor compatible (#6967)
Eliminate the hack of InternalNotifyOnBuild mechanism for letting ProtoReflectionService get access to the Sever instance, which makes ProtoReflectionService incompatible with server interceptors. This change put the Server instance into the Context and let the ProtoReflectionService RPC obtain it in its RPC Context. Also enhanced ProtoReflectionService so that one service instance can be used across multiple servers.
2020-05-01 10:39:38 -07:00