Commit Graph

237 Commits

Author SHA1 Message Date
nmittler 70ef5b1172 Make handling of GoAwayClosedStreamException more consistent. 2016-01-26 11:39:06 -08:00
Carl Mastrangelo 0486af6a88 Raise method visibility in Channel Providers 2016-01-14 11:12:53 -08:00
Eric Anderson bcb5fcdf82 Propagate headers/trailers if response isn't gRPC
This provides more structured data into the application for it to do
special handling.

In general, we would hope most people don't need this functionality, but
it is a good escape hatch to allow users to workaround infrastructure
problems.
2016-01-13 18:27:16 -08:00
Eric Anderson 9cb79292aa Add toString to transports for debugging.
This is a partial re-application of eca1f7c, but using super.toString()
to distinguish different transports that go to the same endpoint.
2016-01-12 11:28:40 -08:00
Eric Anderson 218865a19e Revert "More information for debugging."
This reverts commit eca1f7c1d6.

We want to preserve the status message identical to what the server
sent. We'll need a better way to communicate debugging details.
2016-01-11 16:35:43 -08:00
Carl Mastrangelo 3276442d4e Split newStream from start 2016-01-06 11:46:24 -08:00
Kun Zhang eca1f7c1d6 More information for debugging.
- Include transport information in RPC's final status
- Implement toString() of transports
2016-01-05 12:29:26 -08:00
Carl Mastrangelo d3d8adbab6 Allow support for nanosecond timeouts, and use nanoseconds consistently throughout our code 2015-12-17 18:22:47 -08:00
Carl Mastrangelo b9cacc1553 update tests 2015-12-14 16:09:28 -08:00
Carl Mastrangelo 82a79d8f93 Expose compression on ClientCall and Server Call 2015-12-08 10:49:27 -08:00
Eric Anderson 96f9cefda4 Close active streams on channelInactive
We think this broke when the stream lifecycle listener was removed.
Observing the stream lifecycle would be the "proper" fix, but it had
notification ordering issues where streams would close before we were
notified of the event that caused the closure, which made it difficult
to provide useful error messages. The ordering of notifications was also
largely undefined.

The long term fix we look forward to is the HTTP/2 child channels, which
should have clearly defined ordering between error notification and
channel closure, and in the order that we need here.

Fixes #1251
2015-12-07 09:00:41 -08:00
Louis Ryan be6008666e Initial basic implementation of context binding for clients with some limited testing
Adds utility functions for working with Contexts and interceptors
Use 'name' as Context.Key.toString to make conversion to Metadata simpler
2015-12-02 15:33:58 -08:00
Eric Anderson 2db02b52be Reduce advertised Netty API
NettyServer wasn't usable as public, since its constructor was
package-private. So although this reduces our API, it shouldn't actually
impact anyone.

Fixes #1047
2015-11-25 14:12:10 -08:00
Eric Anderson 7ba9ca4861 Map IOException during connecting to UNAVAILABLE
This isn't expected to have much impact once the connection is
established because AbstractNettyHandler.exceptionCaught() wraps all
unknown exceptions with Http2Exception. Fixing that is future work.

Some cases we may now be unwrapping a StatusException, such as one
thrown by MessageDeframer. In general, that seems a Good Thing™, but it
is unclear exactly if it would be perceivable.

Fixes #1181
2015-11-25 09:43:38 -08:00
nmittler 61a0d8238f Auto-refill connection window
Fixes #1175
2015-11-24 10:24:00 -08:00
Carl Mastrangelo 7de6c04d14 Move decompressor setting to the AbstractServerStream 2015-11-20 13:27:27 -08:00
Jakob Buchgraber e8afcb47ff Fix build failure due to unused import. 2015-11-19 14:26:09 +01:00
nmittler ebed5a624a Upgrading to Netty 4.1.0.Beta8
A few things to note:

- ByteString has gone away in favor of AsciiString.

- Http2Headers now uses CharSequence for all methods, so there are a few places that we have to explicitly check for AsciiString to get the optimizations.

- We now have to specify a graceful shutdown timeout for our Netty handlers. Using 5 seconds.
2015-11-18 11:42:24 -08:00
Eric Anderson 76eaae26b8 Enable LB and Naming for Netty.forAddress(String,int)
This swaps to the forTarget() codepath. The constructor is to make it
more convenient when extending the builder to disable checkAuthority.
2015-11-13 19:30:21 -08:00
Carl Mastrangelo 2ad35b8269 Add Header name character restrictions 2015-11-10 11:20:04 -08:00
nmittler 8c7e251f41 Allow Netty server override for ProtocolNegotiator
Server implementation had to be refactored to use a ProtocolNegotiator to make this work.
2015-11-02 13:04:37 -08:00
nmittler e775885be2 Allow client to specify ProtocolNegotiator in NettyChannelBuilder. 2015-11-02 09:02:41 -08:00
nmittler b9195fb9aa Set connectionWindow to MAX_INT.
This is a temporary fix for https://github.com/grpc/grpc-java/issues/1175. We will revisit this change after auto-refill is supported in Netty.
2015-10-30 12:29:31 -07:00
Xudong Ma 750b1977ca Make the header list size limit configurable on both client and server side. 2015-10-30 10:52:47 -07:00
nmittler 23e2df9a67 Allowing AbstractBufferingHandler to be extended. 2015-10-29 11:06:09 -07:00
Carl Mastrangelo c53b5170ca Downgrade mockito, and fix tests 2015-10-28 12:57:10 -07:00
nmittler 3efc61b237 Guard against NPE in Netty handlers
We've seen an NPE as a side-effect of a failure in protocol negotiation:

