Commit Graph

2164 Commits

Author SHA1 Message Date
Eric Gribkoff 7c60510794 all,interop-testing: update google-auth-library-oauth2-http (#3188) 2017-07-06 13:22:43 -07:00
Carl Mastrangelo 4bce872718 netty: remove unneeded licence file 2017-07-06 13:11:22 -07:00
Eric Anderson c637b42b71 core: Stop using context ClassLoader in Providers
currentThread().getContextClassLoader() was originally used to match
ServiceLoader's default. ServiceLoader is mostly used with SPIs that
exist in the bootclasspath and so the class's ClassLoader would not
work. But in gRPC we have a library in the application's ClassLoader.

Context ClassLoader has been causing problems in any case more than one
application ClassLoader exists, like in Servlet containers, Android, and
plugins. To my knowledge, in every case the context class loader is
different from the provider's class loader, the context class loader has
caused breakage, not success. In addition, since we use static fields
for storing the provider results, using anything but the provider's
class loader is asking to have results that vary simply depending on
which thread called gRPC first.

Fixes #2375
2017-07-06 11:02:31 -07:00
Carl Mastrangelo 424eeea8f5 all: begin 1.6 release cycle 2017-07-06 10:43:56 -07:00
Carl Mastrangelo cc5343a530 all: update to gradle 4.0 2017-07-05 18:32:35 -07:00
ZHANG Dapeng c2791496ca fix misuse of bazel repo @com_google_protobuf
resolves #3175
2017-07-05 16:15:33 -07:00
ZHANG Dapeng 69e278aa8e protobuf: configureProtoCompilation() not needed anymore 2017-07-05 15:52:18 -07:00
ZHANG Dapeng b23f35d3e5 protobuf-lite: restrict visibility of protobuf_lite 2017-07-05 14:22:32 -07:00
Eric Anderson 7384ea9da1 core: Simplify ServerImpl constructor; testable Builder 2017-07-04 20:20:04 -07:00
Eric Anderson 361f0381be interop-testing: Support conscrypt at runtime with OkHttp
Conscrypt can thus be an alternative to Jetty ALPN for running these
OkHttp integration tests.
2017-06-30 17:07:38 -07:00
Eric Anderson 9052d4245f interop-testing: Skip Netty Jetty ALPN tests if it is unavailable 2017-06-30 16:25:31 -07:00
Eric Anderson c436561fc5 all: Use fixed version number for java 6/7 signatures
This is important for stable builds, as if the signature changes the old source
may no longer validate.
2017-06-30 15:25:34 -07:00
Matt Kwong 16285dc634 Make Kokoro logs less noisy (#3110) 2017-06-30 13:53:52 -07:00
Eric Anderson 6d8a66f3e3 core: Mark InternalNotifyOnServerBuilder @Internal
It is misnamed if it is @ExperimentalApi. Even being @Internal is
strange, since nothing in io.grpc actually uses it and so it could
actually be in io.grpc.internal.

I'm not trying to fix the API, but just make it slightly more
consistent.
2017-06-29 21:46:20 -07:00
Eric Anderson a3ac64a883 core: Move client-side decompressor selection to stream
Previously ClientCallImpl's stream listener would call
stream.setDecompressor(), but this has always been a bit strange as the
only case where the call listener calls the stream and forms a bit of a
loop. It also turned out to be racy in the presence of
DelayedClientStream since DelayedClientStream does not guarantee that
the listener has processed before returning.

Now we let the stream handle decompressor selection itself. Compressor
selection on client and server and decompressor selection on server
remain unchanged. Nothing prevents them from being changed, other than
it is currently unnecessary to fix the severe compressionTest flake.

Fixes #2865
Fixes #2157
2017-06-29 18:12:53 -07:00
ZHANG Dapeng 4e31ccba4c examples: use the official error_details.proto
The `error_details.proto` file in `examples/src/main/proto/` was not originated from grpc-java. 
It was officially opensourced at https://github.com/googleapis/googleapis/blob/master/google/rpc/error_details.proto
2017-06-29 16:05:33 -07:00
Eric Anderson fe0f67337d examples: Enable maven enforcer requireUpperBoundDeps
Everyone using maven should really use the rule, in order to prevent
accidentally using an older version of a common library, like protobuf.
2017-06-29 15:29:30 -07:00
ZHANG Dapeng 4edb352dd4 bazel: update netty tcnative to 2.0.5
Although this repo is not used in bazel build internally, it is exposed in a bzl rule.
2017-06-29 13:35:46 -07:00
ZHANG Dapeng 36f7b34b6e examples: add bazel build example
## Bazel

If you prefer to use Bazel:
```
(With Bazel v0.4.5 or above.)
$ bazel build :hello-world-server :hello-world-client
$ # Run the server:
$ bazel-bin/hello-world-server
$ # In another terminal run the client
$ bazel-bin/hello-world-client
```
2017-06-29 12:25:54 -07:00
Eric Anderson 8f75f8ee7c all: Don't depend directly on grpc-protobuf-lite
grpc-protobuf-lite brings in protobuf-lite as a dependency, which has
different versions of classes in protobuf. This causes duplicate classes
on the class path, which easily breaks things. Since lite the lite
runtime/codegen is incompatible with full protobuf, it makes sense to
only depend on one of the two.

grpc-protobuf actually already has a dependency on grpc-protobuf-lite,
but excludes the protobuf-lite dependency, making the dep safe. But this
is more of an implementation detail.

We only change deps so that JavaDoc, code coverage, and similar will
still include grpc-protobuf-lite.

Fixes #2985
2017-06-29 10:29:11 -07:00
Carl Mastrangelo 45085c3ce4 core: minor cleanup of 859d211b6e 2017-06-28 12:36:33 -07:00
zpencer f559cf4adf netty: client transport needs to flush fence operation (#3137)
This the cause of the flakey serverNotListening test, because the
NOOP_MESSAGE just sits around the pipeline. As a result, the
listener does not fire within the 1s verification timeout.
2017-06-28 10:23:48 -07:00
Kun Zhang 4b94237bb9 core: stop spying ServerCall in UtilServerInterceptorsTest. (#3146)
Per our internal checker, DoNotMock applies to spy() too.
2017-06-27 17:15:43 -07:00
Kun Zhang 47e90f7823 netty: fix NettyHandlerSettings synchronized on wrong object. (#3144)
Bug introduced in commit 8c017337eb
2017-06-27 16:20:53 -07:00
Kun Zhang 8c017337eb netty: InternalHandlerSettings should not be used by non-Internal classes. (#3143)
InternalHandlerSettings is part of "netty:internal" inside google,
which is used to allow controlled exposure of internals.
"netty:internal" depends on "netty", which consists of the rest of the
netty subproject.  Therefore, "netty" should not depend on
"netty:internal".
2017-06-27 14:22:01 -07:00
Eric Anderson 2109700e9e gitignore Bazel build result symlinks 2017-06-27 11:10:53 -07:00
Eric Anderson 418c8846d0 core: Fix Bazel building for :util
It is now using io.grpc.internal.SerializingExecutor.
2017-06-27 11:10:34 -07:00
Carl Mastrangelo e7fd6fc55e netty: upgrade to netty tcnative 2.0.5 2017-06-26 18:29:14 -07:00
zpencer 0fa2225623 netty: fix race condition for listeners attaching to connect future (#3122)
Sadly, the serverNotListening test is still flakey after this change, but this PR fixes a legit problem.

The listener to the connect future depends on the channel pipeline being intact. But the way it is attached allows the connect attempt to fail, and have the entire pipeline being torn down by netty before the .addListener actually runs. The result is that the listener will be attached to an already completed future, and the logic will be applied to an empty pipeline.

The fundamental problem is that there are two threads, the grpc thread, and the netty thread. This PR moves the listener attaching code into the netty thread, guaranteeing the listener is attached before any connection is made. It makes more sense for the code to live inside AbstractBufferingHandler, since handlers are generally free to swallow exceptions (the alternative is to make NettyClientHandler forward exceptions up the pipeline from itself). AbstractBufferingHandler needs the special guarantees, so it will be the one with special code.
2017-06-22 22:07:51 -07:00
ZHANG Dapeng b7e50ddd05 testing: move NoopClientCall & NoopServerCall to internal
one step for #3105
2017-06-22 15:10:58 -07:00
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