Commit Graph

3140 Commits

Author SHA1 Message Date
ZHANG Dapeng e9ba65a42e
all: sync tcnative version
The helloworld TLS example can not run properly with the outdated examples/build.gradle.
2018-12-03 13:19:17 -08:00
ZHANG Dapeng 8ecdec73fd
examples: prefer implementation to compile in build.gradle 2018-12-03 10:01:19 -08:00
Venil Noronha 3f4c3f0406 stub: disable exception if onCancelHandler set
This restrains a cancellation Exception when an onCancelHandler
is set in ServerCallStreamObserverImpl.

Signed-off-by: Venil Noronha <veniln@vmware.com>
2018-11-30 18:36:12 -06:00
Arnout Engelen 3dab7aed2f netty: Client-side support for h2c via Upgrade
Fixes #4518
2018-11-30 18:10:27 -06:00
Kun Zhang b5acbedd55
core: record real-time metrics to OpenCensus (updated to 1.18.0) (#5099)
Real-time metrics are total sent/received bytes and messages per
method, and are updated as the events occur rather than at the end of
RPCs.
2018-11-29 16:30:58 -08:00
Kun Zhang 2961857451
core: refactor flags in CensusStatsModule. (#5095)
There are currently three boolean flags, and there will be one more
soon.  Put them all in the top-level class instead of passing them as
arguments on lower levels.
2018-11-28 14:20:40 -08:00
Carl Mastrangelo 81121fd8e4
alts: make sure to always free frame protector 2018-11-28 11:52:27 -08:00
Kun Zhang 98ae834dfa
core: use SynchronizationContext.schedule() for NameResolver refresh (#5089)
This also fixes the bug where NameResolverRefresh is not run from
syncContext if run from ScheduledExecutorService.
2018-11-28 09:42:29 -08:00
Kun Zhang 3ff4790212
core: allow ClientStreamTracer to intercept trailers. (#5088)
This would allow LoadBalancers to intercept trailers which could carry
load information.
2018-11-27 12:47:31 -08:00
ZHANG Dapeng 13c9216ddd
doc: improve javadoc of GrpcServerRule in favor of GrpcCleanupRule 2018-11-27 11:06:18 -08:00
ZHANG Dapeng 3c685062b7
build: if('false') is not equivalent to if(false) in gradle 2018-11-21 15:03:54 -08:00
ZHANG Dapeng 4d80886231
all: exclude internal/testing package from jacoco coverage report 2018-11-21 15:03:13 -08:00
Kun Zhang c8b2cdc023
core/services: test/debug friendlier (#5079)
Raise visibility of AutoConfiguredLoadBalancerFactory as internal
tests need to access it from a different package.

Rename HealthCheckingLoadBalancerFactory.LoadBalancerImpl to
*.HealthCheckingLoadBalancer so that its toString() output is more
informative.
2018-11-21 10:45:18 -08:00
ZHANG Dapeng 0c38d1877a
buildscripts: Add CI for kotlin non-android
- add CI for kotlin non-android
- bump kotlin version to fix kotlin compiler issue on jdk11
- add javax.annotation dep to fix kotlin build on jdk 9 & 11

Fixes #4725
2018-11-20 13:20:45 -08:00
Kun Zhang 268793f321
core: add (de)register() in LoadBalancerRegistry. (#5070) 2018-11-20 12:07:31 -08:00
zpencer 777bbbb121
core: TimeProvider should not assume that the clock never changes (#4883)
We should reflect changes in the system clock.
2018-11-20 11:34:58 -08:00
ZHANG Dapeng 6b15aa9e4e
core: implement hedging 2018-11-20 09:38:01 -08:00
Jihun Cho 1506135333 Start 1.18.0 development cycle 2018-11-19 14:49:35 -08:00
Eric Anderson 033cf21118 core: Explicitly mention MCB.intercept's execution order
New users are much more likely to use MCB to add an interceptor instead
of ClientInterceptors, so may not be aware of the interesting execution
order.
2018-11-19 11:02:44 -08:00
Jihun Cho ab5257504b
core: use fakeClock in MessageDeframer tests to fix flaky test (#5055) 2018-11-14 15:13:10 -08:00
zpencer ea9bdabcb2
services: use Durations.toNanos instead of Duration.getNanos (#5059)
getNanos will return the fractional nanos of the duration, which is
not the same as toNanos for durations larger than 1s.
2018-11-14 10:06:04 -08:00
Kun Zhang 02f0dca8d4
Fix buildifier warnings (#5058) 2018-11-14 07:12:11 -08:00
Kun Zhang 5b87e99622
core: move round-robin to util and include it to hard-coded list (#5057)
This is needed for internal issue b/119247688.

A particular test that runs GRPC Android build in a non-Android
environment failed because RoundRobinLoadBalancerProvider was deleted
by ProGuard but the service-loader META-INF file still referred to it,
causing a loading failure.

This could be fixed by adding RoundRobinLoadBalancerProvider to the
hard-coded list, which is recognized by ProGuard then it will keep the
class.

However, we don't expect anyone to use RoundRobinLoadBalancerProvider
on Android, including the class on Android would increase code size,
which Android apps are sensitive to. Hence we move
RoundRobinLoadBalancerProvider to a different package (util), which is
built as a separate artifact internally which Android users usually
don't depend on. (Note that in open-source util is in the same artifact as core,
which is unfortunately).
2018-11-13 17:06:01 -08:00
Nicholas DiPiazza 7c05127cbc netty: Add to "An established connection was aborted by the software in your host machine" QUIET_ERRORS 2018-11-13 14:13:36 -08:00
Rodrigo Queiro 8481943866 Add missing j2objc dependency to Bazel build
This avoids a warning when building artifacts that depend on Guava.

Fixes #5046.
2018-11-13 13:39:35 -08:00
Jihun Cho b78036daaa
netty: finalize maxMessageSize deprecation in NettyChannelBuilder. (#5054) 2018-11-13 10:59:15 -08:00
ST-DDT 417c41b6cb stub: fix null check in MetadataUtils.
Fixes #5045
2018-11-13 08:35:47 -08:00
Eric Anderson 7a89ce2a90 Lint fixes
Remove unused variables and prefer ArrayDeque to LinkedList. The swap to
Queue from Deque was just to make it more obvious what the usage was,
since the original swap to Deque was to avoid the same LinkedList lint
violation (3d51756d).
2018-11-09 17:15:25 -08:00
Yang Song 09b13fecaa core: Update OpenCensus version to 0.17.0 (#4494) 2018-11-09 16:44:01 -08:00
Eric Anderson 4064123e0b Bump Jetty ALPN to 2.0.9
This adds support for Java 1.8.0_191 and 192
2018-11-09 15:41:30 -08:00
Kun Zhang 31af0657d0
services: cancel health-check when LoadBalancer.shutdown() is called. (#5051)
The health checking balancer won't receive an update about Subchannel
shutdown via handleSubchannelState(), because no more callback will be
called after LoadBalancer.shutdown() is called.
2018-11-09 14:51:36 -08:00
ZHANG Dapeng bff008fbc8
core: Emit bin-headers with unpadded encoding
Following the [grpc PROTOCOL-HTTP2 spec](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md)
"Note that HTTP2 does not allow arbitrary octet sequences for header values so binary header values must be encoded using Base64 as per https://tools.ietf.org/html/rfc4648#section-4. Implementations MUST accept padded and un-padded values and should emit un-padded values. "
2018-11-09 13:39:01 -08:00
Eric Gribkoff cab5966415
okhttp: error in frame handler closes with INTERNAL (#5049) 2018-11-09 08:48:13 -08:00
Kun Zhang 11154074bd
services: HealthCheckingLoadBalancer logs to ChannelLogger (#5042)
Log the event that health check is disabled due to UNIMPLEMENTED as required in the spec:
https://github.com/grpc/proposal/blob/master/A17-client-side-health-checking.md

Also log every Subchannel state change that is affected by health-checking, i.e., the state changes when the raw Subchannel state is READY and health-check is running.

Tracking issue: #4932
2018-11-08 15:16:52 -08:00
Jihun Cho a7196eb311
core: remove I/O from DNS test which caused flaky test (#5044) 2018-11-07 16:00:26 -08:00
Carl Mastrangelo e7e88a9af8
core: narrow SharedResourceHolder types, and make the scheduler unconfigurable 2018-11-07 13:12:21 -08:00
Kun Zhang 21bd098d7b
services: annotate HCRRLBP with RunWith (#5039) 2018-11-07 11:37:26 -08:00
Kun Zhang 6b48eb4e08
core: ChannelLogger (#5024)
Introduce ChannelLogger, which is a utility provided to LoadBalancer implementations (potentially NameResolvers too) for recording events to channel trace. This is immediately required by client-side health checking (#4932, https://github.com/grpc/proposal/blob/master/A17-client-side-health-checking.md) to record an error about disabling health checking. It is also useful for any LoadBalancer implementations to record important information.

ChannelLogger implementation is backed by the internal ChannelTracer/Channelz. Because Channelz limits the number of retained events, and events are lost once the process ends, I have expanded it to also log Java logger. This would provide a "last resort" in cases where there are too many events or off-line investigation is needed. All logs are prefixed with logId so that they can be easily associated with the involved Channel/Subchannel.

To prevent log spamming, the logs are all at FINE level or below so that they are not visible by default. They are logged to ChannelLogger's logger, so that user can have precise control.

There are also more verbose information that may not fit in ChannelTracer, but can be useful for debugging. It's desirable that these logs are associated with logId, but they currently manually include the logId, which is cumbersome and may result in inconsistency. For this use case, I added the DEBUG level for ChannelLogger, which formats the log in the same way as other levels, while not recorded to Channelz.

I have converted most logging and channel tracer recording in the Channel implementation and LoadBalancers.
2018-11-06 16:48:09 -08:00
Jihun Cho 80c973cbd5
okhttp: Optimize memory usage by mergeing buffers (#5023)
okhttp: Optimize memory usage by mergeing buffers

OkHttp transport's memory useage by merging Buffers for each pending data.
- OutboundFlowController, OkHttpClientStream

NOTE: Buffer by default allocate 4k memory.
2018-11-06 11:01:20 -08:00
Jan Tattermusch e2e990b01a
benchmarks: driverServer graceful shutdown (#5033) 2018-11-06 19:07:15 +01:00
Eric Anderson f8f86da480 core: Add missing synchronization in KeepAliveManager 2018-11-06 09:28:38 -08:00
Kun Zhang 99f5943520
services: HealthCheckingLoadBalancerUtil and HealthCheckingLoadBalancerProvider (#5026)
HealthCheckingLoadBalancerUtil is the public wrapper utility that helps
turn a LoadBalancerFactory into a health-checking capable one.

HealthCheckingRoundRobinLoadBalancerProvider overrides the
RoundRobinLoadBalancerProvider from grpc-core.
2018-11-06 09:14:56 -08:00
Eric Anderson 424daa0920 core: Improve error for Auto-LB configuration failure
The ManagedChannelImpl change prevents any LB initialization failure
from producing a useless exception like:
java.lang.NullPointerException
	at io.grpc.internal.ManagedChannelImpl.shutdownNameResolverAndLoadBalancer(ManagedChannelImpl.java:321)
	at io.grpc.internal.ManagedChannelImpl.panic(ManagedChannelImpl.java:738)
	at io.grpc.internal.ManagedChannelImpl$1.uncaughtException(ManagedChannelImpl.java:144)

Instead, now it will have the expected panic behavior of an INTERNAL
Status with a proper cause.

Since the NPE in AutoConfiguredLoadBalancerFactory wouldn't mean much to
users, it now has a more explicit message.
2018-11-05 14:08:50 -08:00
Eric Anderson 3dec12c8c9 travis: Remove sudo: false, as it is going away
This migrates us ahead of the forced migration, so if there are problems
the CI would still work while we work on them.

https://changelog.travis-ci.com/linux-builds-run-on-vms-by-default-77106
2018-11-05 13:58:14 -08:00
Kun Zhang 65bd38476f
services: define SERVICE_NAME_ALL_SERVICES for the empty service name (#5027) 2018-11-02 17:09:22 -07:00
ZHANG Dapeng 85b244bb41
core,netty,testing: Support dup headers joined with commas
Following the [spec](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md) on duplicate header names:

**Custom-Metadata** header order is not guaranteed to be preserved except for values with duplicate header names. Duplicate header names may have their values joined with "," as the delimiter and be considered semantically equivalent. Implementations must split Binary-Headers on "," before decoding the Base64-encoded values.
2018-11-01 16:17:05 -07:00
zpencer 3d51756d61
core, services: fix more import lints (#5021) 2018-11-01 16:14:42 -07:00
Kun Zhang f5d0f40bdf
services: client-side health checking main implementation (#5014)
Spec: https://github.com/grpc/proposal/blob/master/A17-client-side-health-checking.md

This comes in the form of a wrapper LoadBalancerFactory. The public wrapping utility and the wrapping of RoundRobinLoadBalancer will come in follow-up changes.
2018-10-31 09:29:46 -07:00
zpencer f3e371c712
core, grpclb: fix import lints (#5017) 2018-10-30 14:24:02 -07:00
Jihun Cho 51ab5b9432
interop-testing: update test proto to match grpc-proto. (#5003)
Update test proto to match stubby4 test server / grpc-proto repo.
- Deprecated PayloadType since it only provide 1 option.
- Change test cases to ignore deprecated field in Payload
2018-10-30 11:16:25 -07:00