Commit Graph

390 Commits

Author SHA1 Message Date
Kun Zhang 90706dc48f Rename the codegen binary from java_plugin to protoc-gen-grpc-java 2015-04-09 15:24:46 -07:00
Jakob Buchgraber e8afa3ca23 Fix bug where the stream id would not get incremented for buffered streams. 2015-04-09 13:04:39 -07:00
Xudong Ma 9d214637e6 Temporally support Http protocol name "h2-16" for OkHttp client.
Fixes #22 for real.

Manually tested with jdk8 by:
./run-test-server.sh
./run-test-client.sh --server_host_override=foo.test.google.fr --use_test_ca=true --use_okhttp=true
2015-04-09 13:50:18 +08:00
Xudong Ma 775829a1b2 okhttp: Reset stream when receiving window is negative.
Resolves #215
2015-04-09 09:07:59 +08:00
Eric Anderson fd7ba566aa netty: Use the bootstrap ClassLoader for ALPN/NPN
If ALPN.class isn't in the bootclasspath, we don't want to find it as it
won't work. Also, if someone has fiddled with ClassLoaders, we really
want to make sure we get the proper ALPN class.

Passing "null" to Class.forName() means "bootstrap class loader". In
fact, ClassLoader.getParent() says, "Some implementations may use null
to represent the bootstrap class loader."

We must load the Proxy in the bootstrap class loader as well, because
our class loader may not have access to ALPN.{Client,Server}Provider,
for the same reasons as above. Even if we have multiple instances of
gRPC (due to class loaders), combined they will only create two Proxy
classes: one for ALPN.ClientProvider and one for ALPN.ServerProvider.
2015-04-08 15:37:44 -07:00
Jakob Buchgraber 44f9904ab0 Replace 'internal' import with correct one.
The errornous import was introduced by my previous commit 5f70a12cfc
2015-04-08 12:54:30 -07:00
zhaohaifeng 63db06850e Add simple HelloWord example handling custom header 2015-04-08 08:45:06 -07:00
Xudong Ma f3ccdd99f1 Fixes Travis breakage 2015-04-08 13:00:09 +08:00
Xudong Ma c2f039411a TLS support for okhttp transport.
Resolves #22

Add an API to let users specify ConnectionSpec.
2015-04-08 12:41:35 +08:00
Jakob Buchgraber 5f70a12cfc Remove blocking on client stream creation and buffer RPC Calls for when the MAX_CONCURRENT_STREAMS limit is hit. Fixes #118 2015-04-07 17:06:21 -07:00
Jakob Buchgraber ce860f9003 fix compile error introduced by previous commit 2015-04-07 13:00:24 -07:00
Jakob Buchgraber 105964bfac Fix memory leak by adding the Http2StreamRemovalPolicy to the channel pipeline.
In benchmarks we would see grpc talking up tens of gigabytes of memory. A heap dump
revealed that streams would not get cleaned up and stick around in memory forever.
2015-04-07 12:56:27 -07:00
Xudong Ma fcf1517054 Respect MAX_CONCURRENT_STREAMS in OkHttp client.
If a newStream is called  while MAX_CONCURRENT_STREAMS is reached, then get the call blocked and the request queued, until:
1. a running stream closed, and this newStream() request is accepted.
2. receives go-away from server, fail all pending new stream requests.
3. the available ids are exhausted.
2015-04-07 09:53:47 +08:00
Xudong Ma 9aae6f65fa checkstyle change:
1. Adds <property name="separateLineBetweenGroups" value="true"/> to CustomImportOrder to enfore blank line between imports groups.
2. Uses checkstyle 6.5, which fixed a bug of "CustomImportOrder checks import sorting according to ASCII order instead of case-insensitive alphabetical order".
2015-04-07 08:27:48 +08:00
Eric Anderson 45682dbc18 Hold lock while reading isThreadScheduled
isThreadScheduled is @GuardedBy("internalLock").
2015-04-06 14:13:49 -07:00
Eric Anderson d70d91b5d6 Improve JavaDoc for Status 2015-04-03 16:07:46 -07:00
Eric Anderson 74c9b5ed02 Fix JavaDoc references to non-imported class
The ServerImpl import was removed because it wasn't used as far as
checkstyle was able to determine. However, it was being used to resolve
JavaDoc references. Instead of re-adding the import just make the
reference fully qualified to prevent the two systems from continuing to
disagree on whether it is needed.
2015-04-03 15:11:51 -07:00
Xudong Ma 2cad9e6000 Add "unsed import" check. 2015-04-03 16:55:01 +08:00
Xudong Ma c813ec5ad1 Change the package option of example protos to be same as grpc-common 2015-04-02 17:12:37 +08:00
Xudong Ma eb2d65bb0c Disable Nagle's algorithm, this was exposed by our internal micro benchmark, the streamingInputCall() method happened to have the write-write-read pattern which added 40ms extra delay.
According to our micro benchmark, this change improves the performance, see https://screenshot.googleplex.com/cfxjPGxkgF.png for the previous results, there were 4 out of 6 scenarios had higher latency than netty transport.

https://screenshot.googleplex.com/Rq92tYMvBE.png shows the results after this change, the latencies in all scenarios are less than netty transport.

