Commit Graph

1426 Commits

Author SHA1 Message Date
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
Carl Mastrangelo 707302d76e Update type and comment in Timeoutmarshaller 2015-12-21 14:03:29 -08:00
Xudong Ma d948330ef2 [OkHttp]Add hostname verification. 2015-12-21 11:30:02 -08:00
Kun Zhang 663a4f4390 Make BlankFutureProvider preserve the order.
Use LinkedHashSet in BlankFutureProvider so that it fulfills the futures
in the same order as they were created. This makes the behavior more
predictable, thus fixes the flakiness of GrpclbLoadBalancerTest and
simplifies BlankFutureProviderTest.
2015-12-18 13:39:05 -08:00
Carl Mastrangelo d3d8adbab6 Allow support for nanosecond timeouts, and use nanoseconds consistently throughout our code 2015-12-17 18:22:47 -08:00
Kun Zhang e83ac98477 The GRPCLB load-balancer.
This LoadBalancer does round-robin on a address list received from a
separate "load-balancer service", via the protocol defined in
load_balancer.proto. Everything is put under a subproject `grpc-grpclb`,
because it has dependency to protobuf.

updateRetainedTransports() now accepts EquivalentAddressGroups.  The
LoadBalancer merges the LB and normal server address groups when calling
it.
2015-12-17 11:10:46 -08:00
Kun Zhang 4abb022375 Cancel the transport future when the call is cancelled.
This is to prevent leaking future objects in BlankFutureProvider.
Resolves #1188
2015-12-17 10:14:58 -08:00
Carl Mastrangelo e0b1149902 Removed unsused variables 2015-12-16 10:20:10 -08:00
Carl Mastrangelo f5d09ff0b2 Disallow compressing zero length messages. 2015-12-16 10:03:17 -08:00
Carl Mastrangelo e967be8d3f More each coverage 2015-12-15 17:12:16 -08:00
Carl Mastrangelo c1800943ff Bump test coverage 2015-12-15 14:19:25 -08:00
Carl Mastrangelo 829735bb25 Fix gaurded by 2015-12-15 12:35:09 -08:00
Carl Mastrangelo b9cacc1553 update tests 2015-12-14 16:09:28 -08:00
Carl Mastrangelo 7ac44928be Fix bug where server wouldn't declare the negotiated compression 2015-12-14 15:48:01 -08:00
Xudong Ma d238d86a3c Some changes to Android interop test App:
1. Call runTest() for test "all", this is required by some internal code.
2. Turn off proguard for debug App.
3. Catch Throwable when we run the test, so that some errors like OutOfMemoryError would fail the test.
4. Compare message size for veryLargeResponse test, otherwise comparing two message would create two more large byte arrarys.
2015-12-14 13:11:59 -08:00
Kun Zhang 7ce50f76c7 Revert to lazy-connection.
`TransportSet` won't connect/reconnect until a transport is requested
through `obtainActiveTransport()`.
Lazy connection is safer, and more desirable in mobile environments.
It's also what C core is doing.

To warm up connections, `LoadBalancer` can call
`TransportManager.getTransport()`, even periodically if it wants to
maintain live connections.
2015-12-11 10:40:19 -08:00
Eric Anderson 7450bf6a17 Swap to "old" link for OpenSSL download with Travis
The previous download link only worked for the most recent version. The
new form only works for old versions. That will encourage us not to use
the latest version, but for tests that's probably not a big deal.

We haven't noticed the breakage sooner because the build results are
cached.
2015-12-10 16:33:06 -08:00
Xudong Ma d41a0fa38e Use getClassLoader() instead of Thread.currentThread().getContextClassLoader() for android.
See #1272 for more details.
2015-12-10 15:06:47 -08:00
Kun Zhang 16247153f6 Move default scheme decision from ManagedChannelImpl to NameResolver.Factory.
This makes it possible to use a default scheme other than "dns" by
installing a custom NameResolver.Factory to the channel builder.
2015-12-10 14:40:46 -08:00
Carl Mastrangelo 4b18f49330 Move ServerCall unary check and add tests 2015-12-10 13:01:48 -08:00
Carl Mastrangelo 82a79d8f93 Expose compression on ClientCall and Server Call 2015-12-08 10:49:27 -08:00
Carl Mastrangelo 3fef40368d Make TestUtils able to read from input stream. This makes it easier to pass in an input stream from a resource 2015-12-07 17:28:25 -08:00
Carl Mastrangelo 529b14c07b Add compressor registry, and auto negotiate compression 2015-12-07 10:56:16 -08:00
Eric Anderson 96f9cefda4 Close active streams on channelInactive
We think this broke when the stream lifecycle listener was removed.
Observing the stream lifecycle would be the "proper" fix, but it had
notification ordering issues where streams would close before we were
notified of the event that caused the closure, which made it difficult
to provide useful error messages. The ordering of notifications was also
largely undefined.

