Commit Graph

91 Commits

Author SHA1 Message Date
nmittler 29c43c1c2d Upgrading to the latest Netty version. 2015-04-28 10:31:38 -07:00
Louis Ryan f679edcfcc Fix memeory leak in MessageFramer caused by allocation of 'empty' buffers never being released.
The buffers are not empty in reality as the allocators enforce a minimum size
2015-04-28 10:10:00 -07:00
Jakob Buchgraber 3a4f4b5a06 Add support for setting the connection and stream flow control window to NettyServerBuilder.
- Updated related comments in NettyServerBuilder and NettyChannelBuilder.
- Fixed related tests in NettyChannelBuilder.
2015-04-24 10:46:50 -07:00
Xudong Ma 2f4aa5a490 Use Status "UNKNOWN" instead of "INTERNAL" when Status.fromThrowable can not find a cause with a status. 2015-04-24 10:52:27 +08:00
Louis Ryan f7010f2eac Use message size as a hint to the allocator for buffer capacity.
Set upper and lower bounds for Netty & OkHttp allocators based on transport limitations and benchmark results.
Fix OkHttp OutboundFlowController to chunk payloads larger than frameWriter.maxDataLength
Allow OkHttp to allocate buffers to FrameWriter larger than max DATA length
2015-04-23 16:58:43 -07:00
nmittler 3ecbd0456a Upgrading to latest Netty version.
This is to resolve the issue of receiving frames for closed (and
therefore missing) streams.
2015-04-22 10:46:07 -07:00
Eric Anderson fc3e41674b Propagate explicit flushes through MessageFramer
MessageFramer allows queing of data and explicit flushing. Sinks
generally can benefit from knowing when they are required to flush, so
we now tell them when MessageFramer received a flush so they only have
to flush when required.
2015-04-21 10:29:08 -07:00
Eric Anderson 23aac9e9ec Fix netty closure check
During Service removal a condition was inverted but incompletely, which
caused the Netty server to never shutdown.
2015-04-16 12:29:24 -07:00
Eric Anderson 4f4f8e40bf Remove Guava's Service from server transport
ServerImpl.start() now throws IOException to make the error explicit.
This was previously being papered over by wrapping the exception in
RuntimeException.
2015-04-16 11:28:04 -07:00
nmittler f920badc5e Upgrading to the latest Netty version. 2015-04-16 08:42:56 -07:00
Xudong Ma 883eb62de4 OkHttp: Temporally support multiple h2-xx protocol on client side.
Since the user provided SSLSocketFactory (especially in Android) may already do the handshake when creates the SSLSocket, and it may choose a different protocol name other than the one OkHttp is using.

Resolves #293
2015-04-16 09:04:19 +08:00
Eric Anderson 5b2e336b6f netty: Add option to set MAX_CONCURRENT_STREAMS 2015-04-13 13:46:36 -07:00
Eric Anderson 1e257c440e Remove unused local variable 2015-04-10 08:58:43 -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
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
Xudong Ma f3ccdd99f1 Fixes Travis breakage 2015-04-08 13:00:09 +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 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 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
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
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 c3e8dae6ce Add checkstyle checking
The checkstyle.xml is a slightly modified version of the upstream Google
checkstyle configuration. All changes have comment describing them.