This commit fixes #60.
2015-04-02 13:44:47 +08:00
Eric Anderson a375eccbea Use codegen for integration testing
test.proto was taken from C++ interop in the grpc repo and slightly
modified (imports, option java_package, proto3)
2015-04-01 09:51:57 -07:00
Eric Anderson 16055787fa Cache Gradle and not really Maven
Artifacts that Gradle caches from Maven Central go in
~/.gradle/caches/modules-2, not ~/.m2. We only need .m2 for the
locally-installed Netty.
2015-04-01 09:03:06 -07:00
nmittler 11d0094e04 Upgrading to the latest Netty 4.1 branch. 2015-03-31 14:14:29 -07:00
Eric Anderson 9bd31daee6 Wait for handler registration 2015-03-26 12:35:31 -07:00
zhangkun83 966e120098 Add precondition to throw more informative exception when calling request() before start() has been called. 2015-03-26 10:54:59 -07:00
Eric Anderson 191dcd38ac Test whether inbound flow control functions
The previous flow control test would work without issue even if flow
control was being ignored.
2015-03-26 10:09:51 -07:00
Eric Anderson b48b4db3fb Fix synchronization in client auth
The synchronization was simply using the wrong object, so no
synchronization was actually occurring. In addition, reference of cached
outside of synchronized block could permit using a partially constructed
cached object, as the reference may be set before instantiation
completes.
2015-03-26 07:35:07 -07:00
Eric Anderson e515c772cd netty: Status should be based on GOAWAY code
goingAway() is called before onGoAwayRead() in Netty:
b7f57223c1/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionDecoder.java (L521)

The test before checked that the stream went away, but not that the
GOAWAY code influenced our Status, as UNAVAILABLE is the default
internally.

The UNAVAILABLE default has also been changed to include a message so
that we can determine where the Status came from in case it is triggered
again in the future.
2015-03-25 11:04:52 -07:00
nmittler 6407c18578 Default client connection window to 1MiB. 2015-03-24 10:29:20 -07:00
nmittler ab9f82756a Making connection and stream windows configurable for Netty. 2015-03-24 10:14:55 -07:00
Eric Anderson a3b353ce54 Disable Travis parallel building to reduce memory usage
We were seeing errors on Travis like:
> Process 'Gradle Test Executor 2' finished with non-zero exit value 137

That doesn't make much sense, other than maybe the OOM killer killing
our processes. Turning off parallel execution seemed to fix the problem,
so we'll just assume memory was the actual problem and doing fewer
things in parallel reduces our maximum memory usage.

Travis documentation seems to agree with that being a likely cause:
http://docs.travis-ci.com/user/common-build-problems/#My-build-script-is-killed-without-any-error
2015-03-24 09:56:19 -07:00
Eric Anderson 2cbbd4706a Split large payload into separate test with higher timeout
Also show more exception info in case the test still fails.
2015-03-23 12:06:03 -07:00
Eric Anderson d8fb6f0bad Use TLS for Netty integration tests 2015-03-23 09:25:05 -07:00
Eric Anderson bcb3e8cef4 Remove readlink -f in run-test*.sh scripts
readlink -f allows the script to be run via a symlink yet still
function.  However, OS X doesn't have the -f flag. We don't really care
too much about symlinking to the scripts, so just drop readlink -f.
2015-03-23 09:23:41 -07:00
Eric Anderson b1201e7c3e Enable parallel Gradle builds for Travis
Parallel doesn't mix well with deployment, so if that becomes part of
Travis, we would need to pass -Dorg.gradle.parallel=false to the gradle
command line. But otherwise parallel builds have been solid.
2015-03-23 09:16:41 -07:00
Eric Anderson 26141b445d Allow checkstyle failures fatal, and fix last issues
Failing disabled by default, but setting checkstyle.ignoreFailures=false
in ~/.gradle/gradle.properties enables failing. Travis will always run
with such failing enabled.
2015-03-23 09:10:53 -07:00
Thomas ten Cate 9175d9d79e Fix data corruption issue receiving payloads > 2kB
Also add OkHttpReadableBuffer unit test, and increase the test string
length to expose the bug.

Also use array equality assertions in the base test, instead of
comparisons whose return value is discarded.

Fixes #231.
2015-03-22 13:14:57 +01:00
Eric Anderson 7865b031e1 okhttp: code style fix; handle exception
For code style, we either need a comment describing why an exception is
ignored or to actually handle the exception. In this case there doesn't
seem to be a strong reason to ignore the exception, but it isn't all
that important either, so just log at INFO.
2015-03-21 09:12:30 -07:00
Xudong Ma 79ef04bc91 Fix a race condition in the test, we may nitify MockFrameReader to return before it satrts waiting.
This commit fixes #223
2015-03-21 23:01:06 +08:00
Eric Anderson 2f3c173179 Protobuf java/nano are now on Maven Central 2015-03-20 14:50:10 -07:00
Eric Anderson a0acb9b9a8 Working Travis build, with caching of deps 2015-03-20 14:27:32 -07:00
Louis Ryan c42c8c420d Basic travis configuration 2015-03-20 11:37:30 -07:00
Eric Anderson a6edc294fc Improve Status exception message
When the description is null, the exception message would be in the form
of "INTERNAL: null", which isn't very attractive, and makes it seem like
an error in itself. If the description is null, just use "INTERNAL".
2015-03-20 10:29:11 -07:00
Eric Anderson 78cde0ddc0 Move Status.toString next to other methods 2015-03-20 09:47:34 -07:00
Xudong Ma 3db92977fa Add missing @RunWith. 2015-03-18 11:22:49 +08:00
Eric Anderson f38c2a06d9 Add missing copyright headers 2015-03-16 22:11:10 -07:00
Eric Anderson 69cef51ac2 Improve CONTRIBUTING.md 2015-03-16 22:09:48 -07:00
Xudong Ma 7c6b627170 Close frame reader and notify the listener in reader thread, to avoid reading after reader is closed. 2015-03-17 08:04:07 +08:00
nmittler 23972a25b9 Adding outbound flow control API for the transport API 2015-03-16 14:17:03 -07:00
nmittler 9f5614501d Adding outbound flow control API for Call/ServerCall 2015-03-16 12:59:15 -07:00