Commit Graph

1483 Commits

Author SHA1 Message Date
Eric Anderson d2cc576320 core: Fix ErrorProne errors 2016-07-13 14:14:15 -07:00
Jakob Buchgraber edf2c62fd5 netty: update to 4.1.2.Final and tcnative Fork18 2016-07-12 08:06:19 +02:00
Eric Anderson e9643bb5d7 Start 1.1.0 development cycle 2016-07-11 16:57:58 -07:00
Eric Anderson 0a98ff083b interop: Bump maxMessageSize for Android testing
This was missed in 16b096b5
2016-07-11 15:14:54 -07:00
Eric Anderson bfcb04c196 core: Allow avoiding Provider loading, for Android 2016-07-11 10:02:23 -07:00
Eric Anderson d7bf67e01f examples: Provide Maven and Gradle build files
The examples are no longer part of the normal build, although they are
built with Travis. The examples now include their own copy of the gradle
wrapper to ease usage from IDEs which can now properly detect the
correct version of gradle to use.

The build files were generated using "gradle init" and "mvn
archetype:generate" and then modified following our README.

Fixes #1414
2016-07-11 09:20:25 -07:00
Eric Anderson 3c03eb79ec travis,jenkins: Fail build if javac emits warnings 2016-07-10 12:01:07 -07:00
Eric Anderson 7fb43d2a1e core: Add generics to raw types in KeepAliveManagerTest
Swapping to doReturn is necessary since passing a <?> to thenReturn()
does not match the <?> of OngoingStubbing (without a cast).
2016-07-10 11:57:07 -07:00
Eric Anderson 0e47be1287 core: Save accept encoding since Metadata is not thread-safe
Metadata has been passed to the application. The application may be
modifying Metadata concurrently, so we must not access Metadata after
that point.

Fixes #1947
2016-07-10 11:28:04 -07:00
Jakob Buchgraber 0d6a9de54c netty: deduplicate javadoc accidentially introduced in e80b136495 2016-07-10 09:51:16 +02:00
Jakob Buchgraber 7504b79f00 netty: add logging to find cause of ClosedChannelException.
- See #1330 for details.
- Also, Netty 4.1.2.Final comes with additional information where
a (usually statically cached) ClosedChannelException was triggered [1]

[1] https://github.com/netty/netty@e845670#diff-8c9a7d1d9b0fdb6c5aef2794d05a9f88
2016-07-09 14:50:39 +02:00
Xiao Hang d9001ca448 Keepalive support
Creates a KeepAliveManager which should be used by each transport. It does keepalive pings and shuts down the transport if does not receive an response in time.
It prevents the connection being shut down for long lived streams. It could also detect broken socket in certain platforms.
2016-07-08 17:18:47 -07:00
Kun Zhang a86c5bf327 docs: Fix an issue link on ExperimentalApi. 2016-07-08 12:03:17 -07:00
Kun Zhang 527fd67cc8 core: Channel Idleness
Resolves #1276

Idle mode is where the channel does not keep live connections, and does
not have running NameResolver and LoadBalancer.

TransportSet aggregates the in-use state of transports, including the
delayed transport and real transports. Channel aggregates the in-use
state of TransportSets and delayed tranports.

Channel starts in idle mode. It exits idle mode if one of the following
occurs:
 1. A new Call requests for a transport.
 2. The channel's in-use state turns to true.
 3. Someone calls exitIdleMode().

Channel enters the idle mode if its in-use state has been false for the
configured timeout (disabled by default). It shuts down all
TransportSets, NameResolver and LoadBalancer. Interim transports and OOB
transports are LoadBalancer's responsibility.

There is a race that could cause annoyance if IDLE_TIMEOUT was too
small (e.g., 0). A TransportSet's delayed transport is holding streams,
which keeps its in-use state in true. When a real transport is ready,
all streams are transferred to the real transport, immediately after
which the delayed transport's in-use state turns to false, while the
real transport's in-use state may have not turned to true, because some
transport (e.g. netty) may have a brief delay between newStream() being
called and the stream being created internally. This could cause the
channel's aggregated in-use state be in false for a brief time, if which
is longer than IDLE_TIMEOUT, could make channel go to idle mode. Even
though the channel would go back to non-idle again, idle mode would
shutdown all transports and NameResolver and LoadBalancer which leads to
spurious error in the application.

We minimize the chance of such race by setting the minimum timeout to 1
second.

