Commit Graph

1365 Commits

Author SHA1 Message Date
Carl Mastrangelo 1b5cb598da Speed up NanoUtilsTest by 10s 2016-03-14 13:26:31 -07:00
Eric Anderson 569dcb502e Remove last vestiges of ChannelImpl/ServerImpl from security doc 2016-03-14 11:47:30 -07:00
Eric Anderson cf86d81ef7 Rename older AbstractTransportTest to AbstractInteropTest
There are two AbstractTransportTests. The newest one is the more aptly
named, so rename the older one to AbstractInteropTest to remove name
collision when speaking.

Fixes #1484
2016-03-13 23:01:04 -07:00
Kun Zhang 08c74d46f5 Only link delayed transport AFTER real transport has called transportReady().
If TransportSet fails to connect a transport (i.e., transportShutdown()
called without transportReady()), TransportSet will automatically
schedule reconnection for the next address, unless it has reached the end
of the address list, in which case it will fail the delayed transport.

This will reduce stream errors caused by bad addresses appearing before
good addresses in the resolved address list.

Before this change, TransportSet would return the real transport on the
first call of obtainActiveTransport(). After this change, it will return
the delayed transport instead.
2016-03-11 14:46:44 -08:00
Eric Anderson 27d848901f Improve updating hosted JavaDoc for copy/pasting commands 2016-03-10 16:28:35 -08:00
Eric Anderson 397d8618a1 Update README to reference v0.13.2 2016-03-10 16:15:03 -08:00
Kun Zhang 016d4a5e22 Use bytes instead of a string for IP address.
Ported from internal.
2016-03-10 14:17:52 -08:00
Carl Mastrangelo 9913d1d0fc Initial attempt at json example 2016-03-10 11:33:06 -08:00
Eric Anderson 7c6c045d92 Remove support for Nano's deprecated package names
This requires that all nano protos have .nano in their package name. The
support is expected to be removed from protobuf soon, since using the
deprecated package name causes problems.
2016-03-10 11:00:32 -08:00
Eric Anderson eccd231131 Don't hold a lock in DelayedStream when calling realStream
Our current lock ordering rules prohibit holding a lock when calling the
channel and stream. This change avoids the lock for both
DelayedClientTransport and DelayedStream. It is effectively a rewrite of
DelayedStream.

The fixes to ClientCallImpl were to ensure sane state in DelayedStream.

Fixes #1510
2016-03-09 15:14:00 -08:00
Kun Zhang b9c12327eb Add log ID.
To ManagedChannelImpl, TransportSet and all client transport
implementations, so they can be correlated in the logs. Also added more
life-cycle logging in general.
2016-03-09 13:52:32 -08:00
nmittler b9196e3084 Adding RunWith annotation to ConcurrencyTest 2016-03-08 06:16:58 -08:00
Carl Mastrangelo 8ed0088eff Make Status code use percent encoding 2016-03-07 10:01:44 -08:00
Eric Anderson d192f1a6cb netty: GOAWAY should trigger transportShutdown
Long-lived streams or lengthy RPCs can keep the transport open for
minutes after a GOAWAY is received. Previously, during this time any new
RPCs would fail with a message like:

> Cannot create stream 5 since this endpoint has received a GOAWAY frame
> with last stream id 3

All usages of goAwayStatus were replaced with lifecycleManager. Although
note that previously goAwayStatus() would never return null because it
would generate a Status if the current field was null.
getShutdownStatus() does not have this feature, so some code was
rearranged to guarantee the Status is non-null before retrieving it.

The listener handling was simplified by 1) avoiding the need for
thread-safety and 2) moving state keeping into a small class for easy
comprehensibility and simplified usage in tests.

NettyClientTransport.shutdown() no longer calls transportShutdown()
because it lies (because the message can be delayed for quite some time)
and because it was the only usage of lifecycleManager not on the event
loop.