Oct 27, 2015 9:27:09 PM io.grpc.transport.netty.ProtocolNegotiators$AbstractBufferingHandler fail
SEVERE: Transport failed during protocol negotiation
java.lang.NullPointerException
	at io.grpc.transport.netty.NettyClientHandler$2.visit(NettyClientHandler.java:218)
2015-10-28 08:38:59 -07:00
Kun Zhang edd57c941e Support default port in NameResolver.
- Channel builders decide the default port based on whether TLS is used.
- Channel builders populate the default port via an Attributes object
  passed to NameResolver.Factory#newNameResolver
2015-10-27 13:54:36 -07:00
Carl Mastrangelo db56c2463e Add followup ProtocolNegotiators.tls tests 2015-10-26 12:19:07 -07:00
Carl Mastrangelo dd815bc968 Add initial Protocol Negotiation tests 2015-10-26 11:46:52 -07:00
nmittler 6f64999821 Addressing concurrency issue in MessageFramer.
Fixes (hopefully): #991
2015-10-23 13:00:23 -07:00
Kun Zhang efac679abc NameResolverRegistry and better-defined target string.
- NameResolverRegistry contains all the official NameResolvers. Users
  can also add custom NameResolvers to it. It looks up NameResolver by
  try-and-fail. It is the default NameResolver.Factory for builders.
  DnsNameResolver.
- Pass target as Strings instead of URIs from the channel builder to
  ManagedChannelImpl. A target string is not necessarily a valid URI, in
  which case ManagedChannelImpl will add "dns:///" to the beginning of
  the target and use it as URI.
- DnsNameResolver will require scheme "dns" to be present. It no longer
  allows scheme-absent URIs.
2015-10-23 09:37:22 -07:00
Carl Mastrangelo 74088c4fb4 Allow authority override to be propagated to Protocol Negotiators 2015-10-22 15:27:07 -07:00
Kun Zhang 942f4c99d8 Load-balancing ManagedChannelImpl.
- Add NameResolver and LoadBalancer interfaces.
- ManagedChannelImpl now uses NameResolver and LoadBalancer for
  transport selection, which may return transports to multiple
  addresses.
- Transports are still owned by ManagedChannelImpl, which implements
  TransportManager interface that is provided to LoadBalancer, so that
  LoadBalancer doesn't worry about Transport lifecycles.
- Channel builders can be created by forTarget() that accepts the fully
  qualified target name, which is an URI. (TODO) it's not tested.
- The old address-based construction pattern is supported by using
  AbstractManagedChannelImplBuilder.DirectAddressNameResolver.
- (TODO) DnsNameResolver and SimpleLoadBalancer are currently
  incomplete. They merely work for the single-address scenario.
2015-10-20 17:28:44 -07:00
nmittler 6e04c3100e Adding consistent exception handling for Netty
NettyClientHandler currently handles non-HTTP/2 exceptions properly by forcing a shutdown of the connection.  We need to do the server-side as well.

Fixes #1097
2015-10-05 11:46:50 -07:00
Carl Mastrangelo 2d067edf85 Allow host authority override. 2015-10-02 11:00:43 -07:00
Carl Mastrangelo 70cdf76212 adjust other usages in protocol negotiators 2015-09-29 10:57:23 -07:00
Carl Mastrangelo 75e291f062 docs 2015-09-29 10:48:24 -07:00
Carl Mastrangelo cb317c736c Update to share versions 2015-09-29 10:42:12 -07:00
Carl Mastrangelo ff19d90bb8 Force http2 connection when using tls 2015-09-29 10:38:26 -07:00
Carl Mastrangelo 46c18ea237 Move decompressor setting down into the AbstractStream 2015-09-28 10:25:58 -07:00
Xudong Ma f15f672b79 Correct the order of arguments. 2015-09-25 17:36:06 -07:00
nmittler f0d95798f8 Updating Netty to send a single SETTINGS frame.
Fixes #1059
2015-09-24 10:42:57 -07:00
Carl Mastrangelo 70fbd6735a Remove unused function in netty test 2015-09-23 15:15:31 -07:00
Carl Mastrangelo bfd74506fe Remove Netty test that fails with upstream 2015-09-23 13:47:33 -07:00
Eric Anderson 1e1d53b78f Fix test checking for invalid content type
Previously, if the content type was being ignored the error code would
have been UNKNOWN since there was no grpc-status. That seems very to
accidentally pass, so now if the content type is ignored it would get
OK.
2015-09-16 10:00:08 -07:00
Eric Anderson 1cfba96d17 Enforce sending headers before messages on server
ServerCall already had "headers must be sent before any messages, which
must be sent before closing," but the implementation did not enforce it
and our async server handler didn't obey.

The benefit of forcing sending headers first is that it removes the only
implicit call in our API and interceptors dealing just with metadata
don't need to override sendMessage. The implicit behavior was bug-prone
since it wasn't obvious you were forgetting that headers may not be
sent.
2015-09-11 17:39:40 -07:00
Carl Mastrangelo f6582d822d Add a hook to set TLS 2015-09-11 10:03:30 -07:00
Eric Anderson 538cf215f0 Add usePlaintext to ManagedChannelBuilder 2015-09-11 09:57:42 -07:00
Carl Mastrangelo 41d93cfd59 Use Providers in examples 2015-09-11 09:46:08 -07:00