Dependencies
- core: Now using io.opencensus:opencensus-api and io.opencensus:opencensus-contrib-grpc-metrics instead of com.google.instrumentation:instrumentation-api for stats and tagging. The gRPC Monitoring Service continues to use instrumentation-api.
- examples: In Android example, bump minSdkVersion to 14. Google Play Services, which is used for TLS, bumped their minimum supported version
API Changes
- core: Removed deprecated load balancer and name resolver APIs. This includes
LoadBalancer.handleResolvedAddresses()
,LoadBalancer.Helper.updatePicker()
,NameResolver.Listener.onUpdate()
,ResolvedServerInfo
, andResolvedServerInfoGroup
- stub: Added
@DoNotMock
annotations toAbstractStub
,CallStreamObserver
,ClientCallStreamObserver
,ServerCallStreamObserver
. The normal gRPC implementations of these classes should be used in tests - codegen: Removed
enable_deprecated
protoc plugin option (#3541). These deprecated APIs pre-date 1.0 and were off by default - codegen: Added methods for accessing generated method descriptors. This replaces the
METHOD_FOO
constants with staticgetFooMethod()
methods. The constants are deprecated and will be removed in a future release. Once the constants are removed, this change will allow the descriptors (and the messages they reference) to be lazily created which can dramatically decrease class initialization time and allows unused RPC messages to be removed by Proguard. - testing:
TestMethodDescriptors.noopMethod()
is deprecated in favorvoidMethod()
or test services. The simple service in grpc-testing-proto should work in most cases wherevoidMethod()
is insufficient - testing: Marked
DeadlineSubject
experimental. It is planned for removal to ease future Guava dependency issues with Truth. It could be moved into its own artifact, but best as we can tell nobody is using it. If you're using it, please file an issue so we can be made aware - testing: Deprecated
StreamRecorder
. It will be removed in a future release. The class is very old (since the beginning in OSS) and was used in internal tests before there were blocking stubs. Most users should use blocking stubs instead. To use properly, you must know the class's implementation; if you liked it, copy the code to your own codebase - testing: Deprecated
TestUtils.recordServerCallInterceptor()
. It will be removed in a future release. It has no known use cases for normal users - The (unreleased) Thrift support has been removed from this repository. It can be found at https://github.com/grpc-ecosystem/grift instead
New Features
- The Cronet transport is open-sourced. Cronet is Chrome's network stack made into a library for mobile. We do not provide a build file nor are we making binaries, but if you're interested it shouldn't be too hard to build manually
- context:
CancellableContext
now implementsCloseable
(#3607).close()
is an alias forcancel(null)
. This should make it more clear that the context needs to be cancelled/closed, while also enabling try-with-resources - core:
Attributes.Builder.build()
may now be called multiple times - core: Added first-class drop support for load balancers via
PickResult.withDrop(Status)
. This is necessary if the LB wants to failwaitForReady
RPCs to shed load - core: Added
MethodDescriptor.getSampledToLocalTracing()
/Builder.setSampledToLocalTracing
to permit per-method stats keeping memory overhead (#3627). The option is to prevent unbounded memory overhead when dynamically-created MethodDescriptors are used and is enabled in the generated code. - core: Added
resetConnectBackoff()
method toManagedChannel
. This can be used when the OS notifies your application that the network has become available - stub: Added
stub.withExecutor(Executor)
. This was already available on CallOptions and can be used to specify a call-specific executor to use for callbacks - testing: Added
TlsTesting.loadCert
as an alternative to deprecatedTestUtils.loadCert
. The TlsTesting version returns anInputStream
instead of aFile
which avoids creating temporary files
Behavior changes
- core: Added handshake timeout for all server transports. The default is 20 seconds (which is a bug; should be 120 seconds to match client-side). The default can be overridden by
ServerBuilder.handshakeTimeout()
- core: LoadBalancer callbacks will no longer be called after shut down (#3573). This changes the behavior to match that documented in
LoadBalancer.shutdown()
- core: Refresh name resolution when an OOB connection is closed (#3588). This has already been happening for Subchannels.
- netty,okhttp: Now detecting proxy via
ProxySelector
. This enables observation of the Java-standard proxy options-Dhttps.proxyHost=host -Dhttps.proxyPort=port
.Authenticator
is consulted for along with auth. Users of theGRPC_PROXY_EXP
environment variable should migrate; the environment variable will be removed in a future release. - netty: Connection log info has been moved to a separate logger:
io.grpc.netty.NettyServerTransport.connections
(#3591). - auth: Treat
IOExceptions
asUNAVAILABLE
instead ofUNAUTHENTICATED
(#3267). This allows retrying RPCs if the OAuth token failed to be retrieved
Bug fixes
- core: Fixed ManagedChannel docs since it supports the getState/notifyWhenStateChanged API (#3762)
- core: When Context cancellation cancels an RPC, and the Context cancellation cause is
null
, we now include a description in the Status to help expose what happened - netty: Fixed broken server keepalive when using TLS. If using Netty server, server keepalives, and TLS, you were impacted. Plaintext did not exhibit the bug. This could trigger grpc-java clients to log "WARNING: Received unexpected ping ack. No ping outstanding."
- netty: Improved ALPN error message to be less misleading and link to troubleshooting procedures
- netty: Fixed clearing of SSLParameters. This may fix ALPN with JDK9, but full support for ALPN with JDK9 is still later work and not supporting it yet. Fixes #3532
- netty: When a RST_STREAM kills an RPC, we now include the HTTP/2 error code in the Status
- netty: Fixed Netty server poorly handling unknown content type. It previously would refuse the stream; now it responds with a normal grpc status and HTTP error code
- bazel: java_grpc_library: Fixed remote protos that are 'src's. Fixes #3650
- examples: Replaced IntelliJ IDEA-specific sourceDirs with sourceSets. This helps Eclipse and other IDE users
Documentation
- SECURITY.md now includes a table showing the preferred Netty and netty-tcnative version for each grpc-java release
- SECURITY.md clarify that the Dynamic Security Provider must be installed before OkHttp channel creation