Commit Graph

627 Commits

Author SHA1 Message Date
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
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
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 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
ZHANG Dapeng 0665af289a
netty: fix lint 2019-03-04 09:40:42 -08:00
Carl Mastrangelo 5cfff5bfce
netty: replace TLS protocol negotiator with new style handlers 2019-03-01 11:37:07 -08:00
Eric Anderson a818c81a71 testing: Move AbstractTransportTest to core to avoid Truth dep
Fixes #5301
2019-02-28 21:33:19 -07:00
Kun Zhang 83b92cfc9f
core: pass transport attributes to ClientStreamTracer.Factory.newClientStreamTracer() (#5380)
This will be a new override.  The old override is now deprecated.

In order to pass new information without adding new overrides, I shoved most information
into an object called StreamInfo.  The Metadata is left out to draw attention because
it's mutable.

Motivation: this is needed for correctly supporting pick_first in GRPCLB.  GRPCLB needs to
add a token to the headers, and the token varies among servers.  With round_robin, GRPCLB
create a Subchannel for each server, thus can attach the token when the Subchannel is picked.
To implement pick_first, all server addresses will be put in a single Subchannel, we will
need to add the header in newClientStreamTracer(), by looking up the server address from
the transport attributes and deciding which token to add.
2019-02-21 11:13:51 -08:00
David Hoover d44d015c44 doc: Fix typo 2019-02-20 16:40:57 -08:00
Jihun Cho 5f60f22b6a netty: prevent IndexOutOfBoundsException when no handler is passed to BufferingHandler 2019-02-15 15:18:48 -08:00
Carl Mastrangelo 8e6fa122a6
netty,alts: hide ProtocolNegotiator behind an accessor, and...
...and move the `close()` method to ProtocolNegotiator rather than Handler.

Since this is a breaking change (for people who ignored our `@Internal` annotations), I wanted to make both changes in the same PR so as to fix them both at the same time.
2019-02-15 13:59:58 -08:00
Carl Mastrangelo bb394132bd
netty: limit access to ProtocolNegotiators 2019-02-12 19:59:15 -08:00
Carl Mastrangelo e5008e53fe
netty: always use double goaway for shutdown 2019-02-12 14:40:52 -08:00
Kun Zhang e875a8c6a3
core: introduce NameResolver.Helper and deprecate the params on newNameResolver() (#5345)
Context: [#4159 (comment)](https://github.com/grpc/grpc-java/issues/4159#issuecomment-415827641)

`Attributes` is appropriate for plumbing optional objects, especially useful for a long plumbing path where components in the middle may not care or see all objects in the container. It's not the case for the `params` on `newNewResolver()`. Both the default port and the proxy detector are guaranteed to be there and the plumbing path is very short. In this case, a first-class object is more appropriate and easier to use.

The `Helper` will also have `getSynchronizationContext()` (#2649) and a method to parse and validate service config. We we also considering merging `Listener` into the `Helper`, to make `NameResolver` match the `LoadBalancer` API.
2019-02-12 10:14:59 -08:00
Kun Zhang 138e958c4a
core: ProxiedSocketAddress on public API (#5344)
Combine the public `ProxyParameters` and the internal `ProxySocketAddress` as `HttpConnectProxiedSocketAddress`. The more specific name signifies the type of the proxy we currently support, and makes room for other proxy types (e.g., SOCKS) in the future. The combination simplifies NameResolver implementation.

Introduce `ProxiedSocketAddress` as the base class that is returned by `ProxyDetector`, mainly for clarification and documentation. Added documentation about proxy in general on `ProxyDetector`.
2019-02-11 09:56:59 -08:00
Carl Mastrangelo dc5ec9743a
netty: add a channel active handler 2019-02-07 10:22:12 -08:00
Carl Mastrangelo f6ec07d87d
core,netty: expose listening on multiple ports 2019-02-06 15:49:59 -08:00
Jihun Cho 71d067e8f5
netty: add channelFactory to NettyChannelBuilder (#5312)
add channelFactory in NettyChannelBuilder & NettyClientTransport
2019-02-04 10:51:23 -08:00
Carl Mastrangelo 3a39b81cf5
all: remove java6 type args 2019-02-04 10:03:50 -08:00
Tim van der Lippe a31473ef20 all: fix usages of any(<Primitive>.class) matchers
In Mockito 2, if a method expects a primitive type, but an any(<Primitive>.class) matcher is used in its place, it will throw an error. To prepare for this upcoming breakage, change
all existing any(<Primitive>.class) matchers to use the correct any<Primitive>() matcher.
2019-02-04 09:01:00 -08:00
Jihun Cho 1c3432c3fb
all: migrate gradle publish from maven to use maven-publish plugin (#5289) 2019-01-31 17:38:43 -08:00
ZHANG Dapeng d0ecc08705
all: fix lint 2019-01-31 09:31:13 -08:00
Carl Mastrangelo ed0a9f3f1d
netty: support listening on multiple ports 2019-01-29 10:13:40 -08:00
Carl Mastrangelo f6689a1f86
all: fix lint errors 2019-01-25 16:09:59 -08:00
Ignacio del Valle Alles 3a38e59bae core: Allow specifying a ProxyDetector per ManagedChannel 2019-01-23 16:57:40 -08:00
Carl Mastrangelo 985bf0aa74
netty: handle racy stream cancellation on already failed transports 2019-01-22 15:15:35 -08:00
Carl Mastrangelo 6f83bfc393
netty: handle reentrant exception in WBAEH 2019-01-18 15:18:31 -08:00
Carl Mastrangelo 3e6d8dc456
netty: handle unexpected handlerRemoved in WBAEH 2019-01-15 14:28:41 -08:00
Carl Mastrangelo 659b78b06c
netty: move buffering logic from ProtocolNegotiators
This is part 1 of a larger change to simplify channel initialization.  Part two will be to let Protocol negotiators install themselves in a deterministic manner and delegate error handling to the exception handler.

Changes:

1.  Copied most of AbstractBufferingHandler to WriteBufferingAndExceptionHandler. WBAEH does not handle adding more than one handler.  Eventually, pipeline initialization will happen in the protocol negotiator rather than in each handler.
2.  Added tests for error handling.
3.  The WBAEH is always added to the NettyClientTransport.  This means for a brief period, there will be double buffering on the pipeline.  The buffering should go away after part 2.
2019-01-11 18:42:12 -08:00
Jihun Cho 08218810fd Remove @VisibleForTesting, because NettyServerTransport is referencing it 2019-01-08 17:27:29 -08:00
Eric Anderson e74576b85b Remove old BetaApi failure suppressions
We've been on newer versions of Guava for a while now; these no longer
do anything.

Reworded the comment for Stopwatch.createUnstarted(), because it is not
safe (it doesn't matter if the method isn't marked Beta; you have to use
Ticker), except for the fact it is only used in our tests.
2019-01-08 16:07:40 -08:00
Carl Mastrangelo b6af40e510 examples,netty: fix lint errors 2019-01-02 15:30:31 -08:00
Carl Mastrangelo 6779a5aa75
core,netty: refactor server builder
* makes Census tracing factories at the end of the user added ones
* makes more vars in AbstractServerImplBuilder package private
* annotates methods in ASIB to be clearer
* simplifies several of the setters to be single line
* Makes the generics on the Tracer factories proper
2018-12-17 17:22:33 -08:00
Carl Mastrangelo 1bf8476cd7
core: standardize logid format and add details for channelz 2018-12-17 17:22:11 -08:00
Thomas Broyer 2ffc46d6fa Update net.ltgt.errorprone to 0.6 and enable Error Prone on JDK 10+ 2018-12-13 10:17:06 -08:00
Carl Mastrangelo edede01da6
netty: bump to 4.1.32 and tcnative 2.0.20 2018-12-05 14:41:30 -08: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
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
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
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
Thomas Broyer 183e1f6735 all: update Error Prone to 2.3.2
This will allow enabling Error Prone on JDK 10+ (after
updating the net.ltgt.errorprone plugin), and is also a
prerequisite to that plugin update.

Also remove net.ltgt.apt plugin, as Gradle has native
support for annotationProcessor.
2018-10-19 13:08:36 -07:00
Eric Anderson b7c3d276c9 core: Add maxInboundMetadataSize to builders
This is a rename of the pre-existing Netty builder method, so aliases
were added to the Netty builders.

Fixes #4050. This API was a minor rename to the pre-existing Netty API,
so has already undergone API review and thus is not ExperimentalApi.
2018-10-18 14:34:03 -07:00
Eric Anderson 0fbc1153bd testing: Add transport tests for maxInboundMetadataSize 2018-10-18 14:34:03 -07:00
Carl Mastrangelo 52d6a6e680
netty: fix local socket bind 2018-10-17 18:34:03 -07:00