Commit Graph

1164 Commits

Author SHA1 Message Date
Eric Anderson d95576804e Revert "Update to latest tcnative release"
This reverts commit 1751536410.

It causes an java.lang.AbstractMethodError
2016-02-19 09:15:12 -08:00
nmittler 1751536410 Update to latest tcnative release 2016-02-19 08:45:01 -08:00
Trask Stalnaker c10f5781b9 Fix sporadic NullPointerException
Fixes #1426
2016-02-18 21:43:43 -08:00
Louis Ryan 86ef8e70b5 Fix Intellij syncing for some generated dirs 2016-02-18 20:44:46 -08:00
Eric Anderson 85e68dbe98 Update README to reference 0.13.0 2016-02-18 16:34:23 -08:00
Eric Anderson b824565632 Improve procedure for creating release tag and branch
The flow itself was improved, but also the addition of Bash variables
and sed automation should hopefully make it less error-prone.
2016-02-18 16:31:14 -08:00
Louis Ryan 7fc986e6d0 Fix flakiness in Cascading cancellation tests
Add explicit shutdown for other executors
2016-02-17 16:17:22 -08:00
Eric Anderson 6715f1202c Add support for codecov.io
Codecov.io provides patch-based code coverage, so you can easily know
how many of the added lines are covered. It also has a more useful UI.

Unfortunately, the percentage it reports does not include partially-
covered lines--those with uncovered conditions. Thus the reported
percentage is about 6% lower than the coverage we've been looking at
previously. Because of this alone, I don't expect to remove coveralls
support soon.

Use the bash script instead of python module since pip isn't available
by default on Travis OS X.

