Commit Graph

2084 Commits

Author SHA1 Message Date
Simon Horlick 6d9e149dcb build: Add Bazel java_grpc_library rule
Bazel third party dependencies are specified in repositories.bzl which
gives the consumer the ability to opt-out of any dependencies they use
directly in their own project.

Fixes #2756
2017-06-22 13:06:49 -07:00
Carl Mastrangelo 51ce204f53 inprocess: mark all classes final 2017-06-22 12:25:32 -07:00
Kun Zhang 859d211b6e core: ServerBuilder.intercept(). (#3118)
This adds server-wide interceptors that applies to all call handlers.
Because ServerCallHandler is acquired per request, and can be dynamicly
provided by the fallback registry, the interceptors have to be installed
on a per-request basis. This adds a few object allocations per request,
which is acceptable.
2017-06-21 08:55:16 -07:00
Eric Gribkoff 3dce2ee84b core: add RunWith annotation to OverrideAuthorityNameResolverTest 2017-06-20 12:12:16 -07:00
Jan Tattermusch b3c1a5c8c3 fix LICENSE file (#3107) 2017-06-20 08:52:39 +02:00
Eric Gribkoff e01cec5c2c netty: push sslContext initialization into transportCreationParamsFilterFactory 2017-06-19 23:20:59 -07:00
Eric Gribkoff d3d30e1c3a benchmarks: add missing ReportQpsScenarioServiceGrpc 2017-06-19 21:00:26 -07:00
zpencer c3269f296f benchmark service: sync protos with c-core 070a8ee (#3108)
Sync our protos with the definitions in c-core as of 070a8ee.
After this, I will add the workloads present in C that are missing in Java.
2017-06-19 13:25:33 -07:00
zpencer 2b1eee90e5 core: Do not leak server state when application callbacks throw exceptions (#3064)
Today JumpToApplicationThreadServerStreamListener leaks server state by transmitting details about uncaught StatusRuntimeException throwables to the client. This is a security problem.

This PR ensures that uncaught exceptions always close the ServerCall without leaking any state information. Users running in a trusted environment who want to transmit error details can install the TransmitStatusRuntimeExceptionInterceptor.

fixes #2189
2017-06-19 11:15:22 -07:00
Matt Kwong dda8f547e7 Add Windows build and config files for Kokoro (#3096) 2017-06-19 10:47:23 -07:00
ZHANG Dapeng 544ceded6b netty: rename HandlerSettings to InternalHandlerSettings 2017-06-19 09:04:04 -07:00
Carl Mastrangelo 8d2194cf31 core: don't intern Metadata keys
Interning strings isn't needed much any more since keys are now
compared by byte value.  Also, intern is slow (about 150ns per)
which affects code that creates keys often.  Lastly, older
versions of Java don't garbage collect interned strings, which
lowers the applications stability.
2017-06-17 10:53:37 -07:00
zpencer 726c23b7da core: OverrideAuthorityNameResolverFactory should forward refresh() (#3061)
The current implementation has a bug where certain methods are not forwarded to the delegate.

This is essentially the same as e4f1f39 which was merged to the v1.4.x branch. This PR uses the new license header.

Fixes #3061
2017-06-16 18:54:47 -07:00
Carl Mastrangelo d6d3a53d25 all: update readme to point to 1.4.0 2017-06-16 15:03:14 -07:00
Carl Mastrangelo 2a3cb8fd23 all: bump netty to 4.1.12-Final 2017-06-16 14:59:34 -07:00
Eric Anderson cb53bbf0be all: Filter out Internal* classes from Javadoc
core's sources already have filters applied, so it isn't necessary to
copy them to all.
2017-06-16 14:53:51 -07:00
zpencer 532450996a core: detect invalid states on server side (eg zero responses for unary) (#3068)
The current check in ServerCallImpl is theoretically unsafe (#3059). Move that check into the stub, and expand the unit tests to cover other interesting edge cases on the server side:

client sends one, but zero requests received at onHalfClose
client sends one, but > 1 requests received at onHalfClose
server sends one, but zero responses sent at onComplete
server sends one, but > 1 responses sent via onNext
fixes #2243
fixes #3059
2017-06-15 09:33:01 -07:00
zpencer d42a4b24b9 core: ensure ServerStream and ClientStream become noops after closing (#3092)
Add unit tests to enforce behavior that we already expect today.

fixes #3083
2017-06-13 11:01:30 -07:00
Eric Anderson 0a8d761c19 core: Simplify ChannelImpl constructor; testable Builder
Add some example tests for easier fields in AbstractManagedChannelImplBuilder.

Many fields are no longer Nullable, in order to move logic from construction to
mutation, which eases testing and simplifies cross-class interactions.

The nameResolverFactory comment starting "Avoid loading the provider unless
necessary" was outdated and has not been a concern since #2071 which swapped to
a hard-coded list on Android.
2017-06-12 15:47:44 -07:00
Eric Gribkoff 9a5623da0e android-interop-testing: instrumented interop tests 2017-06-12 12:10:41 -07:00
Eric Gribkoff 49b9216e83 core: set server stream decompressor in transport thread 2017-06-12 12:00:21 -07:00
xuwei-k 6038b0987e update netty-tcnative version in SECURITY.md 2017-06-12 09:41:03 -07:00
ZHANG Dapeng 1594ebbc12 core: scheduler.schedule() can be used normally
Since netty 4.1.11-final, netty/netty#6627 has been fixed.
2017-06-09 14:28:32 -07:00
Łukasz Strzałkowski 17af756df4 core: deprecate MethodDescriptor.create
Use MethodDescriptor.newBuilder instead
2017-06-09 13:53:39 -07:00
Carl Mastrangelo 8d304b6892 netty: update to netty tcnative 2.0.3 2017-06-09 10:42:00 -07:00
Carl Mastrangelo 6b5e53e513 all: remove PATENTS file
With the recent move to Apache 2 (#3047) , the need for the PATENTS
is longer necessary.  The new license covers patents already.
2017-06-08 11:09:28 -07:00
Carl Mastrangelo 6ef77e0609 core: hide access to Status code and message keys 2017-06-08 10:16:06 -07:00
Carl Mastrangelo 1da1dba9fb all: update to gradle 3.5 2017-06-07 17:18:44 -07:00
Eric Anderson 72dd8f9a98 core: Mark NameResolverProvider experimental and clarify docs
We don't want people to be desensitized to the Internal annotation.
NameResolverProvider should have probably been ExperimentalApi from the
start, but it was copied from ManagedChannelProvider.

Theoretically, ManagedChannelProvider could be marked ExperimentalApi as
well, but there are no known use cases for doing so since making an
alternative ManagedChannel implementation is quite difficuilt and we
aren't aware of anybody interested in doing so. That isn't the case for
NameResolverProvider; NameResolverProvider is core to 'targets' being
useful.
2017-06-07 17:07:50 -07:00
Eric Anderson faa0ad79f7 Revert "core: move NameResolverProvider to internal"
This reverts commit 9c6ea274fe.

The class name is important for the service loaders.
2017-06-07 16:19:01 -07:00
Yang Song 4a0cf0b936 core: Bump up instrumentation_api to 0.4.3, use instrumentation-defined STATS_CONTEXT_KEY. (#3070) 2017-06-06 18:16:54 -07:00
Carl Mastrangelo 0622dce925 context: declare that context should not be mocked 2017-06-06 13:04:32 -07:00
ZHANG Dapeng 9057bc723c testing: move out inner class tests in GrpcServerRuleTest
Resolves #2808
2017-06-06 12:30:58 -07:00
Eric Anderson c48610b890 netty: Eagerly create SslContext
Creating the SslContext can throw, generally due to broken ALPN. We want
that to propagate to the caller of build(), instead of within the
channel where it could easily cause hangs.

We still delay creation until actual build() time, since TLS is not
guaranteed to work and the application may be configuring plaintext or
similar later before calling build() where SslContext is unnecessary.

The only externally-visible change should be the exception handling.
I'd add a test, but the things throwing are static and trying to inject
them would be pretty messy.

Fixes #2599
2017-06-06 12:00:01 -07:00
Carl Mastrangelo 9c6ea274fe core: move NameResolverProvider to internal 2017-06-05 17:40:23 -07:00
ZHANG Dapeng 851065dd08 examples: migrate unittest examples to GrpcServerRule
migrated simple tests using `GrpcServerRule`.
Kept the low level in-process channel setup and tear down code for the RouteGuide example to show how users can use in-process directly to set more custom channel builder options when needed.

resolves #2490
2017-06-05 16:32:18 -07:00
Eric Gribkoff a2a42e3396 interop-testing: add alpnagent to support okhttp in test client 2017-06-05 16:28:37 -07:00
ZHANG Dapeng 55379d105d testing: GrpcServerRule#directExecutor can only be called at instantiation
otherwise it cannot take effect
2017-06-05 15:25:42 -07:00
Eric Anderson adc2de7533 netty: Clarify max header list size configuration 2017-06-05 14:55:16 -07:00
Eric Anderson acc1328853 core: Avoid DNS test when no networking available 2017-06-05 11:16:35 -07:00
zpencer c0fc6785c1 core: JumpToApplicationThreadServerStreamListener should not close context (#3055)
Calling CancellableContext#close() multiple times does not cause problems, but is unnecessary here. The return value of getListener() is a ServerStreamListenerImpl, which already calls CancellableContext#cancel() inside of the finally block of ServerStreamListener#closed().
2017-06-05 08:37:51 -07:00
Carl Mastrangelo 82fce837e4 core: don't return concrete type from AbstractServerImplBuilder 2017-06-01 14:38:05 -07:00
Carl Mastrangelo 166108a943 all: fix licence whitespace 2017-06-01 14:28:37 -07:00
Jan Tattermusch 55fd61d74d all: improve contributing.md guidelines. 2017-06-01 11:14:44 -07:00
Carl Mastrangelo 104350cf2e core: include how long deadline was in Status message 2017-05-31 15:04:10 -07:00
Carl Mastrangelo 7b97df04d3 all: fix gradle file for licence type 2017-05-31 14:37:42 -07:00
Carl Mastrangelo 3bfd630bff all: update to Apache 2 licence
Also, update the authors.
2017-05-31 13:29:01 -07:00
zpencer 8a1217d972 core: Server side cancellations should promptly inform server (#2963)
When a cancellation happens, the ServerCall and Context get notified. Rather than serializing on the normal work queue (which may be doing user computation), we should execute the notification immediately, thereby allowing the user computation to see the cancellation.
2017-05-30 13:05:54 -07:00
Eric Gribkoff 37e2131dc9 protobuf: make toStatusProto return null when metadata key is absent 2017-05-30 11:47:20 -07:00
Jakob Buchgraber 917f6faac6 compiler: Fix compilation error
The code uses std::back_insert_iterator which is part of the <iterator>
header. The header is not included though.

We (bazel) noticed the build failing on Windows when using the Visual Studio
C++ compiler.
2017-05-30 11:15:46 -07:00