Commit Graph

1426 Commits

Author SHA1 Message Date
Lukasz Strzalkowski 14bc16e8eb Update Attributes.Key conventions
We don't need to require namespacing it's not necessery anymore
since object is used by the key, not key name.
2016-03-17 19:46:26 -04:00
Lukasz Strzalkowski c3011b0798 Move server call keys to ServerCall class 2016-03-17 19:46:26 -04:00
buchgr d927180a63 Use Netty's DefaultThreadFactory instead of Guava's ThreadFactoryBuilder.
So far, we have passed a custom Executor to the NioEventLoopGroup constructor,
in order to get custom thread names and be compatible with both Netty 4 and
Netty 5. However, Netty 5 is no more (RIP) and Netty's DefaultThreadFactory
includes some optimizations around thread local storage, that Guava's executor
does not have.

The thread names will be a bit different, as DefaultThreadExecutor additionally
puts in the thread pool id after the name prefix.

For example:

Before:
grpc-default-boss-ELG-0
grpc-default-worker-ELG-0
grpc-default-worker-ELG-1

After:
grpc-default-boss-ELG-0-0
grpc-default-worker-ELG-1-0
grpc-default-worker-ELG-1-1
2016-03-17 00:43:26 +01:00
buchgr 3c68c053f7 Remove ReferenceCounted and add close() to ClientTransportFactory. Fixes #927 2016-03-17 00:31:04 +01:00
Lukasz Strzalkowski 6a67a97a73 Add attributes to ServerCall 2016-03-16 15:39:42 -07:00
Lukasz Strzalkowski b37ebd6482 Add Key#of and Key#keys, use key object as map key, add tests 2016-03-16 15:39:42 -07:00
Carl Mastrangelo 12dfecba62 Chnage mispeling of jvaadoc in wihtLogiD 2016-03-16 10:38:27 -07:00
buchgr 8e3f375e95 Add null check for channel and calloptions when creating stub. Fixes #1438 2016-03-16 15:33:30 +01:00
Louis Ryan 7902017b07 Add CallStreamObserver and ServerCallStreamObserver which allow for application level interaction with flow control
while still allowing stubs to be used.
Currently these APIs are only useful on the server side, a separate proposal will be made for adding client support
An example of usage is in TestServiceImpl.streamingOutputCallManualFlowControl which listens for flow-control 'onReady' events and produces messages to the client.
Added some unit testing for ServerCalls
2016-03-15 16:45:45 -07:00
Louis Ryan de7ec3c682 Synchronize benchmarking protos with grpc/grpc 2016-03-15 14:05:07 -07:00
elandau 053a18e209 Use Attributes as the affinity data for LB.
- Remove RequestKey.
- Rename withRequestKey() to withAffinity(), which accepts an Attributes.
2016-03-14 15:13:42 -07:00
Carl Mastrangelo 1b5cb598da Speed up NanoUtilsTest by 10s 2016-03-14 13:26:31 -07:00
Eric Anderson 569dcb502e Remove last vestiges of ChannelImpl/ServerImpl from security doc 2016-03-14 11:47:30 -07:00
Eric Anderson cf86d81ef7 Rename older AbstractTransportTest to AbstractInteropTest
There are two AbstractTransportTests. The newest one is the more aptly
named, so rename the older one to AbstractInteropTest to remove name
collision when speaking.

Fixes #1484
2016-03-13 23:01:04 -07:00
Kun Zhang 08c74d46f5 Only link delayed transport AFTER real transport has called transportReady().
If TransportSet fails to connect a transport (i.e., transportShutdown()
called without transportReady()), TransportSet will automatically
schedule reconnection for the next address, unless it has reached the end
of the address list, in which case it will fail the delayed transport.

This will reduce stream errors caused by bad addresses appearing before
good addresses in the resolved address list.