Related chanes:
- ManagedChannelImplTest now switched to use fake executors.
- Turn a few anonymous runnables into named classes. This is more useful for debugging.
2016-07-08 11:36:16 -07:00
Jakob Buchgraber e80b136495 Fix wrong use of checkNotNull in WriteQueue.
* Fix wrong use of checkNotNull in WriteQueue.

The issue was found and reported by @blakearnold. Thank you!
2016-07-08 16:00:34 +02:00
Eric Anderson 7b26a3249c docs: Add gradle build to steps in RELEASING 2016-07-07 16:11:36 -07:00
Eric Anderson 554287a0cd docs: Add missing files to sed in RELEASING 2016-07-07 16:11:36 -07:00
Eric Anderson 16b096b571 Reduce default max message size to 4 MiB
Fixes #1676
2016-07-07 13:34:53 -07:00
Jakob Buchgraber 2d7347fbfc netty: undo commit 6a55e29 as netty's DefaultThreadFactory has been fixed 2016-07-02 13:23:41 +02:00
Jakob Buchgraber 1257f96a00 netty: reduce allocations in write queue.
- Merge all the command objects with QueuedCommand so to save one object allocation per write.
- Add unit tests
2016-07-02 12:17:54 +02:00
Carl Mastrangelo 9bbaa8f46b interop tests: fix race in Compression tests where MetadataEntry.getParsed was being concurrently called.
Metadata is internally not thread safe, so putting it in a volatile is not enough.
2016-07-01 16:42:05 -07:00
Carl Mastrangelo 8d9283116c core: add @GaurdedBy annotations for mutable state of ServerImpl
Commit 5487ea8f54 unintentionally fixed a race condition in

shutdownNow, but the race was detected when being used inside Google.  This could have
been avoided by the enforceable documentation of GaurdedBy annotations.  These make it
clear what locks should be held, promote documentation for newly added server state,
and can be automatically checked by static analysis.
2016-07-01 16:11:20 -07:00
Carl Mastrangelo 2292cbfca0 netty: prevent race between transportCreated and transportShutdown 2016-07-01 15:57:47 -07:00
Eric Anderson 46379da1a6 Start 1.0.0 development cycle 2016-07-01 11:46:33 -07:00
Eric Anderson 75f27ba625 examples: Avoid deprecated generated class 2016-07-01 11:21:48 -07:00
Eric Anderson 32fd329e1c core: Rename withCredentials to withCallCredentials on CallOptions
It was withCallCredentials on the stub to avoid confusion with channel
credentials (which don't exist in Java at this time, but do in other
languages), and having the method names be different doesn't add value.
2016-07-01 11:18:38 -07:00
nmittler 8f78b4d88e Fixing error-prone warnings. 2016-07-01 10:03:41 -07:00
Jakob Buchgraber 3eafa5aeec benchmarks: fix typo in README 2016-07-01 16:20:47 +02:00
Eric Anderson 31651f369f auth: Promote OAuth2 service accounts to JWT
JWT needs less configuration and zero round-trips to initialize.

Fixes #785
2016-06-30 15:41:39 -07:00
Jakob Buchgraber c5733742ce netty: fix incorrect usage of AsciString.
An AsciiString object may only use a subsection of its backing byte array. We need to test for this and return a copy of the subsection if necessary.
Big thanks to @normanmaurer for uncovering this issue: https://github.com/netty/netty/issues/5472
2016-06-30 16:28:45 +02:00
ZHANG Dapeng f149e4c175 compiler: deprecate interfaces and add ImplBase in codegen
first step to address issue #1469:

- leave and deprecate interfaces in codegen
- introduce `ServiceImplBase`,
- `AbstractService` is deprecated and extends `ServiceImplBase`
- static `bindService()` is deprecated
2016-06-29 21:17:03 -07:00
Carl Mastrangelo dc027ff346 examples: add an example showing how to get the error details from a call
Fixes #1295
2016-06-28 16:10:38 -07:00
David Cao 4b17a2e317 Android hello world example is now using proto lite. 2016-06-28 14:34:00 -07:00
ZHANG Dapeng 8ed2dc8bec testware: fix flakes caused by pickUnusedPort
Resolves #1756

