Commit Graph

3360 Commits

Author SHA1 Message Date
Nick Hill c8ffa8a8db benchmarks: Use correct ELG type for TransportBenchmark NETTY_LOCAL test (#5492)
Netty LocalChannels are meant to be used with the DefaultEventLoopGroup, but the gRPC channel/server builders use NioEventLoopGroups by default.
2019-03-25 10:22:29 -07:00
Carl Mastrangelo f4a31ec62d
core: deprecate NR.L and add NR.Results 2019-03-22 16:38:28 -07:00
apolcyn 1eb6fc523e interop-testing: implement compute engine channel creds test case in Java 2019-03-21 10:34:51 -07:00
ZHANG Dapeng a2cda8d15d
all: fix lint 2019-03-20 09:01:25 -07:00
Tim van der Lippe d35fbd7eee all: Update to Mockito 2
This is the public port of cl/238445847

Fixes #5319
2019-03-19 14:17:52 -07:00
Carl Mastrangelo c6b505229c
all: move LB parsing logic into LB.Factory 2019-03-19 13:33:13 -07:00
Carl Mastrangelo 6b4a3796a6
core: change DNS error handling to fail on all invalid configs 2019-03-19 09:22:02 -07:00
Fabio Kung 7df2d5feeb netty: default grace time for RPCs can leak memory
Using Long.MAX_VALUE as the delay for Netty's NioEventLoop#schedule can
cause (long) deadlines for scheduled tasks to wrap into negative values,
which is unspecified behavior. Recent versions of netty are guarding
against overflows, but not all versions of grpc-java are using a recent
enough netty.

When connections are gracefully closed, Netty's Http2ConnectionHandler
sets up a timeout task forcing resources to be freed after a grace
period. When their deadlines wrap into negative values, a race was
observed in production systems (with grpc-java <= 1.12.1) causing Netty
to never properly release buffers associated with active streams in the
connection being (gracefully) closed.
2019-03-18 12:38:54 -07:00
Derek Perez e0477bb6e6 bazel: Bazel services + grpc_proto dependency 2019-03-15 11:43:13 -07:00
ZHANG Dapeng 1735adc4c0
core: channelBuilder.defaulServiceConfig() and lookUpServiceConfig() 2019-03-14 16:57:16 -07:00
Jiangtao Li 185cf3d047
alts: add ComputeEngineChannelBuilder to interop test (#5475)
* alts: add ComputeEngineChannelBuilder to interop test

* alts: rename to compute_engine_channel_creds
2019-03-13 18:50:08 -07:00
ZHANG Dapeng 283f04983b
core: reorder code in NameResolver.Listener.onAddress() 2019-03-13 16:54:10 -07:00
Chengyuan Zhang 60e988dc20
COMPILING.md: Update documentation to disable shared lib in compiling protobuf. (#5470) 2019-03-13 12:44:36 -07:00
Eric Anderson e7a635d882
buildscripts: Update protoc-artifacts to 3.7.0
This was missed from d7e53e871

Also added missing --tmpdir, to avoid extracting protobuf
into the current directory.
2019-03-13 13:43:21 -06:00
Jiangtao Li b4af5ad986
ALTS: add ComputeEngineChannelBuilder (#5473) 2019-03-13 12:42:21 -07:00
Dan Torrey f155d60e75 examples: Add a missing space in comment (#5472)
Add a missing space in the comment before requestStream.setOnReadyHandler()
2019-03-13 10:27:15 -07:00
ZHANG Dapeng bd77e886d5
doc: s/<string>/<strong>/ in javadoc 2019-03-12 13:46:13 -07:00
Eric Anderson d7e53e871b
Merge pull request #5454 from ejona86/protobuf-3.7.0
Upgrade to Protobuf 3.7.0
2019-03-11 15:39:50 -06:00
Eric Anderson 57e94d19ea core: Document grpc does not perform compression nego on client 2019-03-11 15:36:21 -06:00
Eric Anderson 656dcc1c7c core,stub: Document grpc performs compression nego on server 2019-03-11 15:36:21 -06:00
ZHANG Dapeng 97ff7fe50a
core: fix thread safety in NameResolver.Listener 2019-03-11 14:35:49 -07:00
Jihun Cho 5ba6619ce5
all: fix lint error (#5464) 2019-03-11 13:58:37 -07:00
Jihun Cho b6d7f6e84f
all: fix lint errors (#5462) 2019-03-11 10:52:12 -07:00
Jihun Cho 4e289de5e6
bom: fix wrong artifact for grpc-compiler (protoc-gen-grpc-java) (#5455) 2019-03-11 10:04:23 -07:00
Brendan Linn 3c24dc6fe1 grpc_java_repositories: fix com_google_protobuf_javalite sha256.
curl -sL 384989534b.zip | shasum -a 256
gives 79d102c61e2a479a0b7e5fc167bcfaa4832a0c6aad4a75fa7da0480564931bcc.
2019-03-10 20:20:14 -06:00
Carl Mastrangelo 0c23735cfc
core: separate service config parsing and add NR.Helper method 2019-03-10 15:36:34 -07:00
Jihun Cho aed4e40b60
netty: bump netty version to 4.1.34.Final (#5449) 2019-03-08 15:58:48 -08:00
Kun Zhang f095926d2c
core: stop catching exceptions from NameResolver.start() (#5452)
It's not supposed to throw. Any exception from it should be considered
a bug and deserves a panic.
2019-03-08 15:21:36 -08:00
Carl Mastrangelo e5e01b5169
core,grpclb: use better generics on service config 2019-03-08 14:11:13 -08:00
Carl Mastrangelo cbec70ab93
grpclb: fix lint 2019-03-07 21:17:49 -08:00
Eric Anderson c63752789e java_grpc_library.bzl: Pre-migrate for Bazel incompatible_use_toolchain_providers_in_java_common
This doesn't actually yet work with
--incompatible_use_toolchain_providers_in_java_common, as Bazel 0.23 didn't
include enough pieces. But this will work in 0.24 with the flag flipped. In
both cases it will continue working if the flag is not specified.

See https://github.com/grpc/grpc-java/issues/5383#issuecomment-470357965 and
https://github.com/bazelbuild/bazel/issues/7186
2019-03-07 18:09:53 -07:00
Eric Anderson 2dc00cec4a SECURITY.md: Fix syntax and typos in mutual TLS interceptor example
Fixes #4905
2019-03-07 16:53:34 -07:00
Kun Zhang 04f8d06147
grpclb: use fallback addresses if no balancer address is given (#5445) 2019-03-07 15:39:45 -08:00
Kun Zhang 034675e555
grpclb: keep track of state updates for cached Subchannels. (#5441)
The problem: GrpclbState tracks Subchannels' states as a mutable
attribute in Subchannel.getAttributes(). However, GrpclbState only
update this attribute for the Subchannels its managing. For those
cached in SubchannelPool, their state attributes are stale. When they
are given back to GrpclbState, IDLE state is assumed.  As a result, if
a Subchannel is READY when it's reclaimed from the pool, it will not
be picked.

To fix that, this change expands SubchannelPool interface to handle
Subchannel state updates, which GrpclbState will call. SubchannelPool
saves the latest state and delivers it when it's returned to
GrpclbState by scheduling a call to handleSubchannelState() in the
SynchronizationContext, so that GrpclbState will take the latest state
as if it was just reported from the Channel.
2019-03-07 13:14:21 -08:00
Carl Mastrangelo 6b0325c84f
core: normalize log statement callsite
Make the "logged" method be consistent, and refer to the public logging class name and method.  This makes the log statements return the same class name used to set the log level.  

Before:

```
190306 13:29:39.290:D 1 [io.grpc.internal.ChannelTracer.logOnly] [Channel<1>: (localhost:10000)] Channel for 'localhost:10000' created
190306 13:29:39.414:D 1 [io.grpc.internal.ChannelTracer.logOnly] [Channel<1>: (localhost:10000)] Exiting idle mode
190306 13:29:39.622:D 17 [io.grpc.internal.ChannelTracer.logOnly] [Channel<1>: (localhost:10000)] Resolved address: [[[/127.0.0.1:10000]/{}]], config={}
190306 13:29:39.623:D 17 [io.grpc.internal.ChannelTracer.logOnly] [Channel<1>: (localhost:10000)] Address resolved: [[[/127.0.0.1:10000]/{}]]
190306 13:29:39.624:D 17 [io.grpc.internal.ChannelTracer.logOnly] [Subchannel<3>] Subchannel for [[[/127.0.0.1:10000]/{}]] created
```

After:

```
190306 13:49:15.654:D 1 [io.grpc.ChannelLogger.log] [Channel<1>: (localhost:10000)] Channel for 'localhost:10000' created
190306 13:49:15.772:D 1 [io.grpc.ChannelLogger.log] [Channel<1>: (localhost:10000)] Exiting idle mode
190306 13:49:15.995:D 18 [io.grpc.ChannelLogger.log] [Channel<1>: (localhost:10000)] Resolved address: [[[/127.0.0.1:10000]/{}]], config={}
190306 13:49:15.995:D 18 [io.grpc.ChannelLogger.log] [Channel<1>: (localhost:10000)] Address resolved: [[[/127.0.0.1:10000]/{}]]
190306 13:49:15.997:D 18 [io.grpc.ChannelLogger.log] [Subchannel<3>] Subchannel for [[[/127.0.0.1:10000]/{}]] created
190306 13:49:15.999:D 18 [io.grpc.ChannelLogger.log] [Channel<1>: (localhost:10000)] Child Subchannel created
```
2019-03-06 15:29:46 -08:00
Kun Zhang 2f50d88678
grpclb: support "pick_first" child policy (#5438)
The PICK_FIRST mode puts all backend addresses in a single Subchannel. There are a few points where it's different from the default ROUND_ROBIN mode:

1. PICK_FIRST doesn't eagerly connect to backends like ROUND_ROBIN does. Instead, it requests for connections when the Subchannel is picked.

2. PICK_FIRST adds tokens to the headers via a different code path (`TokenAttachingTracerFactory`) than ROUND_ROBIN

3. For simple implementation, when the mode is changed by service config when the LoadBalancer is working, we will shut down `GrpclbState` and starts a new one with the new mode. All connections will be closed during the transition. We don't expect this to happen in practice given the specific use case of PICK_FIRST.
2019-03-06 13:02:32 -08:00
AmiDavidW 128409000a examples: add an example of server side compression support 2019-03-06 12:25:57 -08:00
Carl Mastrangelo 5cc71f1de9
netty, core: pass log-only channel logger into transport 2019-03-06 11:49:42 -08:00
Carl Mastrangelo 07d7b99e31
netty: expose methods of ProtocolNegotiationEvent through accessor 2019-03-06 10:59:41 -08:00
Kun Zhang b0bbd7537b
core/grpclb: propagation and parsing of grpclb config (#5419)
Make sure the config for grpclb is passed to the GrpclbLoadBalancer, which will support two child policies -- "round_robin" (default) and "pick_first".

Previously the presence of balancer addresses would dictate "grpclb" policy, despite of the service config. Service config will now take precedence instead.

Implement config parsing logic in GrpclbLoadBalancer. Per offline discussions with @markdroth and @ejona86, we will ignore configuration errors for now. The more appropriate config error handling is upcoming.
2019-03-05 15:39:48 -08:00
Eric Anderson b48b0ac1d4 all: Stop committing generated protobuf messages
This commit swaps to using a Sync task to place generated code in the
src/generated folder instead of the gradle-protobuf-plugin's
generatedFilesBaseDir. This provides much nicer results on failed
builds, and you will no longer see all the generated files deleted.

But at the same time the Sync task makes it easy to only copy the
grpc-generated code. This was not previously done because we were lazy
and using generatedFilesBaseDir, which made it difficult to treat the
services differently from the messages.
2019-03-05 16:28:55 -07:00
ZHANG Dapeng b7dd92e7bb
core: suppress android lint error for javax.naming.*
Resolves #5422
2019-03-05 14:46:38 -08:00
Carl Mastrangelo d833767037
netty: expose some of the reusable handlers in ProtocolNegotiators 2019-03-05 11:29:32 -08:00
Carl Mastrangelo 3ffec383e3
netty: make WaitUntilActiveHandler not check if the channel is active 2019-03-05 10:29:38 -08:00
Liam Miller-Cushon 952a767b9c Rename source jar outputs to avoid conflicts with java_common.compile
More information: https://github.com/bazelbuild/bazel/issues/5824
2019-03-05 08:44:22 -07:00
Carl Mastrangelo 801cc5c189
core,netty,okhttp: propagate the subchannel logger to the transport 2019-03-04 15:16:53 -08:00
Carl Mastrangelo 3bae61e83b
netty: switch plaintext upgrade negotiator to new format 2019-03-04 14:48:28 -08:00
Kun Zhang 2336eb6f57
test: test the header mutation inside newClientStreamTracer() (#5421)
newClientStreamTracer() is called from transport implementations, thus
needs to be tested in AbstractTransportTest.
2019-03-04 13:53:03 -08:00
Kun Zhang a15a3117de
core: deprecate LoadBalancer.Helper#getNameResolverFactory (#5418)
This was added for the potential use case of needing to resolve target
names (of the same scheme as the top-level channel's target's) in the
LoadBalancer.  Now actual use cases come up in xDS that we need to
resolve fully-qualified target strings with arbitrary schemes.  This
method has never been used and won't fit future uses because it's too
restrictive.
2019-03-04 13:37:49 -08:00
Kun Zhang 59a336c3ae
core: add internal transport attribute ATTR_CLIENT_EAG_ATTRS (#5420)
This is needed for GRPCLB pick_first support, which needs to attach
tokens to headers, and the tokens are per server. In pick_first, all
addresses are in a single Subchannel, thus the LoadBalancer needs to
know which backend is used for a new stream.
2019-03-04 12:38:26 -08:00