Before this change, TransportSet would return the real transport on the
first call of obtainActiveTransport(). After this change, it will return
the delayed transport instead.
2016-03-11 14:46:44 -08:00
Eric Anderson 27d848901f Improve updating hosted JavaDoc for copy/pasting commands 2016-03-10 16:28:35 -08:00
Eric Anderson 397d8618a1 Update README to reference v0.13.2 2016-03-10 16:15:03 -08:00
Kun Zhang 016d4a5e22 Use bytes instead of a string for IP address.
Ported from internal.
2016-03-10 14:17:52 -08:00
Carl Mastrangelo 9913d1d0fc Initial attempt at json example 2016-03-10 11:33:06 -08:00
Eric Anderson 7c6c045d92 Remove support for Nano's deprecated package names
This requires that all nano protos have .nano in their package name. The
support is expected to be removed from protobuf soon, since using the
deprecated package name causes problems.
2016-03-10 11:00:32 -08:00
Eric Anderson eccd231131 Don't hold a lock in DelayedStream when calling realStream
Our current lock ordering rules prohibit holding a lock when calling the
channel and stream. This change avoids the lock for both
DelayedClientTransport and DelayedStream. It is effectively a rewrite of
DelayedStream.

The fixes to ClientCallImpl were to ensure sane state in DelayedStream.

Fixes #1510
2016-03-09 15:14:00 -08:00
Kun Zhang b9c12327eb Add log ID.
To ManagedChannelImpl, TransportSet and all client transport
implementations, so they can be correlated in the logs. Also added more
life-cycle logging in general.
2016-03-09 13:52:32 -08:00
nmittler b9196e3084 Adding RunWith annotation to ConcurrencyTest 2016-03-08 06:16:58 -08:00
Carl Mastrangelo 8ed0088eff Make Status code use percent encoding 2016-03-07 10:01:44 -08:00
Eric Anderson d192f1a6cb netty: GOAWAY should trigger transportShutdown
Long-lived streams or lengthy RPCs can keep the transport open for
minutes after a GOAWAY is received. Previously, during this time any new
RPCs would fail with a message like:

> Cannot create stream 5 since this endpoint has received a GOAWAY frame
> with last stream id 3

All usages of goAwayStatus were replaced with lifecycleManager. Although
note that previously goAwayStatus() would never return null because it
would generate a Status if the current field was null.
getShutdownStatus() does not have this feature, so some code was
rearranged to guarantee the Status is non-null before retrieving it.

The listener handling was simplified by 1) avoiding the need for
thread-safety and 2) moving state keeping into a small class for easy
comprehensibility and simplified usage in tests.

NettyClientTransport.shutdown() no longer calls transportShutdown()
because it lies (because the message can be delayed for quite some time)
and because it was the only usage of lifecycleManager not on the event
loop.

Fixes #1359
2016-03-07 09:35:18 -08:00
Kun Zhang 2491402036 Remove or use unused variables. 2016-03-04 17:05:23 -08:00
Carl Mastrangelo 946611909e remove unused var 2016-03-04 16:17:31 -08:00
Carl Mastrangelo ffe0dce85f Add missing override annotation to generated protos 2016-03-04 14:15:02 -08:00
Matt Hildebrand 56d9b17838 Test that gRPC clients and servers can handle concurrent RPCs. 2016-03-03 16:40:54 -08:00
Kun Zhang 0e14516f5a Run createTransportRunnable outside of lock.
Because `scheduleConnection()` is run under lock, if we ran
`createTransportRunnable` inside `scheduleConnection()`,
`savedDelayedTransport.setTransport()` will be under lock which violates
the assumption made in https://github.com/grpc/grpc-java/issues/1408 that

> there is an implicit rule today that channel layer will not hold any lock while calling into transport

and had caused deadlock with `InProcessTransport`.

Also updated tests to

 1. Make it clear that we want the first obtained transport to be the
 real transport instead of the delayed transport, because
 `InProcessTransport` has deadlock issues with delayed
 transport (grpc/grpc-java/pull/1510)

 2. Not rely on identity equity to check whether `TransportSet` has
 switched to a different address. Instead, call `newStream()` and check
 which real transport is actually called, which is more reliable.

 3. Add timeout when checking for real transport creation and
 starting. Tests in general should not check for implementation detail,
 e.g., whether certain work is done synchronously.