Fixes #1359
2016-03-07 09:35:18 -08:00
Kun Zhang 2491402036 Remove or use unused variables. 2016-03-04 17:05:23 -08:00
Carl Mastrangelo 946611909e remove unused var 2016-03-04 16:17:31 -08:00
Carl Mastrangelo ffe0dce85f Add missing override annotation to generated protos 2016-03-04 14:15:02 -08:00
Matt Hildebrand 56d9b17838 Test that gRPC clients and servers can handle concurrent RPCs. 2016-03-03 16:40:54 -08:00
Kun Zhang 0e14516f5a Run createTransportRunnable outside of lock.
Because `scheduleConnection()` is run under lock, if we ran
`createTransportRunnable` inside `scheduleConnection()`,
`savedDelayedTransport.setTransport()` will be under lock which violates
the assumption made in https://github.com/grpc/grpc-java/issues/1408 that

> there is an implicit rule today that channel layer will not hold any lock while calling into transport

and had caused deadlock with `InProcessTransport`.

Also updated tests to

 1. Make it clear that we want the first obtained transport to be the
 real transport instead of the delayed transport, because
 `InProcessTransport` has deadlock issues with delayed
 transport (grpc/grpc-java/pull/1510)

 2. Not rely on identity equity to check whether `TransportSet` has
 switched to a different address. Instead, call `newStream()` and check
 which real transport is actually called, which is more reliable.

 3. Add timeout when checking for real transport creation and
 starting. Tests in general should not check for implementation detail,
 e.g., whether certain work is done synchronously.
2016-03-03 16:35:12 -08:00
William Thurston a574159c81 Add interceptForward methods for Client and Server 2016-03-03 15:32:54 -08:00
Eric Anderson 3528467612 Treat ClosedChannelException as UNAVAILABLE to squelch test failures
Our tests are detecting cases where we are still getting
ClosedChannelException. We need to fix that because it is a useless
status, but until it is fixed we want a stable CI.

Fixes #1513 and NettyTransportTest.serverNotListening failures
2016-03-03 14:18:34 -08:00
Carl Mastrangelo 40d9cd1941 Add more debug output in TlsTest 2016-03-03 11:35:19 -08:00
Carl Mastrangelo 0e370eb155 Remove static initializer blocks 2016-03-03 09:51:51 -08:00
Carl Mastrangelo c85e04698f Make Route Guide client and server accept channel and server builers, respectively. 2016-03-02 16:24:31 -08:00
Carl Mastrangelo 8e1fba7c90 Use Protobuf Json formatting for routeguide example 2016-03-02 10:10:15 -08:00
Carl Mastrangelo 3a4b266b4f Bump gradle version to 2.11 2016-03-02 09:25:37 -08:00
Eric Anderson 1170afd168 Add transport test for Netty
Netty client shutdown would race with the negotiation handling and
circumvent AbstractBufferingHandler. Use a new command in order to
leave channel.close() available for abrupt killing of the connection
when connecting.

ping_afterTermination was previously racey that made it succeed. After
fixing the test, Netty would consistently fail to call callback. After
fixing Netty to fail the callback it was not using the right status
because when Netty's channel is closed none of our handlers are run.
This reliably fails the future with ClosedChannelException, which is
useless, so now we special-case that exception and fill in the reason
for shutdown.

To prevent accidentally reporting Status.OK, the transports no longer
use OK when calling transportShutdown. The OK status was already no
longer being consumed, since keying off whether transportReady was
called is more helpful.

This fixes #1330
2016-03-01 17:43:30 -08:00
Carl Mastrangelo 72f1e88d78 Inlcude the file that was used to generate service descriptors 2016-03-01 09:22:10 -08:00
Matt Hildebrand de72f6915d Test that a GRPC client rejects untrusted server certs. 2016-02-29 19:05:19 -08:00
Carl Mastrangelo 39659dce85 Use impossible port for unreachability test 2016-02-29 14:46:31 -08:00
Xiao Hang 5d025ed6ae Change InteopTester to take a ManagedChannel directly instead of using all the args to build a channel
Create a helper class for building okhttp based channels in android tester app
2016-02-29 08:48:20 -08:00
Kun Zhang 643bb2c6b5 Always start from the first address after a successful connection. 2016-02-26 17:21:47 -08:00
Carl Mastrangelo 86bad4ffea Add more log into for cancellation 2016-02-26 13:37:14 -08:00
Louis Ryan 887064d30e Use latching to enforce expected events are received 2016-02-25 17:33:54 -08:00
Louis Ryan 8dad73492a Various naming and documentation clenaups
Remove attachAsCloseable and replace with the immediate run / call methods
Introduce a concrete Deadline type and use it
2016-02-25 16:33:10 -08:00
Eric Anderson b17a249fc4 Create new AbstractTransportTest for Transports
This is lower-level than the existing AbstractTransportTest. It should
be used by all transports, but InProcessTransport is the only one as
part of this commit.
2016-02-25 16:23:17 -08:00
Kun Zhang d86dfc9552 Merge DelayedStream's setError() into cancel()
DelayedClientTransport.PendingStream will override cancel(), which has a
clearer semantic.

