Commit Graph

971 Commits

Author SHA1 Message Date
Carl Mastrangelo 5e36a8deb5 all: upgrade to JUnit 4.12 2017-10-05 11:24:15 -07:00
Carl Mastrangelo f56be5423e core: sort bazel file 2017-10-04 17:39:33 -07:00
Devin Smith f5026cd334 core: remove unused, non-public INTEGER_MARSHALLER (#3530) 2017-10-03 10:42:52 -07:00
Carl Mastrangelo 02466744bb core: move census registration into internal
also preserve tracing bit when rebuilding a MethodDescriptor
2017-09-29 18:20:37 -07:00
ZHANG Dapeng 0d52e68a86 core: fix Bazel build
Resolves #3503
2017-09-29 09:59:55 -07:00
Eric Anderson e92b72588d Promote keepalive to ManagedChannelBuilder; stabilize
Fixes #3493
2017-09-27 11:59:04 -07:00
Eric Gribkoff 63c660b29c core: make enableFullStreamDecompression non-abstract 2017-09-26 10:00:43 -07:00
Kun Zhang a6653bb135 core/compiler: register Span names for code-generated methods (take 2)
This is a more favorable approach than #3467. Doing the registration
in MethodDescriptor should allow us to deregister in case the
generated stub and its MethodDescriptors are garbage-collected
routinely, e.g., if they are loaded by a separate ClassLoader.
2017-09-25 15:38:48 -07:00
Eric Gribkoff 5ac9ad0c1f core: client supports inbound gzipped streams (#3403) 2017-09-25 09:01:53 -07:00
Eric Gribkoff a34ea3592c core: add gzip inflater for compressed streams (#3395) 2017-09-22 09:09:37 -07:00
ZHANG Dapeng 20c910f809 core: nonnull pendingStreams in DelayedClientTransport
Make `pendingStreams` in `DelayedClientTransport` non-null.
2017-09-22 09:04:58 -07:00
Eric Anderson bd28b92850 Avoid catching AssertionError in tests
Found via ErrorProne
2017-09-20 09:43:50 -07:00
pieterjanpintens 6bb1755357 core: allow to fallback to ServiceLoader.load withouth classloader to
make GRCP more OSGi friendly.
2017-09-20 08:42:16 -07:00
Kun Zhang 0ba4ab8b85 core: remove reference to Guava collect
It was added by mistake in commit 2b1363d586
2017-09-19 16:26:29 -07:00
Kun Zhang 7e534ed704 core: record individual messages with sizes to Census/tracing (#3461)
Two methods, outboundMessageSent() and inboundMessageRead() are added to StreamTracer in order to associate individual messages with sizes. Both types of sizes are optional, as allowed by Census tracing.

Both methods accept a sequence number as the type ID as required by Census. The original outboundMesage() and inboundMessage() are also replaced by overrides that take the sequence number, to better match the new methods. The deprecation of the old overrides are tracked by #3460
2017-09-19 09:22:11 -07:00
Eric Anderson a3ff9cd784 all: Keep artifacts dependencyConvergence-clean
Maven Enforcer's dependencyConvergence is commonly used in Spring
projects, as it is inherited by all starter projects[1]. While I find
that option to be crazy and harmful (and would instead support
requireUpperBoundDeps), it does bother people.

1. https://github.com/spring-projects/spring-boot/blob/v1.5.6.RELEASE/spring-boot-starters/pom.xml#L94
2017-09-18 16:20:18 -07:00
Kun Zhang 8ee9fb5183 core: add internal API to disable stats and/or tracing. (#3464) 2017-09-15 10:00:12 -07:00
Carl Mastrangelo abea73c0af core: add finalizer checks for ManagedChannels (#3452)
* core: add finalizer checks for ManagedChannels

Cleaning up channels is something users should do.  To promote this
behavior, add a log message to indicate that the channel has not
been properly cleaned.

This change users WeakReferences to avoid keeping the channel
alive and retaining too much memory.  Only the id and the target
are kept.  Additionally, the lost references are only checked at
JVM shutdown and on new channel creation.  This is done to avoid
Object finalizers.

The test added checks to see that the message is logged.  Since
java does not allow forcing of a GC cycle, this code is best
effort, giving up after about a second.  A custom log filter is
added to hook the log messages and check to see if the correct
one is present.  Handlers are not used because they are
hierarchical, and would be annoying to restore their state after
the test.

The other tests in the file contribute a lot of bad channels.  This
is reasonable, because they aren't real channels.  However, it does
mean that less than half of them are being cleaned up properly.
After trying to fix a few, it is too hard to do.  It would only
serve to massively complicate the tests.

Instead, this code just keeps track of how many it wasn't able to
clean up, and ignores them for the test.  They are still logged,
because really they should be closed.
2017-09-14 21:19:22 -07:00
zpencer 2b1363d586 core,netty,okhttp,protobuf-lite: avoid @Beta guava classes (#3463) 2017-09-14 19:39:06 -07:00
zpencer bda67784c0 core,netty,okhttp: strip outbound headers with reserved names (#3098)
These will be stripped:
CONTENT_TYPE, TE, USER_AGENT
2017-09-14 15:26:36 -07:00
Kun Zhang df92533524 grpclb: fallback to backend addresses (#3439)
The GRPCLB client will use the backend addresses from resolver if it has not received any server list from any balancer after a certain timeout (10s).
2017-09-12 12:25:08 -07:00
Lukasz Strzalkowski 731bbefb17 core, compiler, protobuf: introduce MethodDescriptor#setSchemaDescriptor 2017-09-11 09:57:03 -07:00
ZHANG Dapeng 65530bb71b core: ClientCallImpl start should not be called after cancel
Added checkState for this condition.
2017-09-11 09:45:07 -07:00
Carl Mastrangelo 53f56a32f1 inprocess,core: add ManagedChannelBuilder and ServerBuilder factory hiders
* inprocess,core: add ManagedChannelBuilder and ServerBuilder factory hiders

Because the factory for Channels and Servers resides on the builder
itself, it is easy for subclasses to accidentally inherit the
factory.  This causes confusion, because calling a static method on
a specific class may result in a different class.

This change adds hiding static factories to each builder, and a test
to enforce that each subclass hides the factory.  The test lives in
the interop tests, because it has a classpath dependency on all the
existing transports.

Minor note: the test scans the classpath using a Beta Guava API.
The test can be disabled if the API goes away.
2017-09-06 15:21:17 -07:00
Kun Zhang ddd31d6799 core/census: set method name tag to the server handler's context (#3436) 2017-09-06 10:04:50 -07:00
Carl Mastrangelo aaebf6e967 core: name more anonymous classes in ServerImpl
This makes it much easier to read stack traces since the name of the
event is in the frame.
2017-09-01 15:32:07 -07:00
Carl Mastrangelo 4c721b7490 core: save alloc in SerializingExecutor 2017-08-30 12:52:25 -07:00
Carl Mastrangelo f61acf5eb9 core: remove unused buffer methods 2017-08-29 19:05:06 -07:00
Eric Anderson 6164b7b2ee Move jmh benchmarks to their respective modules
The benchmarks should be close to the code they're benchmarking, like
we do with tests.

This includes a bugfix to SerializingExecutorBenchmark to let it run.

The io.grpc.benchmarks.netty benchmarks in benchmarks/ depend on
ByteBufOutputMarshaller from benchmarks's main, so they were not moved.
2017-08-28 13:37:39 -07:00
Carl Mastrangelo a53d030b5c core: fix lint warnings 2017-08-25 11:23:03 -07:00
Eric Gribkoff cfc9433ee3 core: advance past empty buffer in CompositeReadableBuffer (#3392) 2017-08-24 21:35:25 -07:00
Eric Anderson 521c55e9bd Avoid request threads on AppEngine Java 8
While the code had correctly determined full threads were available, the
call to MoreExecutors returned a request thread factory, which has
limitations.

Note that Async stub users may not be able to call GAE APIs in
callbacks. This is because the threads aren't request threads. They can
override the individual call's executor with
com.google.appengine.api.ThreadManager.currentRequestThreadFactory() in
an interceptor via callOptions.withExecutor().

Fixes #3296
2017-08-24 15:47:45 -07:00
John Hume 5c902c9384 Fix gson / opencensus bazel naming mixup
In 72b9ee2, gson kept its old name while opencensus got what should have
become gson's new name instead of a fixed opencensus name.
2017-08-23 15:48:08 -07:00
ZHANG Dapeng dafea0100a core: ForwardingChannelBuilder
Introduced `ForwardingChannelBuilder`, in the same pattern as `ForwardingClientCall` etc.
2017-08-23 12:48:12 -07:00
Kun Zhang 8d6ff4c9b4 core: enable Census trace context propagation. (#3361)
Note a Census tracing implementation, which is not included in gRPC,
is still required for tracing to work.
2017-08-18 17:19:52 -07:00
Kun Zhang 34857580ff core/test: remove ineffective assertions. (#3352)
The assertions are actually wrong and fail every time.  It doesn't
cause test failures because SharedResourceHolder calls them in a
scheduled executor because of its delayed close feature.

It's better to remove them, rather than leaving them there deceiving
us.
2017-08-16 15:59:48 -07:00
Kun Zhang 41410345e6 core: pass status to ManagedClientTransport.shutdown() (#3351)
This aligns with shutdownNow(), which is already accepting a status.
The status will be propagated to application when RPCs failed because
of transport shutdown, which will become useful information for debug.
2017-08-16 10:23:07 -07:00
ZHANG Dapeng c71e2919de all: fix typo of overridden
s/overriden/overridden/g
2017-08-11 16:53:53 -07:00
ZHANG Dapeng 8e0cf27822 core: use static imports for repeated state enums 2017-08-11 16:53:16 -07:00
Eric Gribkoff 9b74f8e756 core,netty,okhttp: add option to deframe in app thread 2017-08-11 16:52:45 -07:00
Eric Gribkoff a446b5388f core: switch to scheduled closing of MessageDeframer 2017-08-11 16:52:45 -07:00
Eric Gribkoff 16575d01a3 core,netty,okhttp,testing: switch to StreamListener.messagesAvailable 2017-08-11 16:52:45 -07:00
Paul Gross 72b9ee22b8 all: Fix mismatch in naming Bazel Maven jars
This commit aligns the naming of the Bazel Maven jars with the names
used by Bazel's migration-tooling project:

https://github.com/bazelbuild/migration-tooling

Unfortunately, we can't fix @com_google_protobuf_java because it's
required by Bazel itself.

Fixes #3328
2017-08-11 16:39:43 -07:00
myPrecious 13ef2261d6 core: Use bulk operation instead of iteration 2017-08-11 15:42:14 -07:00
ZHANG Dapeng 65ea0bde5d core,grpclb: deprecate LoadBalancer.Helper.updatePicker() 2017-08-10 17:05:54 -07:00
ZHANG Dapeng e5ef92c57c core: implement Channel State API for RoundRobin 2017-08-09 18:00:01 -07:00
ZHANG Dapeng 04fd4bc9b1 core: implement Channel State API for PickFirst 2017-08-09 17:59:34 -07:00
Eric Anderson c16edb3c90 core: Providers should consider Robolectric as Android
null class loader means to use the bootstrap class loader, which would
normally make sense. However, Robolectric tests run on OpenJDK and
provide the Android environment as part of the application, so "Android"
won't be present in the bootstrap class loader.
2017-08-09 11:01:15 -07:00
myPrecious f46280ae9f core: Java Refactor
Duplicate throws exception, and Javadoc issues: ManagedChannelImplTransportManagerTest.java has been deleted.
2017-08-09 09:11:19 -07:00
Kun Zhang 16f4de4636 core/stats: report message count metrics to Census. (#3312) 2017-08-04 15:58:21 -07:00