2016-03-03 16:35:12 -08:00
William Thurston a574159c81 Add interceptForward methods for Client and Server 2016-03-03 15:32:54 -08:00
Eric Anderson 3528467612 Treat ClosedChannelException as UNAVAILABLE to squelch test failures
Our tests are detecting cases where we are still getting
ClosedChannelException. We need to fix that because it is a useless
status, but until it is fixed we want a stable CI.

Fixes #1513 and NettyTransportTest.serverNotListening failures
2016-03-03 14:18:34 -08:00
Carl Mastrangelo 40d9cd1941 Add more debug output in TlsTest 2016-03-03 11:35:19 -08:00
Carl Mastrangelo 0e370eb155 Remove static initializer blocks 2016-03-03 09:51:51 -08:00
Carl Mastrangelo c85e04698f Make Route Guide client and server accept channel and server builers, respectively. 2016-03-02 16:24:31 -08:00
Carl Mastrangelo 8e1fba7c90 Use Protobuf Json formatting for routeguide example 2016-03-02 10:10:15 -08:00
Carl Mastrangelo 3a4b266b4f Bump gradle version to 2.11 2016-03-02 09:25:37 -08:00
Eric Anderson 1170afd168 Add transport test for Netty
Netty client shutdown would race with the negotiation handling and
circumvent AbstractBufferingHandler. Use a new command in order to
leave channel.close() available for abrupt killing of the connection
when connecting.

ping_afterTermination was previously racey that made it succeed. After
fixing the test, Netty would consistently fail to call callback. After
fixing Netty to fail the callback it was not using the right status
because when Netty's channel is closed none of our handlers are run.
This reliably fails the future with ClosedChannelException, which is
useless, so now we special-case that exception and fill in the reason
for shutdown.

To prevent accidentally reporting Status.OK, the transports no longer
use OK when calling transportShutdown. The OK status was already no
longer being consumed, since keying off whether transportReady was
called is more helpful.

This fixes #1330
2016-03-01 17:43:30 -08:00
Carl Mastrangelo 72f1e88d78 Inlcude the file that was used to generate service descriptors 2016-03-01 09:22:10 -08:00
Matt Hildebrand de72f6915d Test that a GRPC client rejects untrusted server certs. 2016-02-29 19:05:19 -08:00
Carl Mastrangelo 39659dce85 Use impossible port for unreachability test 2016-02-29 14:46:31 -08:00
Xiao Hang 5d025ed6ae Change InteopTester to take a ManagedChannel directly instead of using all the args to build a channel
Create a helper class for building okhttp based channels in android tester app
2016-02-29 08:48:20 -08:00
Kun Zhang 643bb2c6b5 Always start from the first address after a successful connection. 2016-02-26 17:21:47 -08:00
Carl Mastrangelo 86bad4ffea Add more log into for cancellation 2016-02-26 13:37:14 -08:00
Louis Ryan 887064d30e Use latching to enforce expected events are received 2016-02-25 17:33:54 -08:00
Louis Ryan 8dad73492a Various naming and documentation clenaups
Remove attachAsCloseable and replace with the immediate run / call methods
Introduce a concrete Deadline type and use it
2016-02-25 16:33:10 -08:00
Eric Anderson b17a249fc4 Create new AbstractTransportTest for Transports
This is lower-level than the existing AbstractTransportTest. It should
be used by all transports, but InProcessTransport is the only one as
part of this commit.
2016-02-25 16:23:17 -08:00
Kun Zhang d86dfc9552 Merge DelayedStream's setError() into cancel()
DelayedClientTransport.PendingStream will override cancel(), which has a
clearer semantic.

Also permitting all status codes except OK in ClientStream.cancel(),
instead of just 4 codes.
2016-02-25 11:28:48 -08:00
Carl Mastrangelo a959126fb3 Bump Guava to 19.0 2016-02-25 08:42:54 -08:00
Eric Anderson 06e3ef5945 Fix bugs and improvements found by static analyser 2016-02-23 17:32:35 -08:00