Also permitting all status codes except OK in ClientStream.cancel(),
instead of just 4 codes.
2016-02-25 11:28:48 -08:00
Carl Mastrangelo a959126fb3 Bump Guava to 19.0 2016-02-25 08:42:54 -08:00
Eric Anderson 06e3ef5945 Fix bugs and improvements found by static analyser 2016-02-23 17:32:35 -08:00
Kun Zhang 7a29f3993c Pass transports instead of futures of transports for new calls.
This PR finishes the refactoring started by #1395. Resolves #1342.

Major changes:

- All interfaces that return `ListenableFuture<T>` now return `T`
- Stop passing `null` for transports after shut down. Pass
  `FailingClientTransport` instead. This simplifies the interface
  semantics of interfaces that return a transport, as well as their
  callers because they no longer need to check for `null`.
- Add two methods to `TransportManager`:
 - `createInterimTransport()` takes the place of `BlankFutureProvider`
  in `LoadBalancer` implementations.
 - `createFailingTransport()` takes the place of errors in the `Future`
  when `LoadBalancer` implementations propagate errors to the caller.
- `createInterimTransport()` creates a `DelayedClientTransport` tracked
  by `ManagedChannelImpl`, which will not terminate until all
  `DelayedClientTransport`s, in addition to the `TransportSet`s, are
  terminated.
- Removed the transport argument from the ready and shutdown callbacks,
  because if `LoadBalancer` was given a delayed transport earlier, it
  will get the real transport's shutdown event, thus won't be able to
  match the two through identity comparison, which beats the purpose of
  passing the transport.
2016-02-23 09:42:03 -08:00
Eric Anderson 340481859f Update README to reference 0.13.1 2016-02-23 08:38:48 -08:00
Carl Mastrangelo 42d787288e Use default keystore 2016-02-22 17:18:32 -08:00
Xiao Hang 52b3db2c06 Fix a bug ByteReadableBufferWrapper. We should set new buffer's limit before changing the original buffer's position 2016-02-22 16:28:36 -08:00
William Thurston 8d0267fc41 Allow for interceptors to send and receive messages of type InputStream. 2016-02-21 18:01:25 -08:00
Eric Anderson 56dca036db Limit memory during build
When running :grcp-interop-testing:test, Travis has been hanging on OS X
or flaking on Linux with:
> Process 'Gradle Test Executor 4' finished with non-zero exit value 137

Exit code 137 indicates SIGKILL (128 + 9) and is most likely caused by
the JVM being killed by the kernel's OOM killer.

The limit in .travis.yml is 2x what was necessary to do a parallel
build. The main test memory limit in build.gradle is well above 16m
which is necessary for the tests. Interop-testing is well above 64m
which is necessary for interop-testing, but we use 1.5g to help prevent
timeouts on Travis.

Protobuf and protobuf-nano each have one tests that decodes a proto >64M
in size, which prevents them from running with less than 512m and 768m,
respectively.
2016-02-21 16:59:44 -08:00
nmittler 86fd2523ec Update to latest netty and tcnative. 2016-02-20 14:50:06 -08:00
Lukasz Strzalkowski af6a2650af Add simple BINARY_BYTE_MARSHALLER 2016-02-20 12:30:20 -08:00
Kun Zhang ab1bc05f07 Update package name for grpc load balancer proto. 2016-02-19 17:03:33 -08:00
nmittler 5cef321b78 Use Netty's StreamBufferingEncoder
Fixes #1060
2016-02-19 11:29:28 -08:00
Louis Ryan caad0294b9 Revert the cascading test for the moment as its flaky 2016-02-19 10:28:17 -08:00