Commit Graph

1121 Commits

Author SHA1 Message Date
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
Eric Anderson 1488010cb1 Use generics for LoadBalancer to avoid ClientTransport exposure
TransportManager.makeTransport() was added to remove the only other
reference to ClientTransport outside of core and the transports.
2016-01-29 17:48:01 -08:00
Eric Anderson bf42913c23 Fix artifact upload for compiler
check-artifact.sh was broken by the update to Gradle 2.10. We think the
update to Gradle 2.8 caused the POM to start being generated, but this
now fixes it to have the correct contents.

Using addFilter _disables_ the normal POM, so we use setFilter instead.

Fixes #1360
2016-01-29 17:16:58 -08:00
Carl Mastrangelo 127e7c04a0 Fix executor propagation in CallOptions. 2016-01-29 15:25:24 -08:00
Carl Mastrangelo 8a40989fef Fix OOM errors that happen occasionally 2016-01-29 12:58:57 -08:00
Kun Zhang ba54513f5c Fix a concurrent modification in BlankFutureProvider.
The Set from Collections.synchronizedSet() is not protected against
concurrent modification during iteration. We copy an ArrayList out of it
for iteration.
2016-01-28 11:27:04 -08:00
Kun Zhang e2ed2e8f03 Upgrade to protobuf-3.0.0-beta-2 and protobuf-nano-3.0.0-alpha-5
Update option name that disables protobuf tests.
2016-01-27 23:32:01 -08:00
nmittler b7c4e18dcd Change status of HTTP/2 NO_ERROR to UNAVAILABLE.
Fixes #1355
2016-01-27 11:10:54 -08:00
Eric Anderson 52f17055a4 Document where to put proto files when using build plugins 2016-01-27 10:43:42 -08:00
Kun Zhang d3d253e792 Upgrade to protobuf-gradle-plugin 0.7.4 2016-01-26 17:35:02 -08:00
Kun Zhang 29784d1afb Fix grpc-compiler build. 2016-01-26 15:30:35 -08:00
Eric Anderson 46ce4098c5 Update gradle to 2.10
Gets us past some minor DSL changes and should get increased build
performance. Will make it easier to update to 2.11 and other future
versions.
2016-01-26 13:38:04 -08:00
Eric Anderson 4168f67e38 Optimize blocking calls to avoid app thread pool
This reduces the necessary number of threads in the application executor
and provides a small improvement in latency (~15μs, which is normally in
the noise, but would be a 5% improvement).

Benchmark                         (direct)  (transport)  Mode  Cnt       Score        Error  Units
Before:
TransportBenchmark.unaryCall1024      true    INPROCESS  avgt   10    1566.168 ±     13.677  ns/op
TransportBenchmark.unaryCall1024     false    INPROCESS  avgt   10   35769.532 ±   2358.967  ns/op
After:
TransportBenchmark.unaryCall1024      true    INPROCESS  avgt   10    1813.778 ±     19.995  ns/op
TransportBenchmark.unaryCall1024     false    INPROCESS  avgt   10   18568.223 ±   1679.306  ns/op

The benchmark results are exactly what we would expect, assuming that
half of the benefit of direct is on server and half on client:
1566 + (35769 - 1566) / 2 = 18668 ns --vs-- 18568 ns

It is expected that direct=true would get worse, because
SerializingExecutor is now used instead of
SerializeReentrantCallsDirectExecutor plus the additional cost of
ThreadlessExecutor.

In the future we could try to detect the ThreadlessExecutor and ellide
Serializ*Executor completely (as is possible for any single-threaded
executor). We could also optimize the queue used in ThreadlessExecutor
to be single-producer, single-consumer. I don't expect to do those
optimizations soon, however.
2016-01-26 12:41:50 -08:00
Eric Anderson f59e04f310 Permit overriding Channel's executor per-call 2016-01-26 12:41:50 -08:00
nmittler 70ef5b1172 Make handling of GoAwayClosedStreamException more consistent. 2016-01-26 11:39:06 -08:00
Eric Anderson 484c46c62b Revert minor grammar tweaks to avoid syncing readme
The certs are used a lot of places, and we would prefer they stay
identical. This small grammar changes from 95d7bfd don't seem to
contribute enough for the effort envolved to sync.
2016-01-25 14:23:43 -08:00
Eric Anderson fe5e624153 Avoid cancel before start, which is not handled in transports
When triggered, it caused the ClientCall.Listener never to complete.
Fixes #1343