The thread-unsafe method `io.grpc.testing.TestUtils.pickUnusedPort` causes flakes (#1756) in windows. Need to avoid use of this method in test as in windows the tests are running in different jvms and concurrent calls of this method in multiple processes tend to return the same port number.

There are some usages of this method in benchmarks, so moved the method to `io.grpc.benchmarks.Utils` and the method will only be used in benchmarks and not in test.
2016-06-28 13:34:38 -07:00
Eric Anderson dbef1af29a Bump protobuf dependency to 3.0.0-beta-3
This allows us to play with zero-copy and proto3 support for lite.
Unfortunately, it introduced some warnings, so deprecated warnings are
now ignored for benchmarks and interop-testing.
2016-06-28 08:58:13 -07:00
Eric Anderson fe5b7e3e9b core: Improve error message when lacking NameResolverProviders
This is to improve debugging as in #1982.
2016-06-27 15:21:17 -07:00
Eric Anderson 29776ca947 core: Fix onReady race by adding DelayedStreamListener
onReady/isReady previously could disagree causing a sort of deadlock
where the application isn't sending because grpc said not to, but won't
be informed to send via onReady later.

This is a stack trace from inprocessTransportOutboundFlowControl. The
line numbers are from this commit but with the changes to DelayedStream
disabled:

at io.grpc.internal.DelayedStream.isReady(DelayedStream.java:306)
  (That is isReady returning false because fallThrough == false)
at io.grpc.internal.ClientCallImpl.isReady(ClientCallImpl.java:382)
at io.grpc.stub.ClientCalls$CallToStreamObserverAdapter.isReady(ClientCalls.java:289)
at io.grpc.stub.ClientCallsTest$8$1.run(ClientCallsTest.java:403)
  (And yet that was the onReady callback, and it won't be called again)
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onReady(ClientCalls.java:377)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$4.runInContext(ClientCallImpl.java:481)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52)
at io.grpc.internal.SerializeReentrantCallsDirectExecutor.execute(SerializeReentrantCallsDirectExecutor.java:65)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.onReady(ClientCallImpl.java:478)
at io.grpc.internal.DelayedStream$DelayedStreamListener.onReady(DelayedStream.java:366)
at io.grpc.inprocess.InProcessTransport$InProcessStream$InProcessServerStream.request(InProcessTransport.java:284)
at io.grpc.internal.ServerCallImpl.request(ServerCallImpl.java:99)
at io.grpc.stub.ServerCalls$ServerCallStreamObserverImpl.request(ServerCalls.java:345)
at io.grpc.stub.ClientCallsTest.inprocessTransportOutboundFlowControl(ClientCallsTest.java:432)

Fixes #1932
2016-06-27 13:35:52 -07:00
William Thurston 88a0378912 core: Add a RoundRobin LoadBalancer. 2016-06-27 09:56:26 -07:00
Carl Mastrangelo b55a2bfb3f core: clarify StreamObserver documentation
Fixes #986
2016-06-27 08:20:21 -07:00
Jakob Buchgraber fc5197fbf4 netty: detect when ALPN was not used. Fixes #522 2016-06-25 15:59:30 +02:00
Carl Mastrangelo 46f418da94 core: fix race with exception in onMessage
Fixes #1652
2016-06-24 16:25:55 -07:00
Carl Mastrangelo 6c59770a5b core: update issue for Contexts experimental status 2016-06-24 15:45:06 -07:00
Eric Anderson 5487ea8f54 Remove unused variables
This fixed a threading issue in ServerImpl because the unused variable
should have been used.
2016-06-24 12:11:03 -07:00
Carl Mastrangelo e11917e1b8 core: add package level javadoc.
Fixes #714
2016-06-24 10:48:27 -07:00
Carl Mastrangelo a10712b515 examples: move json server and client to advanced package
Fixes: #1778 (again)
2016-06-24 10:40:02 -07:00
Carl Mastrangelo 6f2c1ea078 core: mark Context as not experimental
Updates #1705
2016-06-23 13:18:56 -07:00
Kun Zhang adbc3f7ab9 doc: add flow-control example to ClientCall javadoc.
Resolves #1479
2016-06-23 10:57:18 -07:00
Eric Anderson 23f34be649 core: Move ServerMethodDefinition back into top-level class
This effectively reverts part of 3df1446d.
2016-06-23 09:31:46 -07:00
Eric Anderson cd9042b49b core: Harden ServiceDescriptor API
Over-specifying List prevents fewer things to be passed in and makes it
less efficient to use a Map later. We definitely don't want people
extending this class.
2016-06-23 09:31:46 -07:00
Eric Anderson bf588b0be8 core: Add convenience builder for ServerServiceDefinition
This adds back the previous builder, which eases upgrading.
2016-06-23 09:31:46 -07:00