The long term fix we look forward to is the HTTP/2 child channels, which
should have clearly defined ordering between error notification and
channel closure, and in the order that we need here.

Fixes #1251
2015-12-07 09:00:41 -08:00
Xudong Ma 8d0b5b0c4d Replace name in TODO to a known name, otherwise MOE will complain about it 2015-12-04 16:51:48 -08:00
Xudong Ma a7398dba38 Create a No-op stream in ClientCallImpl.start() if the Context has been cancelled. 2015-12-04 16:03:09 -08:00
Eric Anderson f83a6b8761 Don't leak streams when using DelayedStream
Locking is necessary to avoid race with setStream() since the
application may be calling cancel() in another thread, and we must not
call listener.close() multiple times.
2015-12-04 14:57:41 -08:00
Eric Anderson f6a29241e8 Call ClientStreamListener directly from current thread
ClientStreamListener is intended to be called directly from the
transport, so it is safe to hold locks during the call and run on the
network thread.
2015-12-04 14:51:56 -08:00
Eric Anderson 33db8adda4 Remove outdated and misleading JavaDoc
"onHeaders always is called" is from the initial gRPC design where
0-many context frames were sent before the first message. That is why it
was possible for "no headers were received". That has long-since not
been true, but in the various refactorings this language was
accidentally left. The language "Headers always precede messages" is
correct since headers are only guaranteed if messages were sent.
2015-12-04 14:47:54 -08:00
Xudong Ma 975c38e77c Keep our certs used for testing the same with their internal version 2015-12-04 13:45:48 -08:00
Xudong Ma c3e7541731 Add missing @RunWith, it is required internally 2015-12-03 17:22:36 -08:00
Eric Anderson a1ed98fbae Add missing generics 2015-12-03 14:36:08 -08:00
Eric Anderson 53cc86aafc Remove unused variable 2015-12-03 14:36:08 -08:00
Louis Ryan 7f2678a332 Switch from INTERNAL to CANCELLED for InterruptedException 2015-12-03 14:33:39 -08:00
Carl Mastrangelo e0ea1a10fc Move DelayedStream to its own file 2015-12-03 11:24:49 -08:00
Eric Anderson f8ff71d933 Shut down LB and NameResolver when shutting down Channel 2015-12-03 09:56:05 -08:00
Louis Ryan be6008666e Initial basic implementation of context binding for clients with some limited testing
Adds utility functions for working with Contexts and interceptors
Use 'name' as Context.Key.toString to make conversion to Metadata simpler
2015-12-02 15:33:58 -08:00
Xudong Ma 944edc4601 [Android-interop-test] Fail the instrumentation if any exception is thrown during the channel initialization. 2015-12-02 11:37:30 -08:00
Xudong Ma ee56c4940d Update Android interop test App to use ManagedChannelBuilder 2015-12-02 11:20:05 -08:00
Kun Zhang ad70a28d21 Move the pick-first logic from SimpleLoadBalancer to TransportSet.
TransportSet (as well as TransportManager) accepts a group of equivalent
addresses (EquivalentAddressGroup) instead of a single address.
TransportSet will move down the address list when reconnecting, and
applies back-off only after the entire list has been tried.

Main benefits:
- It will stop channel from trying to reconnect addresses that have been
  failed to connect to and moved away from. (#1212)
- It will make future implementation of Happy Eyeballs possible, inside
  TransportSet.

Tested: covered by TransportSetTest and
ManagedChannelImplTransportManagerTest.
2015-12-01 13:17:52 -08:00
Xudong Ma 88491c064f [okhttp] Use upper layer passed-in resolved address instead of resolving the hostname by itself. 2015-11-25 16:48:58 -08:00
Xudong Ma 097e3a8c65 coalesce pending flushes in OkHttpClientStream.start(). 2015-11-25 16:44:08 -08:00
Eric Anderson 036af15b66 Remove double-"brew update" as now unnecessary
The issue is closed and our latest runs on Travis are only needing to
run brew update once.
2015-11-25 14:21:06 -08:00
Eric Anderson 2db02b52be Reduce advertised Netty API
NettyServer wasn't usable as public, since its constructor was
package-private. So although this reduces our API, it shouldn't actually
impact anyone.

Fixes #1047
2015-11-25 14:12:10 -08:00
Eric Anderson 7ba9ca4861 Map IOException during connecting to UNAVAILABLE
This isn't expected to have much impact once the connection is
established because AbstractNettyHandler.exceptionCaught() wraps all
unknown exceptions with Http2Exception. Fixing that is future work.

Some cases we may now be unwrapping a StatusException, such as one
thrown by MessageDeframer. In general, that seems a Good Thing™, but it
is unclear exactly if it would be perceivable.

Fixes #1181
2015-11-25 09:43:38 -08:00
Carl Mastrangelo 1a32366242 Expose message compression on Server Call 2015-11-24 16:48:25 -08:00