Commit Graph

2084 Commits

Author SHA1 Message Date
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
ZHANG Dapeng 0d694c80ee core,netty: quick patch for setListener regression
resolves grpc/grpc#8715
now that setListener is called prior to
`JumpToApplicationThreadServerStreamListener` being completely ready to
use. We should not call `AbstractStream2#onStreamAllocated()` inside
`setListener()` anymore, but call it after `ServerImpl#streamCreated()`
is completed.
2016-11-11 19:39:16 -08:00
ZHANG Dapeng 0e27eef168 core: fix bug when stream listener not set before stream closed
Resolves #1936

Two bugs fixed:
- NPE in `ServerImpl#streamCreated()` when stream listener not set before
  stream closed
- It is possible that `internalCancel()` is called during
  `InProcessClientStream#start()` due to early server `onComplete()` or server `onError()`,
  in this case no need to enlist `streams`, otherwise the channel can not be shutdown by `shutdown()`.
2016-11-09 15:21:11 -08:00
ZHANG Dapeng e40668499c netty: add channel options in NettyChannelBuilder
Add `withOption(ChannelOption<T> option, T value)` method to
`NettyChannelBuilder`. This allows user to set a custom TOS.
2016-11-09 13:32:05 -08:00
Carl Mastrangelo 944879dbbb benchmarks: reuse executor between channels
Perhaps by accident, each LoadClient channel got its own executor
pool rather than sharing between all of them.  The benchmarks are
currently set up with C++ idioms, creating 64 "channels" per
client.  C++ uses one thread per channel, while java does not,
leading to a threading model mismatch.

ForkJoinPool is the current executor because it has good contention
characteristics.   However, FJP is also very sensitive to the
number of actively running tasks.  Too many, and the contention
will go up.  Too few, and threads will repeatedly go to sleep and
wake up.

This change basically makes the FJP shared for all clients in the
same process.  It doesn't try at all to shut it down properly or
be generally useful; it's just a benchmark.  Additionally, this
also groups the Netty and OkHttp specific channel options into
helper functions.  This means OkHttp benchmarks will also use
the correct executor now.

A quick test shows QPS going from ~107kqps to 149kqps.

Fixes: #2406
2016-11-09 09:52:02 -08:00
ZHANG Dapeng 809cf1bc8c core: MutableHandlerRegistry#addService with BindableService arg 2016-11-04 18:25:46 -07:00
Łukasz Strzałkowski d954bc2a51 Typo in version number
3.10 -> 3.1
2016-11-04 10:18:18 -07:00
Carl Mastrangelo 636b43b871 benchmarks: print gc detail and vm flags for benchmarks 2016-11-03 12:55:42 -07:00
Carl Mastrangelo 91e61ec406 github: add an issue template
Fixes: #2393
2016-11-02 15:28:47 -07:00
dave 540f70e870 ProtoUtil.jsonMarshaller can be supplied a JsonFormat Parser and Printer
This allows for customizing the printer and parser behaviour
2016-11-02 15:24:13 -07:00
Carl Mastrangelo f6c333eefe benchmarks: check shutdown after acquiring a token, and weaken error messages on shutdown 2016-11-02 13:08:16 -07:00
Eric Anderson 2e7e25d1f2 core: Update HTTP status to gRPC status mapping
Proxies can trigger errors, and we'd like to categorize common
proxy-generating errors into gRPC status codes for sane application
handling.

Fixes #2264
2016-11-01 17:35:18 -07:00