Commit Graph

1632 Commits

Author SHA1 Message Date
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
ZHANG Dapeng e78d1c95ef
core: support default method config in service config (#6987)
References:
service config spec change: grpc/grpc-proto#75
c-core implementation grpc/grpc#22232
2020-04-29 13:53:53 -07:00
Jihun Cho e1a428ab33
core: remove backoff policy todo (#6953) 2020-04-21 09:57:42 -07:00
Jihun Cho 68297d6d7c
core: implement Helper#createResolvingOobChannel (#6923) 2020-04-17 16:07:38 -07:00
Eric Anderson ec010c1a62 core: Delay transport shutdown during updateAddresses()
A user has been seeing "InternalSubchannel closed transport due to address
change" errors (b/153064566). It is unclear if they are predomenent, but they
are at least adding noise. Since #2562 is still far from being generally
solved, we delay the shutdown a while to side-step the race.
2020-04-09 14:59:48 -07:00
ZHANG Dapeng c91e127f93
Start 1.30.0 development cycle 2020-04-07 14:12:53 -07:00
Chengyuan Zhang 8e9ceb5c3f
core: keep round_robin lb subchannel in TRANSIENT_FAILURE until becoming READY (#6657)
Make each subchannel created by RR stay in TRANSIENT_FAILURE state until READY. That is, each subchannel ignores consequent non-READY states after TRANSIENT_FAILURE.
2020-04-06 12:08:04 -07:00
Eric Anderson 2c250ace52 netty: prevent interruption during bind from leaking channel
Fixes #6850
2020-03-27 17:21:22 -07:00
Eric Anderson c7f69c851b core: Add missing setListener if decompressor is unknown
Previously AbstractServerStream would throw an exception which would kill the
RPC with a RST_STREAM. Now the server actually responds with a clean error
message and avoids spamming the logs.

WARNING: Exception in onHeadersRead()
java.lang.IllegalStateException
	at com.google.common.base.Preconditions.checkState(Preconditions.java:495)
	at io.grpc.internal.AbstractStream$TransportState.onStreamAllocated(AbstractStream.java:232)
	at io.grpc.internal.AbstractServerStream$TransportState.onStreamAllocated(AbstractServerStream.java:224)
	at io.grpc.netty.NettyServerHandler.onHeadersRead(NettyServerHandler.java:451)
	at io.grpc.netty.NettyServerHandler.access$900(NettyServerHandler.java:101)
	at io.grpc.netty.NettyServerHandler$FrameListener.onHeadersRead(NettyServerHandler.java:807)
	at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onHeadersRead(DefaultHttp2ConnectionDecoder.java:373)
2020-03-27 12:52:13 -07:00
Kun Zhang 2e3ad1de25
core: prevent data race in ManagedChannelOrphanWrapper (#6854)
Data race was detected internally when
ManagedChannelOrphanWrapper.shutdown() was called concurrently:

WARNING: ThreadSanitizer: data race (pid=5009)
  Write of size 8 at 0x7fd2f7f37530 by thread T49:
    #0 java.lang.ref.Reference.clear()V Reference.java:265
    #1 io.grpc.internal.ManagedChannelOrphanWrapper$ManagedChannelReference.clearInternal()V ManagedChannelOrphanWrapper.java:118
    #2 io.grpc.internal.ManagedChannelOrphanWrapper$ManagedChannelReference.clear()V ManagedChannelOrphanWrapper.java:110
    #3 io.grpc.internal.ManagedChannelOrphanWrapper.shutdown()Lio/grpc/ManagedChannel; ManagedChannelOrphanWrapper.java:58
    (stacktrace redacted)

  Previous write of size 8 at 0x7fd2f7f37530 by thread T45 (mutexes: write M267260296638793720, write M267541771615505864, write M267823246592216728, write M267260296898451984, write M267541771875162784, write M267823246851873416):
    #0 java.lang.ref.Reference.clear()V Reference.java:265
    #1 io.grpc.internal.ManagedChannelOrphanWrapper$ManagedChannelReference.clearInternal()V ManagedChannelOrphanWrapper.java:118
    #2 io.grpc.internal.ManagedChannelOrphanWrapper$ManagedChannelReference.clear()V ManagedChannelOrphanWrapper.java:110
    #3 io.grpc.internal.ManagedChannelOrphanWrapper.shutdown()Lio/grpc/ManagedChannel; ManagedChannelOrphanWrapper.java:58
    (stacktrace redacted)
2020-03-23 18:02:00 -07:00
ZHANG Dapeng 6a64951005
xds: implement XdsRoutingLoadBalancer 2020-03-23 14:42:44 -07:00
ZHANG Dapeng e739eeabf9
core: fix java.nio.ByteBuffer Java 9+ incompatible usage 2020-03-18 16:07:20 -07:00
Kun Zhang 4a2c5d6e9c
core: fix a bug in health check config propgation. (#6804)
The condition "effectiveServiceConfig != validServiceConfig" should
have been deleted in commit 2162ad0436.

The condition was there before that commit because
NAME_RESOLVER_SERVICE_CONFIG was already in "attrs", thus it needed to
be re-added only if "effectiveServiceConfig" differs from the original
"validServiceConfig".

In contrast, ATTR_HEALTH_CHECKING_CONFIG is not in the original
"attrs" and always needs to be added.
2020-03-05 09:27:55 -08:00
ZHANG Dapeng 6d3ffc7892
all: refactor select lb policy from a list of raw configs
Refactor to reuse `PolicySelection` and the implementation in `AutoConfiguredLoadBalancerFactory.parseLoadBalancerPolicy()`.
2020-03-03 11:24:59 -08:00
markb74 fd5f4aac63
Enable use of InProcessTransport outside of InProcessServer
This allows an InProcessTransport instance to be created via a new
internal accessor class InternalInProcess. We effectively just expose a
method to create an InProcessTransport with a existing ServerListener
instance.

This will be used for in-process channels to an under-development
on-device server.
2020-03-02 16:02:17 -08:00
Chengyuan Zhang afc1f2e567
core, grpclb: clean up grpclb specific attributes in core (#6790)
Move ATTR_LB_ADDR_AUTHORITY and ATTR_LB_PROVIDED_BACKEND attributes definition in GrpcAttributes to GrpclbConstants. grpc-alts will have a compile dependency on grpc-grpclb.
2020-03-02 10:27:57 -08:00
Chengyuan Zhang 6a7e47b8a5
core, grpclb: change policy selection strategy for Grpclb policy (take two: move logic of querying SRV into Grpclb's own resolver) (#6723)
Eliminated the code path of resolving Grpclb balancer addresses in grpc-core and moved it into GrpclbNameResolver, which is a subclass of DnsNameResolver. Main changes:

- Slightly changed ResourceResolver and its JNDI implementation. ResourceResolver#resolveSrv(String) returns a list of SrvRecord so that it only parse SRV records and does nothing more. It's gRPC's name resolver's logic to use information parsed from SRV records.

- Created a GrpclbNameResolver class that extends DnsNameResolver. Logic of using information from SRV records to set balancer addresses as ResolutionResult attributes is implemented in GrpclbNameResolver only.

- Refactored DnsNameResolver, mainly the resolveAll(...) method. Logics for resolving backend addresses and service config are modularized into resolveAddresses() and resolveServiceConfig() methods respectively. They are shared implementation for subclasses (i.e., GrpclbNameResolver).
2020-03-02 01:03:25 -08:00
Jihun Cho 8f6ad67429
all: remove deprecated internal attribute NAME_RESOLVER_SERVICE_CONFIG (#6705) 2020-02-28 22:31:53 -08:00
Jihun Cho 0fd4975d4c
rls: add proto and converter (#6743) 2020-02-28 21:41:19 -08:00
Jihun Cho 2162ad0436
service: HealthCheckingLoadBalancerFactory using its own attribute (#6704) 2020-02-28 17:11:20 -08:00
ZHANG Dapeng e29561fbca
core: fix javadoc warnings
Fixes #6755

```
> Task :grpc-core:javadoc
core/src/main/java/io/grpc/util/GracefulSwitchLoadBalancer.java:43: warning - Tag @link: can't find switchTo(Factory) in io.grpc.util.GracefulSwitchLoadBalancer
1 warning
```
2020-02-28 13:07:22 -08:00
Chengyuan Zhang 67397042b9
xds: set disable overprovisioning client feature and user agent in node identifier (#6766)
Add "envoy.lb.does_not_support_overprovisioning" to xDS node identifier client features. Set the new user_agent_name and user_agent_version fields for build version.
2020-02-27 13:19:21 -08:00
Jihun Cho 3e9f3964c4 Start 1.29.0 development cycle 2020-02-26 09:37:27 -08:00
Jihun Cho 659987185f
core: revert stickiness from round robin (#6698) 2020-02-11 10:58:32 -08:00
ZHANG Dapeng 66f08c71b1
core,xds: clean up xds config parsing from service config util 2020-01-31 11:31:48 -08:00
Chengyuan Zhang c0f37e59ab
core, grpclb: change policy selection strategy for Grpclb policy (take one: eliminate special logic for deciding grpclb policy in core) (#6637)
First take for grpclb selection stabilization: 

1. Changed DnsNameResolver to return balancer addresses as a GrpcAttributes.ATTR_LB_ADDRS attribute in ResolutionResult, instead of among the addresses.

2. AutoConfiguredLoadBalancerFactory decides LB policy solely based on parsed service config without looking at resolved addresses. Behavior changes:
  - If no LB policy is specified in service config, default to pick_first, even if there exist balancer addresses (in attributes).
  - If grpclb specified but not available and no other specified policies available, it will fail without fallback to round_robin.

3. GrpclbLoadBalancer populates balancer addresses from ResolvedAddresses's attribute (GrpclbConstants.ATTR_LB_ADDRS) instead of sieving from addresses.
2020-01-31 10:41:43 -08:00
ZHANG Dapeng 1ed538f253
all: log picker when updating balancing state
Let `ManagedChannelImpl` log picker update when updating balancing state.
2020-01-28 09:55:04 -08:00