Commit Graph

888 Commits

Author SHA1 Message Date
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
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
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
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 49b9216e83 core: set server stream decompressor in transport thread 2017-06-12 12:00:21 -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 6ef77e0609 core: hide access to Status code and message keys 2017-06-08 10:16:06 -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 9c6ea274fe core: move NameResolverProvider to internal 2017-06-05 17:40:23 -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
Carl Mastrangelo 104350cf2e core: include how long deadline was in Status message 2017-05-31 15:04:10 -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
Carl Mastrangelo ee38b3754e core: remove 2 suffix from streams 2017-05-26 16:59:54 -07:00
William Thurston 6760bfec8a Log deadline narrowing events at FINE instead of INFO. 2017-05-26 15:28:34 -07:00
Eric Anderson cefcd39396 Fix incorrect assertEquals argument ordering
The expected value should be first.
2017-05-24 08:47:02 -07:00
Bogdan Drutu 530b714790 core/tracing: set always record events option for the RPC spans. (#2998) 2017-05-23 15:10:36 -07:00
Kun Zhang fae55a67a0 core: delete deprecated affinity API. (#3026)
Deprecated since 1.3.0
Resolves #1766
2017-05-19 15:04:40 -07:00
zpencer 347eb09d92 all: Minor updates to expand javadocs (#2991)
all: Minor updates to expand javadocs
2017-05-17 17:12:45 -07:00
Carl Mastrangelo 7be1720fce core: don't expose internal Metadata.headerCount 2017-05-15 18:33:10 -07:00
Eric Anderson cf0e161bd6 Remove unused variables
The removal of the poll()s is a behavior change, but the tests weren't
needing to call it.
2017-05-15 15:39:49 -07:00
Eric Anderson eb6acfe186 Javadoc improvements, especially to Context 2017-05-15 10:12:44 -07:00
Carl Mastrangelo 870dd50eb2 core: clarify more origin docs for Channel 2017-05-11 17:39:30 -07:00
Carl Mastrangelo 90559c7f0a core: add Since java doc annotations to Server, and clarify return types 2017-05-11 10:10:01 -07:00
ZHANG Dapeng bb978bac31 doc: initiate some package javadoc
Initated package javadoc for 
* `io.grpc.stub`, 
* `io.grpc.auth`, 
* `io.grpc.util`, 
* `io.grpc.protobuf`, 
* `io.grpc.protobuf.lite`,
* `io.grpc.protobuf.nano`
2017-05-10 11:29:07 -07:00
Eric Anderson f4173c34ad core,grpclb: Update addresses in OobChannel
This allows avoiding re-creating connections unnecessarily. For
NameResolvers that support notifications this avoids stampeding herds
when possible, since all clients may receive the notification at
approximately the same time.
2017-05-09 12:35:00 -07:00
Eric Anderson 30b61dbf4d core: Update addresses in Subchannel
This allows avoiding re-creating connections unnecessarily. For
NameResolvers that support notifications this avoids stampeding herds
when possible, since all clients may receive the notification at
approximately the same time.
2017-05-09 12:35:00 -07:00
Carl Mastrangelo 1f7c9d5716 core: document ServerBuilder return values and method history
Also, remove an erroneously added ExperimentalApi annotation.  The
method was non experimental as of the 1.0.0 release.
2017-05-05 10:34:10 -07:00
ZHANG Dapeng 5891c963e2 doc: fix broken links 2017-05-05 09:03:48 -07:00
Muxi Yan f674776a6c Add/Fix some docs (#2970)
* Add/Fix some docs

* Address comments

* Address comments

* Address comments

* Add remarks

* Build fixes

* Revision

* More revision
2017-05-04 10:57:49 -07:00
ZHANG Dapeng 7d048af68e javadoc: fix broken links in javadoc 2017-05-02 16:21:43 -07:00
zpencer a317912a14 Channel.authority() should return the value of overrideAuthority (#2956)
AbstractManagedChannelImplBuilder accepts an overrideAuthority parameter, but this value is not hooked up to the name resolver object. Ultimately, Channel.authority consults with the NameResolver, so the overrideAuthority should be hooked into the NameResolverFactory, while all other functionality should be preserved.

Also, add unit tests for all the variants of OkHttpChannelBuilder and NettyChannelBuilder constructors, namely to test the slightly different NettyChannelBuilder(SocketAddress) code path.

Fixes #2682
2017-04-27 14:17:38 -07:00
Kun Zhang 0d6b4184d1 Implement GRPCLB client-side load reporting (#2941)
Also updated load_balancing.proto to the latest version.
2017-04-27 11:28:28 -07:00
Kun Zhang be74e97b5d core: stop using static flags for Census control. (#2947)
Static mutable flags are evil.  Turned them to options on channel
builder.  Also restore the local stats recording by default, because
these flags were added with the concern of wire-compatibility, but not
local feature.
2017-04-26 10:50:55 -07:00
Kun Zhang 49bde5494b core: integrate instrumentation-java (Census) tracing (#2938)
Main implementation is in CensusTracingModule.

Also a few fix-ups in the stats implementation CensusStatsModule:

- Change header key name from grpc-census-bin to grpc-tags-bin
- Server does not fail on header parse errors. Uses the default instead.

Protect Census-based stats and tracing with static flags: `GrpcUtil.enableCensusStats` and `GrpcUtil.enableCensusTracing`. They keep those features disabled by default until they, especially their wire formats, are stabilized.
2017-04-25 13:53:29 -07:00
Fred Wulff ba1c4bf4ac core: Add support for the AppEngine development sandbox 2017-04-24 11:15:58 -07:00
Eric Gribkoff e36d229dc2 core,netty: remove grpc-payload-bin from GET requests 2017-04-21 10:22:05 -07:00
Carl Mastrangelo b7833dab05 core: lookup TXT records when doing name resolution 2017-04-20 14:11:48 -07:00
Kun Zhang 7cf35510f7 core: pass ServerCall to ServerStreamTracer. (#2930)
This is needed for GRPCLB server-side load reporting, which needs to record
the authority and peer identity.
2017-04-20 09:30:46 -07:00
Kun Zhang a92b0488ed core: add ServerCall.getAuthority() (#2925)
Resolves #727
2017-04-18 15:10:51 -07:00
Eric Anderson 965fe5d6e4 all: Fix basic compatibility with Mockito 2.7.19
We aren't upgrading yet, because we don't want to begin using the new
Mockito APIs. But all the tests now pass with the newer version. There
are a lot of warnings that can't be fixed until we bump the mockito
version.
2017-04-18 12:14:53 -07:00