Commit Graph

530 Commits

Author SHA1 Message Date
zpencer a5b55bb24c
netty,okhttp,testing: always set TRANSPORT_ATTR_REMOTE_ADDR (#4217)
Always set the remote address, no reason why this should be a TLS-only
feature. This is needed for channelz, and is especially useful in unit
tests where we are using plaintext.

This PR adds the attr for plaintext.
2018-03-23 15:44:40 -07:00
Eric Anderson 7eab0d9468 netty: Add support for Conscrypt 2018-03-23 10:05:45 -07:00
Eric Anderson 0859d480e7 Move TlsTest from interop-testing to netty 2018-03-23 10:05:45 -07:00
Eric Gribkoff 5337728fa7
core,netty: client sends rst stream when server half-closes (#4222) 2018-03-22 12:38:42 -07:00
ZHANG Dapeng a83f67a706
core,netty,okhttp: Transparent retry
Changes:

- `ClientStreamListener.onClose(Status status, RpcProgress rpcProgress, Metadata trailers)` added.

- `AbstractClientStream.transportReportStatus(Status status, RpcProgress rpcProgress, boolean stopDelivery, Metadata trailers)` added

- `ClientCallImpl.ClientStreamListenerImpl` will ignore the arg `rpcProgress` (non retry)

- `RetriableStream.SubListener` will handle `rpcProgress` and decide if transparent retry.

- `NettyClientHandler` and `OkHttpClientTransport` will pass `RpcProgress.REFUSED` to client stream listener for later stream ids when received GOAWAY, or for stream received a RST_STREAM frame with REFUSED code.

- All other files are just a result of refactoring.
2018-03-12 14:12:46 -07:00
zpencer 921b668ad5
core,netty,okhttp,testing: separate local vs remote stream start times for channelz (#4194)
The channelz spec states that the two must be separate.
2018-03-08 16:57:12 -08:00
zpencer f0eb6d2102
core,netty,okhttp,testing: nest TransportStats inside SocketStats for channelz (#4190)
Transport ststistics should really be a child member of SocketStats.
While we're at it, let's add the local and remote SocketAddress to
SocketStats, with a test.
2018-03-08 14:56:04 -08:00
Eric Anderson 26719bdc5c Partially revert "core: change serverimpl,servercallimpl's internalclose to cancel stream (#4038)"
This partially reverts commit 48ca4527c1.
It leaves the changes to ServerCallImpl and test.

This also partially reverts "Lint fixes" commit
3002a23a0f which removed unused variables
which are now necessary again.

This is reverted for the combined result of two issues:
* Some users are testing that they get UNKNOWN when the service throws.
  That's not unreasonable given the behavior was well-publicised when it
  changed in v1.5. We should probably keep the UNKNOWN in some common
  cases (like the service threw immediately, before sending anything).
* The client could see CANCELLED instead of INTERNAL as had been
  intended. It's unclear as to why (I didn't investigate heavily). This
  behavior is visible in MoreInProcessTest and was overlooked during
  review.
2018-03-02 13:35:06 -08:00
Carl Mastrangelo 7af2373a03
core,netty,okhttp,alts,inprocess: deprecate usePlaintext(boolean) 2018-02-28 08:53:14 -08:00
Carl Mastrangelo 6d51cb4aef
netty: bump to 4.1.22-Final 2018-02-22 13:10:04 -08:00
Rama Chavali 48ca4527c1 core: change serverimpl,servercallimpl's internalclose to cancel stream (#4038)
The HTTP/2 error code will be INTERNAL_ERROR for all cancel statuses,
except for DEADLINE_EXCEEDED and CANCELLED, which are mapped to
CANCELLED.
2018-02-22 11:09:21 -08:00
Carl Mastrangelo 35665af72c
netty: upgrade to 4.1.21 2018-02-12 17:42:11 -08:00
Eric Anderson a888d46b93 netty: Include more details for closure of unknown reason
Some users have reported "Channel closed but for unknown reason".
Adding this information doesn't tell us where the bug is, but may help
us narrow down why getShutdownStatus() is null.
2018-02-12 16:49:22 -08:00
Carl Mastrangelo 6c437b2998
netty: upstream unit conversion 2018-02-12 11:11:11 -08:00
zpencer f8c7f963ef
core,netty,okhttp: use ServiceProviders for ManagedChannelProvider, ServerProvider (#4047) 2018-02-08 08:57:52 -08:00
Eric Anderson f1bc4493b8 netty: Add test to verify error for TLS failure
This is to notice regressions like in #4016
2018-02-01 12:30:18 -08:00
Eric Anderson c56114ff79 netty/shaded: Bump shadow plugin version to 2.0.2
This fixes the gradle warning:
The SimpleWorkResult type has been deprecated and is scheduled to be
removed in Gradle 5.0. Please use WorkResults.didWork() instead.
2018-02-01 09:58:23 -08:00
zpencer 199a5203c5
core: move ChannelStats and TransportStats to io.grpc.internal.Channelz (#4008) 2018-01-25 23:24:49 -08:00
zpencer b109595ad3
core: move Instrumented, LogId, WithLogId to io.grpc.internal as public (#3995) 2018-01-25 17:19:00 -08:00
Carl Mastrangelo 417765b814
netty: only add gRPC negotiator once SSL is established 2018-01-25 11:51:24 -08:00
Shohei Kamimori b5ae13405f netty: avoid unintentionally NullPointerException (#3932) 2018-01-17 15:47:45 -08:00
Carl Mastrangelo a3d801d07d
netty: make GrpcHttp2ConnectionHandler able to indicate it will no longer be used
This adds a method on GrpcHttp2ConnectionHandler which, when called, indicates that the channel associated with the handler is no longer needed.   

Notes:

* The handler may not be on the channel, but will either need to be added or will never be added.
* The channel will only be "unused" on the server side.
* It is expected that after calling `notifyUnused()`, the channel will be deregistered from the loop without being properly shut down.   This allows the channel to be handed off to a Non-netty API.
2018-01-11 14:12:12 -08:00
Eric Anderson ba8063e7b0 all: Prefer mock+delegatesTo() over Mockito.spy()
Spies are really magical and easily produce unexpected results. Using them in
tests can easily yield tests that don't do what you think they do. Delegation
is much safer when possible.

Delegation doesn't work when methods `return true`, final methods, and with
restricted visibility, though. So CensusModulesTest and
MaxConnectionIdleManagerTest are left as-is.
2018-01-11 09:32:54 -08:00
Eric Anderson 4bc0c95d0b Update ErrorProne to 2.1.3 and fix failures
The fixes could have subtle side-effects, but I did take care when making them.
2018-01-09 12:40:55 -08:00
Eric Anderson 35a6bf863d Enable the Guava Beta Checker 2018-01-08 14:52:51 -08:00
Teo Jia Jiun 3e76bf143b netty: Use Java 9 ALPN if available 2017-12-21 14:26:09 -08:00
zpencer f1151f91b9
core: InternalInstrumented<T> for instrumented classes (#3817)
Entities that report stats to channelz will implement this interface.
2017-12-13 12:56:25 -08:00
Eric Anderson 83d710b6d7 Shade Netty transport, with tcnative
The entire transport is shaded because we wouldn't want to collide with
the unshaded form of grpc-netty.
2017-12-08 14:02:35 -08:00
zpencer 359e61eb4a
netty: NettyServerTest should not hard code ports (#3845) 2017-12-07 10:53:28 -08:00
Shohei Kamimori 8b716a2f18 netty: add test for NettyServerBuilder 2017-12-07 09:07:31 -08:00
Carl Mastrangelo c9b02db276
all: add Status messages to all statuses 2017-12-04 19:00:16 -08:00
zpencer 9e7a4c44be
core: move WithLog and LogId to io.grpc (#3813)
The channelz service must not live in io.grpc.internal, and channelz
needs to be able to get the identifier of the entities it
tracks. Since io.grpc can not refer to io.grpc.internal, the LogId
must be moved out of internal.
2017-11-30 15:04:40 -08:00
zpencer 25cd0be24c
core,netty,okhttp: move TransportTracer.Stats to io.grpc (#3812)
io.grpc can not refer to io.grpc.internal so this needs to be moved
out.
2017-11-30 13:01:58 -08:00
Xiaoshuang LU cdb1f54794 netty: make server sockets be configurable 2017-11-22 16:00:33 -08:00
Eric Anderson 9bdb8f005a netty: Include more stace trace information for ClosedChannelExceptions
There's been another sighting, but it's very hard to narrow down what is
triggering it.
2017-11-17 13:18:52 -08:00
zpencer 2f155606b8
core,netty: add ID to NettyServer (#3745)
These are already WithLogId:
 ManagedChannelImpl, InternalSubchannel, ServerTransport
2017-11-15 11:49:13 -08:00
ramaraochavali df357cb8d3 netty: Netty server poorly handles unknown content type 2017-11-15 11:32:50 -08:00
ZHANG Dapeng 66f9ef5d69
netty: fix server keepalive unexpected ping ack
Resolves #3684
2017-11-14 11:09:31 -08:00
Kun Zhang de06a9471a
core: add internal accessors to control stats recording of RPC upstarts. (#3736) 2017-11-14 11:00:20 -08:00
zpencer 47bee4feee
core,netty: plumb fake clock into transport tracer tests (#3724) 2017-11-13 15:58:29 -08:00
zpencer d0a84ae5b8
core,netty: wire TransportTracer to netty client (#3705) 2017-11-10 15:55:21 -08:00
Eric Anderson b026ea544c netty: Avoid clearing SSLParameters
Since Netty may have set some parameters already, we should modify the
existing SSLParameters instead of starting from scratch.

This may fix ALPN with JDK9, but full support for ALPN with JDK9 is
still later work and we're not supporting it yet.

Fixes #3532
2017-11-10 13:08:58 -08:00
ramaraochavali 17e1ad9bb2 core: Add useTransportSecurity to ManagedChannelBuilder
This allows the consumer of a builder to swap back from plaintext.
2017-11-10 10:57:05 -08:00
Eric Anderson 93e89ba704 netty: Move server transportReady after client preface receipt
This mirrors the behavior of client-side.
2017-11-10 10:42:29 -08:00
zpencer 9ae5f116b5
netty: TransportTracer test for local window update (#3710) 2017-11-09 17:13:04 -08:00
zpencer af4cd2ebfd
netty: bump correct value of outbound msg counter (#3667)
No need for SendFrameGrpcCommand to know about the message count.
2017-11-09 11:32:19 -08:00
Eric Anderson bbb98feb75 Fix broken method names in tests that include leading '/'
The method name passed to MethodDescriptor does not include the leading
'/'. If it does, on the wire it will actually cause two slashes. This
has been this way for a _long_ time, but in tests that ignore the method
name or use the same MethodDescriptor no client and server the extra /
"works fine." But it's misleading, so let's remove it.
2017-11-08 15:24:50 -08:00
zpencer f2968f518f
core,netty: correctly count streams that ended due to client cancel (#3683)
Only bump the counter from AbstractServerStream.TransportState, and hole punch
from AbstractServerStream to TransportState when the application calls close.
2017-11-08 13:18:12 -08:00
zpencer a3c44fa7ca
core,netty,okhttp: add TransportTracer param to ClientStream and Http2ClientStreamTransportState (#3668)
This diff does not actually change any behaviors yet, that will come
in the next diff along with unit tests for those new behaviors. This
diff's goal is only to change the method signatures so future diffs
are cleaner.
2017-11-07 16:08:55 -08:00
zpencer a2e9a7f6dd
core,ntety,okhttp: Add getTransportStats method to ClientTransport (#3662)
This merely adds the method but does not do anything yet.
2017-11-06 13:24:20 -08:00