jacocoTestReport uses mustRunAfter (contrary to the docs; see
https://issues.gradle.org/browse/GRADLE-2960) to make sure it runs after
all tests, only if testing is taking place. We would like
:grpc-all:jacocoTestReport to behave the same way. Without it, we would
need two separate invocations of gradle (adding ~1m to Travis run) in
order to prevent getting random results depending on what tests just so
happened to have been run.
2016-02-17 12:24:17 -08:00
Eric Anderson daf920d4b4 Pass -j to correct command
Passing -j to ./configure produces an error
2016-02-17 11:44:28 -08:00
Louis Ryan 12a4b21f74 Integration tests for testing cascading cancellation. 2016-02-17 10:35:37 -08:00
Eric Anderson 30b4232060 Start 0.14.0 development cycle 2016-02-16 16:31:59 -08:00
Eric Anderson 41c3f78687 Maven protoc plugin has a new name and is on Maven Central 2016-02-16 15:29:24 -08:00
Eric Anderson 8d43880356 hpack is no longer a direct dependency
It isn't even a dependency of Netty, now that Netty has forked the code.
2016-02-16 14:54:17 -08:00
Eric Anderson b752e76858 Automated readability/efficiency tweaks
Although the changes were determined automatically, they were manually
applied to the codebase.

ClientCalls actually has a bug fix, since the suggestion to add
interrupt() made it obvious that interrupted() was inappropriate.
2016-02-16 14:15:23 -08:00
nmittler 1dce8df077 Switching to netty-tcnative-boringssl-static 2016-02-16 13:11:45 -08:00
Eric Anderson a3303b51ec Delete unused CancelStreamCommand 2016-02-16 11:45:29 -08:00
Eric Anderson 898634f96a In blocking stubs, throw Status.CANCELLED on interruption
This was already being done in one case, but should have been done for
the other occurrances of InterruptedException. Before the
RuntimeException is just asking to be a bug since application code will
commonly only catch StatusRuntimeException.
2016-02-16 11:38:57 -08:00
Carl Mastrangelo 2d2398ce3a d'oh, really raise the visibility 2016-02-16 10:55:24 -08:00
Carl Mastrangelo acdcd5b114 Raise visibility of netty Channel Builder, and provide a way to pass in a custom protocol negotiator per transport 2016-02-16 10:39:20 -08:00
Kun Zhang cf787bddf2 DelayedClientTransport and fix TransportSet.shutdown() semantics.
Always return a completed future from `TransportSet`. If a (real) transport has not been created (e.g., in reconnect back-off), a `DelayedClientTransport` will be returned.

Eventually we will get rid of the transport futures everywhere, and have streams always __owned__ by some transports.

DelayedClientTransport
----------------------

After we get rid of the transport future, this is what `ClientCallImpl` and `LoadBalancer` get when a real transport has not been created yet. It buffers new streams and pings until `setTransport()` is called, after which point all buffered and future streams/pings are transferred to the real transport.

If a buffered stream is cancelled, `DelayedClientTransport` will remove it from the buffer list, thus #1342 will be resolved after the larger refactoring is complete.

This PR only makes `TransportSet` use `DelayedClientTransport`. Follow-up changes will be made to allow `LoadBalancer.pickTransport()` to return null, in which case `ManagedChannelImpl` will give `ClientCallImpl` a `DelayedClientTransport`.

Changes to ClientTransport shutdown semantics
---------------------------------------------

Previously when shutdown() is called, `ClientTransport` should not accept newStream(), and when all existing streams have been closed, `ClientTransport` is terminated. Only when a transport is terminated would a transport owner (e.g., `TransportSet`) remove the reference to it.

`DelayedClientTransport` brings about a new case: when `setTransport()` is called, we switch to the real transport and no longer need the delayed transport. This is achieved by calling `shutdown()` on the delayed transport and letting it terminate. However, as the delayed transport has already been handed out to users, we would like `newStream()` to keep working for them, even though the delayed transport is already shut down and terminated.

In order to make it easy to manage the life-cycle of `DelayedClientTransport`, we redefine the shutdown semantics of transport:
- A transport can own a stream. Typically the transport owns the streams
  it creates, but there may be exceptions. `DelayedClientTransport` DOES
  NOT OWN the streams it returns from `newStream()` after `setTransport()`
  has been called. Instead, the ownership would be transferred to the
  real transport.
- After `shutdown()` has been called, the transport stops owning new
  streams, and `newStream()` may still succeed. With this idea,
  `DelayedClientTransport`, even when terminated, will continue
  passing `newStream()` to the real transport.
- When a transport is in shutdown state, and it doesn't own any stream,
  it then can enter terminated state.

ManagedClientTransport / ClientTransport
----------------------------------------

Remove life-cycle interfaces from `ClientTransport`, and put them in its subclass - `ManagedClientTransport`, with the same idea that we have `Channel` and `ManagedChannel`. Only the one who creates the transport will get `ManagedClientTransport` thus is able to start and shutdown the transport. The users of transport, e.g., `LoadBalancer`, can only get `ClientTransport` thus are not alter its state. This change clarifies the responsibility of transport life-cycle management.

Fix TransportSet shutdown semantics
-----------------------------------

Currently, if `TransportSet.shutdown()` has been called, it no longer create new transports, which is wrong.

The correct semantics of `TransportSet.shutdown()` should be:
- Shutdown all transports, thus stop new streams being created on them
- Stop `obtainActiveTransport()` from returning transports
- Streams that already created, including those buffered in delayed transport, should continue. That means if delayed transport has buffered streams, we should let the existing reconnect task continue.
2016-02-12 09:36:25 -08:00
Carl Mastrangelo 544cd3a33b pause 2016-02-11 15:45:30 -08:00
Eric Anderson ad301c7e4d Make thread-safety ownership of Metadata explicit 2016-02-11 12:40:38 -08:00
Lukasz Strzalkowski 48b30291ee Add Metadata#keys() which returns set of all keys in the store 2016-02-11 17:32:05 +01:00
Eric Anderson 964963ab1a Replace AUTHORITY_KEY with ClientStream.setAuthority 2016-02-10 17:26:51 -08:00
Eric Anderson 64bc830f65 Update Android test build to use current grpc snapshot and support Gradle 2.10
com.android.tools.build:gradle:1.1.0 doesn't work with Gradle 2.10, but
1.5.0 does.

I also bumped the protobuf-gradle-plugin to be the same as the version
used in the README and our primary build.gradle.
2016-02-10 16:05:03 -08:00
Carl Mastrangelo 3f9e486e0d Raise visibility of Netty Channel Builder Ctor 2016-02-10 10:52:18 -08:00
Eric Anderson 86f2c9f224 Fix InProcessTransport to call onReady
Fixes #875
2016-02-10 10:01:15 -08:00
Eric Anderson 5b9726ea7d netty: release buffered objects when failed
Releasing on failure prevents memory leak.

Fixes #1401
2016-02-10 09:36:54 -08:00
Eric Anderson 52bd63f88e Improve test coverage of ProtoUtils
NanoUtilsTest was updated to use an invalid proto instead of an
IOException to match ProtoUtils and to be more realistic.
2016-02-06 17:22:37 -08:00
Eric Anderson 5a5f985d21 Log full Status on Android test failure 2016-02-04 15:26:18 -08:00
Eric Anderson 3d3fd11378 Negotiation Handlers should implement ChannelHandler
Having Handler implement ChannelInboundHandler is overspecifying and
unnecessary, as the code compiles fine just by changing "implements
ChannelInboundHandler" to "implements ChannelHandler".

PlaintextHandler was swapped to ChannelHandlerAdapter instead of
ChannelDuplexHandler because it just needs the ChannelHandler methods.
2016-02-04 14:02:57 -08:00
Carl Mastrangelo 04a6c8395b Remove deprecated call and TODO in Protocol negotiators 2016-02-04 13:39:56 -08:00
Eric Anderson e61e6c27ad Update README to point to protobuf-gradle-plugin 0.7.4
We've been using 0.7.0 since 5df6ab0 and 0.7.4 since d3d253e, but hadn't
updated the README. 0.6.1 wouldn't work in Java 7, so using a newer
version can prevent users from hitting that bump.
2016-02-04 09:49:50 -08:00
Carl Mastrangelo bbec13ee0c Fix race condition in Compression Test 2016-02-04 09:23:43 -08:00
Eric Anderson e64c755a61 Add to RELEASING docs for updating JavaDoc and README 2016-02-03 15:52:57 -08:00
Eric Anderson 5b726ac0b3 Update README to reference 0.12.0
The version of protoc to use was bumped prematurely in e2ed2e8, so it is
reverted back to beta-1 here. When 0.13.0 is released then the protoc
version should be bumped.
2016-02-03 14:20:39 -08:00
Eric Anderson 4ac4d49370 Help steer new users away from copying our build.gradle
The jsonp dependency string is no longer shared because it was only used
in one place and someone trying to compile the examples using a new
build.gradle will need to add that dependency. It was a bit complex to
follow how libraries.jsonp worked and it wasn't really adding any value
in this particular case.
2016-02-03 10:04:12 -08:00
Eric Anderson b11dce8288 Partially synchronize route_guide.proto with main repository 2016-02-03 10:02:05 -08:00
Eric Anderson 9804b67f1a Include Proto in the java_outer_classname for helloworld.proto
Specifying the outer class is a pretty common convention and avoids the
outer classname changing depending on the contents of the proto file (as
can be seen if outer_classname isn't specified in the route guide
example). To avoid colliding, convention has it end in "Proto".
2016-02-03 10:02:05 -08:00
Solomon Duskis f6aba497ae Fixing a typo in Http2ClientStream. 2016-02-03 09:58:32 -08:00
Eric Anderson 2a17d2648c Partially synchronize helloworld.proto with main repository
Mainly HelloResponse is now HelloReply
2016-02-02 12:56:05 -08:00
Eric Anderson 4573836df9 Fix NPE in ProtoInputStream.drainTo
Fixes #1225
2016-02-01 15:16:17 -08:00
Eric Anderson e475d388b9 Cancel server context when call is cancelled
Context was being closed when the server was closing the RPC, but not if
the client cancelled.
2016-02-01 14:20:08 -08:00
Eric Anderson 6e94cf33db Require a ScheduledExecutorService to be provided to Context
Before the service would be leaked, because when the scheduled future
was cancelled the scheduler wouldn't be released. Also, Future isn't
powerful enough to signal when we should release when cancelling.

Given the nature of Context, it also seems beneficial to not have it own
threads. Since any caller of withDeadline*() is required to cancel the
Context, it shouldn't be too burdensome for them to manage the lifecycle
of the scheduler.
2016-02-01 14:16:11 -08:00
Eric Anderson 4a427b7ac9 Use instance equality for Context.Key
This allows applications to limit the visibility of values simply by not
exposing the Key instance being used.
2016-02-01 14:13:54 -08:00
Eric Anderson 7e3d0fe9cc Mark ChannelHandler.exceptionCaught implementation deprecated to fix warning
This just propagates the deprecated annotation from ChannelHandler. Note
that exceptionCaught is _not_ deprecated for ChannelInboundHandler and
ChannelDuplexHandler.
2016-02-01 13:14:13 -08:00
Carl Mastrangelo a3c79e87ae Add a simple compression API 2016-02-01 12:56:21 -08:00
Matt Hildebrand 6af2ddafe5 Update netty-tcnative to 1.1.33.Fork11. 2016-01-30 17:56:01 -05:00
Matt Hildebrand cdb9ca1912 Run TLS integration tests using OpenSSL also. 2016-01-29 22:06:19 -05:00
Carl Mastrangelo ba4a6ca47b Update to netty 4.1.0.CR1 2016-01-29 17:55:18 -08:00