Lots of warnings were corrected. Examples is the only project that has
warnings still, as the necessary changes require some thought.
2015-03-16 10:53:13 -07:00
Jakob Buchgraber 54c31b0325 Fix compile error introduced by previous commit 2015-03-13 15:12:40 -07:00
Louis Ryan 3f7325ecf5 Allow switching between Netty 4 & 5 by restricting to intersection of interfaces 2015-03-13 14:57:55 -07:00
Jakob Buchgraber 0076243063 Add WritableBuffer interface for zero copy data writes. Fixes #8
WritableBuffer is a generic interface that allows to transfer data
from gRPC directly to the native transport's buffer implementation.
2015-03-13 13:00:44 -07:00
Louis Ryan 1216de6262 Add support to Netty builders for other channel types. Demonstrate and test use of this with local channels 2015-03-12 16:05:33 -07:00
nmittler d4d66a5fef Better error description onGoAwayRead 2015-03-12 08:16:52 -07:00
Jakob Buchgraber f822416f35 Use DEFAULT_WORKER_EVENT_LOOP_GROUP for both client and server. Fixes #82
+ Use only one thread for the boss eventloop group by default.
2015-03-11 14:31:51 -07:00
nmittler 2a425090d1 Migrating to Netty 4.1
Fixes #164
2015-03-11 13:18:27 -07:00
nmittler 54be11ef3c Updating to the latest Netty version. 2015-03-10 15:43:19 -07:00
Nathan Mittler f1b6f623c5 Merge pull request #166 from nmittler/doclint
Tightening up error message for GO_AWAY.
2015-03-09 13:49:03 -07:00
nmittler dfcfb7bca1 Tightening up error message for GO_AWAY.
The attempt here is to identify all causes of GO_AWAY and to ensure
there is a reasonable description to help understand the cause.

Fixes #163
2015-03-09 13:48:15 -07:00
nmittler 4deff027ba Proper buffer closure when receiving DATA with EOS
The Http2ClientStream should not close the buffer in this case since
it's already been given to the deframer and potentially to the user.

Added cleanup code to MessageDeframer and AbstractClientStream to make
sure that we free the Buffer when appropriate.
2015-03-09 13:28:32 -07:00
Jakob Buchgraber 4a2c0a5637 Have SendGrpcFrameCommand constructor take an AbstractStream object instead of a stream id.
As part of the effort to remove all blocking bits from the NettyClientStream with
this commit the SendGrpcFrameCommand now takes a stream object instead of the
stream id. This will be necessary as in a non blocking world the stream id might
not have yet been allocated when the SendGrpcFrameCommand gets instantiated.
2015-03-02 11:37:57 -08:00
Jakob Buchgraber 1961402104 Revert "Have SendGrpcFrameCommand constructor take an AbstractStream object instead of a stream id."
This reverts commit 0d78268b83.

Some unit tests aren't compiling due to this change.
2015-02-25 14:05:57 -08:00
Jakob Buchgraber 7ef1781016 Cleanup and Nitpicking
- Renamed 'eventGroup' property to 'group' as this what's used elsewhere.
- Moved assignment of the channel before the listener is added as currently
  there is a (theoretical) chance that the listener is executed before the assignment
  to channel happens, namely in case the Future is already done when the listener
  is added.
- Removed comment that seemed out of place / relict.
2015-02-25 12:28:25 -08:00
Jakob Buchgraber 0d78268b83 Have SendGrpcFrameCommand constructor take an AbstractStream object instead of a stream id.
As part of the effort to remove all blocking bits from the NettyClientStream with
this commit the SendGrpcFrameCommand now takes a stream object instead of the
stream id. This will be necessary as in a non blocking world the stream id might
not have yet been allocated when the SendGrpcFrameCommand gets instantiated.
2015-02-25 12:20:35 -08:00
Nathan Mittler 488f8a9989 Merge pull request #117 from nmittler/stream_removal_fix
Fixing memory leak in stream removal policy
2015-02-25 09:55:40 -08:00
nmittler 23f513c0d2 Some comment cleanup in the Netty builders. 2015-02-24 13:16:21 -08:00
nmittler cc170418ea Fixing memory leak in stream removal policy
The stream removal policy was never being added as a handler, so it was
never starting its periodic timer to remove streams.
2015-02-24 12:55:26 -08:00
Louis Ryan 425e3c0b7f Remove dead GrpcFramingUtil class 2015-02-23 17:44:23 -08:00
Louis Ryan 95c6f5082c Udate TODOs to use Github user names 2015-02-23 12:46:28 -08:00