The new test doesn't actually fail on my machine with the old code, but
we would hope it would be flaky. Since a race is involved, I don't
expect a more reliable test.
2016-01-25 13:20:10 -08:00
Eric Anderson 15d86d9c42 Parameterize TlsTest for TLS provider 2016-01-25 13:17:19 -08:00
Eric Anderson 0a2a4ec4d2 Move resource freeing out of test methods
This avoids the try-finally, which would have gotten even larger to
shutdown the channels.
2016-01-25 13:17:19 -08:00
Eric Anderson 1d8af602f7 Run make with as many cores as available 2016-01-25 09:35:42 -08:00
Eric Anderson 7677525c37 Log start of test and don't wait forever
With this, the test should no longer time out in case of error and there
is more information available to determine which test has issues if
there are further problems.
2016-01-25 09:14:53 -08:00
Eric Anderson c70a769da7 Wait 5 seconds, not over an hour 2016-01-25 08:54:13 -08:00
Kun Zhang 2bd0887db3 Use `docker cp` to copy files to docker containers.
`scp` won't work anymore on google workstations.
2016-01-22 15:42:29 -08:00
Eric Anderson 4aee912bce Fix broken noClientAuthFailure test
The client didn't have the trust manager set, so the RPC would fail due
to server-certificate verification, not lack of client auth.

With this change, noClientAuthFailure now fails with tcnative but still
passes with Jetty ALPN.

basicClientServerIntegrationTest seems to be working for me, so I'm
enabling it.
2016-01-22 12:59:36 -08:00
Eric Anderson cfbd7efcf0 Use tcnative for interop unit tests when possible.
We are already building a new enough OpenSSL on Travis for both Linux
and OS X and Jenkins for Windows.
2016-01-21 16:40:29 -08:00
nmittler 2b4120032c Making choice of OpenSSL more explicit in SECURITY doc 2016-01-21 15:01:35 -08:00
Matt Hildebrand 95d7bfd2b9 Add some initial integration tests for GRPC's TLS support.
Tests run using Jetty ALPN only, not using OpenSSL.
2016-01-21 13:46:19 -08:00
Carl Mastrangelo 509c7e7335 Make Benchmark Client terminate after running 2016-01-19 16:49:47 -08:00
Eric Anderson d52429dffd Reduce number of codegen'd classes needed for Services
This reduces the number of classes defined, which reduces memory usage.
It also reduces the number of methods defined, which is important
because of the dex limit.

This should have virtually zero performance degradation because the
contiguous switch uses tableswitch bytecode.
2016-01-15 16:45:41 -08:00
Eric Anderson 853ccaa7b6 Start 0.13.0 development cycle 2016-01-15 16:12:57 -08:00
Eric Anderson df310fe2b5 More precise exception handling in examples
Try to make it clear how failures propagate and provide hints on how to
get more error information.
2016-01-15 14:26:27 -08:00
Carl Mastrangelo 0486af6a88 Raise method visibility in Channel Providers 2016-01-14 11:12:53 -08:00
Eric Anderson a4a8438401 Avoid NettyServerBuilder in security documentation
The more generic ServerBuilder is all that is necessary.
2016-01-14 10:33:49 -08:00
Carl Mastrangelo 846794e578 Fix OkHttp bug where streams could be started after they had been cancelled 2016-01-13 18:41: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
Carl Mastrangelo 5205d9cc43 Fix unsynchronized access in InProcessTransport 2016-01-12 13:16:51 -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 725209ce6c Fix memory leak with cancellation timeouts 2016-01-06 13:45:48 -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
Kun Zhang fb8532a711 Fix issues discovered by internal GRPCLB integration test.
- Set knownAcceptEncodingRegistry in SingleTransportChannel
- Change the package name of load_balancer.proto to be consistent with
  what is used internally.
2015-12-30 14:41:23 -08:00
Feng Li 2719a8c858 Updates the README.md to add instructions to start test server. 2015-12-28 17:10:43 -08:00
Kun Zhang 59c1a6ae26 Use lbTransport if the LB request got a UNIMPLEMENTED response 2015-12-21 14:48:44 -08:00