Commit Graph

1695 Commits

Author SHA1 Message Date
Anuraag Agrawal 221fadcbdd Implement setListener in AbstractServerStream and remove from subclasses. 2016-12-14 12:29:10 -08:00
Carl Mastrangelo 1f2802a11f core: make forTarget(String) non-experimental 2016-12-14 10:15:12 -08:00
Kun Zhang 97b926391b context: add the four-value withValues(). (#2506) 2016-12-13 14:03:23 -08:00
Carl Mastrangelo 677f05d7fb netty: move internal channel builder code to a special accessor 2016-12-13 11:17:00 -08:00
Kun Zhang 178b5260c2 core: handle a race in DelayedClientTransport(2). (#2486)
* Fork DelayedClientTransport into DelayedClientTransport2, and fix a race
on it.  Consider the following sequence:

1. Channel is created. Picker is initially null

2. Channel has a new RPC. Because picker is null, the delayed transport
is picked, but newStream() is not called yet.

3. LoadBalancer updates a new picker to Channel. Channel runs
reprocess() but does nothing because no pending stream is there.

4. newStream() called on the delayed transport.

In previous implementation, newStream() on step 4 will not see the
picker. It will only use the next picker.

After this change, delayed transport would save the latest picker and
use it on newStream(), which is the desired behavior.

Also deleted all the code that will not be used after the LB refactor.


* Also fixed a bug: newStream() should always return a failing stream if it's shutdown. Previously it's not doing so if picker is not null.
2016-12-12 09:24:13 -08:00
Łukasz Strzałkowski bd9e041b74 netty: Add support for keepalive 2016-12-12 09:02:24 -08:00
Eric Anderson 0573c25c60 interop-testing: Observe --use_tls to disable TLS with OkHttp 2016-12-09 18:28:12 -08:00
Kun Zhang fd33a72174 core: thread-less ChannelExecutor. (#2493)
Dedicated for mutating states of ManagedChannelImpl, InternalSubchannel and LoadBalancer.
2016-12-08 18:38:29 -08:00
Lukasz Strzalkowski ecb79ce36f Update param name for saving histograms 2016-12-08 11:21:50 -08:00
Eric Anderson cfb6bd0fe2 context: Fix ErrorProne ClassNewInstance
http://errorprone.info/bugpattern/ClassNewInstance
2016-12-08 10:33:31 -08:00
Kenji Kaneda 21bca9a475 core: Add @Nullable to Metadata#get 2016-12-08 10:25:21 -08:00
Eric Anderson e999f8da62 core: Fix ErrorProne failure for ForOverride
Methods overriding a ForOverride method should not be public.
2016-12-08 10:08:12 -08:00
Eric Anderson 67ff170b96 docs: Place all badges together 2016-12-06 16:45:00 -08:00
Joey Bratton b6ebede94f testing: added junit rule for in-process servers
GrpcServerRule configures an in-process server and channel. It is
useful for asserting requests being made to a service. A consumer can
create a mock implementation of their service that records each
request, then make assertions on those records in their test.
2016-12-06 09:32:04 -08:00
Kailash Sethuraman a10261af48 all: add gitter chat icon to the README.md file 2016-12-05 15:12:36 -08:00
Lukasz Strzalkowski 483f3d55e9 Remove deadcode 2016-12-05 14:17:13 -08:00
Carl Mastrangelo cb1ba5bf39 core: remove extra allocation in MessageFramer
OutputStreamAdapter is a private class, and is only ever called by two
places: ByteStreams.copy, which never calls the single byte method, and
DrainTo, which potentially can.  There are two classes that implement
DrainTo, which is primarily ProtoInputStream.  It calls
MessageLite.writeTo(OutputStream) or back again to ByteStreams.copy.

MessageLite.writeTo in turn wraps the OutputStream in a
CodedOutputStream.OutputStreamEncoder, which then never calls the single
byte version.  Thus, all know implementations never call the single
byte override.

Additionally, it is well known that the single byte write is slow, and
is expected to be wrapped in a BufferedOutputStream if there are many
small writes.
2016-12-05 13:11:06 -08:00
Kenji Kaneda 1d5fd1fa35 core: Fix typos in GrpcUtil
- s/IMPLEMENTATION_VERION/IMPLEMENTATION_VERSION
- s/ACCEPT_ENCODING_SPLITER/ACCEPT_ENCODING_SPLITTER
2016-12-05 11:42:16 -08:00
Carl Mastrangelo 209a32fd1a core,netty: add a log id to the server and server transports 2016-12-05 09:47:35 -08:00
Carl Mastrangelo e9779d7c00 all: use a proper log id which can reference channels, subchannels, and transports 2016-12-02 15:35:11 -08:00
Kun Zhang 7ec8167ada core: LoadBalancer2 and DelayedClientTransport.reprocess(). (#2443)
This is the second step of a major refactor for the LoadBalancer-related part of Channel impl (#1600)
2016-12-02 10:31:34 -08:00
Carl Mastrangelo cbadf4b3e8 internal: mark internal subchannel methods for override 2016-12-02 10:25:46 -08:00
Kun Zhang 84862867f7 context: pluggable Storage mechanism. (#2461)
Currently Context propagate in-thread by its own ThreadLocal, and
cross-thread propagation must be done with the mechanisms provied by
gRPC Context.  However, there are frameworks (e.g. what we are using
inside Google) which have already established context-propagation
mechanisms.  If gRPC Context may ride on top of them, it would be
propagated automatically without additional effort from the application.

The Storage API allows gRPC Context to be attached to anything.  The
default implementation still uses its own ThreadLocal.  If an override
implementation is present, gRPC Context will use it.
2016-12-02 09:47:58 -08:00
Carl Mastrangelo f15ed05260 stub: remove a reference to internal 2016-12-02 09:13:37 -08:00
Michael Avrukin 4d4d4b386e core: improve error message for adding method (#2460)
Issue: grpc/grpc-java/issues/2437
2016-12-02 07:45:37 -08:00
Eric Anderson 8ecf05409e compiler: Explicitly specify std::
This is to follow style changes happening internally.
2016-12-01 16:10:23 -08:00
Carl Mastrangelo e71f2c942f core: make Status reference the correct internal Marshaller 2016-12-01 08:28:16 -08:00
Kenji Kaneda 5ff16dd4c6 core: Make tiny fixes to InUseStateAggregator2 and InternalSubchannel (#2466)
- Remove unused variable terminated from TransportListener#transportTerminated
- Do not mention getLock in the javadoc of InUseStateAggregator2#handleNotInUse
2016-11-30 16:03:21 -08:00
Carl Mastrangelo 5269a1b969 netty: call the client ssl negotiation handler
* netty: call the client ssl negotiation handler
2016-11-30 08:47:20 -08:00
ZHANG Dapeng b24d263192 internal/test: make FakeClock more thread-safe (#2452)
FackeClock used PriorityQueue for storing tasks which is not
thread-safe, and caused flake

> io.grpc.internal.ClientCallImplTest > deadlineExceededBeforeCallStarted FAILED
>     java.lang.ArrayIndexOutOfBoundsException: -1
>         at java.util.PriorityQueue.removeAt(PriorityQueue.java:619)
>         at java.util.PriorityQueue.remove(PriorityQueue.java:378)
>         at io.grpc.internal.FakeClock$ScheduledTask.cancel(FakeClock.java:89)
>         at io.grpc.internal.ClientCallImpl.removeContextListenerAndCancelDeadlineFuture(ClientCallImpl.java:296)
>         at io.grpc.internal.ClientCallImpl.start(ClientCallImpl.java:250)
>         at io.grpc.internal.ClientCallImplTest.deadlineExceededBeforeCallStarted(ClientCallImplTest.java:615)
2016-11-28 18:14:21 -08:00
ZHANG Dapeng 6dc4633bdd stub: add withWaitForReady 2016-11-28 18:13:22 -08:00
Kun Zhang c1a798486b core: address data race in StatsTraceContext. (#2454)
Document the threading requirements.

Turn all metrics to volatile because callEnded() may not be synchronized
with other metric-updating methods in the case where the RPC is closed
because of transport error or cancellation from the other side.

Remove precondition checks thus allow metrics updating methods to be
called after callEnded() has been called, which may happen since the
application may not be aware when the RPC is closed by the transport.
2016-11-28 18:05:41 -08:00
Kun Zhang 6da8f471f7 compiler: whitelist USER32.DLL. (#2455)
The 32-bit windows grpc codegen built with protobuf 3.0.2 depends on
USER32.DLL, while the previous release built with protobuf 3.0.0 didn't.
Both protobuf and grpc codegen are built under msys2-mingw32.

"objdump -x libprotobuf-10.dll | grep DLL" also shows the USER32.DLL
dependency being brought by protobuf:

3.0.0

 DLL Name: KERNEL32.dll
 DLL Name: msvcrt.dll
 DLL Name: zlib1.dll
 DLL Name: libgcc_s_dw2-1.dll
 DLL Name: libstdc++-6.dll

3.0.2

 DLL Name: KERNEL32.dll
 DLL Name: msvcrt.dll
 DLL Name: USER32.dll
 DLL Name: zlib1.dll
 DLL Name: libgcc_s_dw2-1.dll
 DLL Name: libstdc++-6.dll

While unexpected, USER32.dll is shipped with Windows so having such
dependency shouldn't cause any trouble.
2016-11-28 17:45:11 -08:00
Carl Mastrangelo c408eadf22 core: add javadocs to internal methods in MethodDescriptor 2016-11-28 14:09:16 -08:00
Eric Gribkoff c8c9fff679 services: Proto reflection service 2016-11-28 13:20:55 -08:00
Carl Mastrangelo 6c589e1933 core: reverse dependency from core/internal classes, so that it is now one directional. 2016-11-28 10:27:51 -08:00
Eric Anderson 0207354994 travis: Remove old comment for broken OS X caching
Commit 80f73a4a was in response to OS X receiving caching support.
Caches began being saved shortly after and they've been working since.
The official announcment was
https://blog.travis-ci.com/2016-05-03-caches-are-coming-to-everyone
2016-11-23 23:25:17 -08:00
Eric Anderson 335638e4fa travis: Use default OS X image (xcode7.3)
The xcode7 image is being retired on Nov 28th[1]. The default has been
7+ for a while now[2]. I assume 7+ all have JDK 8, so using the default
seems safe.

1. https://blog.travis-ci.com/2016-11-17-retiring-some-osx-images/
2. https://blog.travis-ci.com/2016-09-15-new-default-osx-image-coming/
2016-11-23 23:24:53 -08:00
Carl Mastrangelo 18e628ab1d all: update to gradle 3.2
* all: update to gradle 3.2
2016-11-23 14:43:18 -08:00
Eric Gribkoff 0ec395dc30 interop-testing: apply --server_host_override regardless of flag order
apply --server_host_override regardless of flag order in the stress test client
2016-11-23 10:44:52 -08:00
Kun Zhang 6a04022d7a core: InternalSubchannel: the new TransportSet. (#2427)
This is the first step of a major refactor for the LoadBalancer-related part of Channel impl (#1600). It forks TransportSet into InternalSubchannel and makes changes on it.

What's changed:

- InternalSubchannel no longer has delayed transport, thus will not buffer
  streams when a READY real transport is absent.
- When there isn't a READ real transport, obtainActiveTransport() will
  return null.
- InternalSubchannel is no longer a ManagedChannel
- Overhauled Callback interface, with onStateChange() replacing the
  adhoc transport event methods.
- Call out channelExecutor, which is a serializing executor that runs
  the Callback.

The first commit is an unmodified copy of the files that are being forked. Please review the second commit which changes on the forked files.
2016-11-22 22:32:27 -08:00
Kun Zhang 325c965fdc example: really fix the loss of precision error (#2435) 2016-11-22 22:17:36 -08:00
Kun Zhang a05892a9fe examples: address ErrorProne and warnings. (#2433)
Discovered when importing grpc to internal repo:

1. ErrorProne: Compound assignments from floating point to integral
types hide dangerous casts.

2. found raw type: io.grpc.ManagedChannelBuilder missing type arguments
  for generic class io.grpc.ManagedChannelBuilder<T>
2016-11-22 15:17:44 -08:00
Eric Gribkoff 08e948353c interop-testing: new stress test client command line options (#2413)
* interop-testing: modify the stress test client to accept the same --use_tls, --use_test_ca, and --server_host_override arguments as the interop client. 

Clarify usage of --use_test_ca=true for stress and interop clients.
2016-11-21 09:03:24 -08:00
ZHANG Dapeng e70f7b421c all: cleanup - errorprone, unused 2016-11-16 19:15:16 -08:00
Carl Mastrangelo e0e13c4897 examples: don't use System.lineSeparator if unsupported
Fixes: #2425
2016-11-16 16:02:17 -08:00
Eric Anderson 06697b5376 doc: link to IDE-specific docs for os-maven-plugin 2016-11-15 22:34:50 -08:00
ZHANG Dapeng 7306df4266 examples: unit test examples for users
Demonstrate unit testing gRPC clients and servers with `InProcessTransport`.
2016-11-15 14:15:55 -08:00
Kun Zhang 7311572236 core: fix a benign data race in NoopCensusContextFactory. (#2421)
NoopCensusContextFactory used to use a shared zero-sized ByteBuffer,
which has mutable states like positions and thus is not thread-safe.
Sharing it means it will be used by all calls thus may be used from
different threads, which makes TSAN unhappy in tests.

Resolves #2377
2016-11-15 11:19:20 -08:00
Benjamin Ellenberger 8826bb5e3e Remove UTF-8 symbols in example to simplify compilation for most people. 2016-11-14 21:49:34 -08:00