Releases: grpc/grpc-java
v1.0.0-pre1 Release
API Changes
- Generated interfaces and methods that were deprecated in v0.15.0 are now removed. To ease migration, the grpc protoc plugin supports the option
enable_deprecated=true
which will re-enable the old generated APIs. This option will be removed in a later release.- Mocking stubs is no longer supported. Most tests should use the inprocess transport, which is fast and lightweight, especially when using
directExecutor()
for both the client and server. Some tests may need to use aClientInterceptor
to verify theCallOptions
. We plan to improve convenience utilities over time; please file a bug for testing issues or suggested utilities.
- Mocking stubs is no longer supported. Most tests should use the inprocess transport, which is fast and lightweight, especially when using
- Reduced default max message size from 100 MiB to 4 MiB.
ManagedChannelBuilder.maxMessageSize()
andServerBuilder.maxMessageSize()
can override the default. Larger sizes are not a problem for grpc, but applications should be aware when they may receive large messages.
New Notables
- Update Netty to 4.1.3.Final. This resolves a flow-control accounting, off-by-one bug when interoperating with HTTP/2 implementations that use padding (netty/netty#5434). The off-by-one accumulates over time, which could eventually hang a long-lived TCP connection. gRPC implementations do not use padding today, nor do most HTTP/2 proxies. Google's GFE does use padding which impacts all Google-hosted APIs, but requires receiving GBs per connection before triggering a hang.
- Channel can now enter IDLE after a period of no RPCs, which can be enabled via
ManagedChannelBuilder.idleTimeout()
. IDLE disconnects the TCP connection and shuts down the name resolver and load balancer. This is generally useful for reducing resources, but can also be used on Android to avoid broken TCP connections on bad networks and "avoid" timeouts of NATs and load balancers. - Keepalive support for OkHttp, which can be enabled via
OkHttpChannelBuilder.enableKeepAlive()
. Keepalive uses HTTP/2 PINGs while RPCs are in progress to monitor the TCP connection and signal activity to NATs and load balancers. Keepalive does nothing if no RPCs are in progress, thus is primarily useful when for long-lived streaming RPCs. This implementation preempts the design of keepalive being finalized, but was important enough for mobile networks to have something available sooner. This can be used on Android to detect broken TCP connections on bad networks and reset timeouts of NATs and load balancers. - Revamped compilation of examples. Examples are now divorced from the rest of grpc-java's build process. Maven can now be used to build the examples, and the Gradle build file is simplified. Both builds are intended to be copyable for your own project.
Other
- Hard-code providers list for Android, moving away from
ServiceLoader
on the platform. If your application never callsClass.getResource()
, this will reduce memory on some Android versions and speed construction of your firstManagedChannel
. This also simplifies the necessary ProGuard configuration. General-purpose 3rd-party providers for NameResolver and ManagedChannel that may be used on Android should request to be added to the hard-coded list. ClientCall.cancel(String, Throwable)
is now a required method and will log a warning when called with neither a message nor cause. This completes the migration fromClientCall.cancel(void)
which was very difficult to debug where cancel was called.- Bug fix:
StatusRuntimeException
s for blocking unary calls should now include trailers. - Miscellaneous fixes.
v0.15.0 Release
Major Changes
- significant performance improvements around header processing
- generated AbstractService class and interfaces are now deprecated in favor of ServiceImplBase
- made Context is no longer experimental (#1705)
Generated Code / Stub
- static bindService() method is deprecated
- added ClientResponseObsever to interact with advanced features like flow-control
Core
- improved error messages when unable to find a name resolver
- fix onReady race by adding DelayedStreamListener
- added a RoundRobin Loadbalancer
- clarified and extended core documentation (#1479, #714, #986, #1962, #1805)
- fix race with exception in onMessage and onCompleted (#1652)
- made ServiceDescriptor final, and now accepts a collection of methods.
- made ServerInterceptor, BindableService, ServerCallHandler non experimental (#1711, #1701)
- promoted Deadline API no longer be experimental
- added a NameResolverProvider
- remove deprecated ClientCall.cancel overload
- new client calls no longer get their a new context (fixes a stack overflow, #1926)
- made CallOptions accept custom values
- enable per-message compression by default, if a compression method is set.
- added a fail-fast feature, which makes new RPCs fail if there are no connections
- added CallOptions.waitForReady to support fail-fast
- log exceptions from scheduled tasks (#1759)
- implemented ManagedChannel.shutdownNow (#448)
- made URI parsing for targets more robust (#1883)
- increased visibility of Code.status() and Status.fromCode (#1722)
- methodDescriptor argument moved from ServerInterceptor to ServerCall
- added a health checking service (not on by default) (#647)
- server call exception is saved when a message fails to close
- status exceptions can now hold additional metadata
- allow ClientCall.cancel before start. Fixes #1536
- split HandlerRegistry into an immutable default and a fallback for dynamic dispatch
- made Context.fork return a normal Context instead of CancellableContext (1626)
- reduced memory usage when cancelling calls by using the right executor
Examples
- stopped using deprecated generated classes
- added examples to show how to get error information from different stubs
- switch android example to use proto lite instead of nano proto
- moved json encoding examples to the "advanced" package (#1778)
Auth
- added a CallCredentials class for propagating credentials
- promote OAuth2 service accounts to JWT (#785)
- add MoreCallCredentials.from(Credentials) to work with the Google Auth Library
- made ClientAuthInterceptor deprecated
Netty
- fixed a bug when headers could get corrupted during decoding
- use boringssl uberjar
- detect when ALPN was not used. (#522)
- add tests for Netty bug where a channel would break after a RST_STREAM frame (#1682)
- added Trailiers to the Status for BlockingResponseStream (#1861)
- call transportShutdown immediately on ID exhaustion (#1819)
Protobuf
- bump dependency to 3.0.0-beta-3
OkHttp
- fix NPE when using CLEARTEXT connectionSpec (#1815)
Other
- deflake lots of tests based on finding an empty port
- disable flaky test in ClientCallsTest
- improve ClientCall test to fail more obviously
- add test for MessageDeframer closed exception (#1795)
- benchmark transport flag now works in AsyncClient
- always set message encoding in headers, even for the "identy" encoding.
- updated error codes returned to match the specification (#1605)
- added a log message for unknown client streams
- added more detail when recieving GOAWAY
- cause removed from InProcessTransport (#1716)
- setRemoveOnCancelPolicy
v0.14.1 Release
- Update Netty to v4.1.1.Final, which is the first stable release we've released with. gRPC-java v0.14.0 was already compatible with Netty v4.1.1. This fixes cancellation causing Channel to black hole received data and fixes a DoS bug in renegotiation when using OpenSSL-based tcnative (BoringSSL not impacted).
- The Netty version bump also supports the "fat" tcnative-boringssl-static JAR that has binaries for all platforms. Simply depend on 1.1.33.Fork17 without any OS-specific classifier
- Reworked shutdown handling for OkHttp. Fixes "IllegalStateException: Listener is still attached to activeTransport. Seems transportTerminated was not called."
v0.14.0 Release
New Features:
- It is now possible to use JSON-encoded protobufs.
- ClientCall can now be passed in cancellation details.
- Both Client and Server interceptors can now work in reverse order. See
interceptForward()
. - Stubs can now parse messages using an
ExtensionRegistry
. - Server now has a getPort() method.
- Generated code now includes the version it was built at.
- Added more info for call cancellation.
- It is now possible to tell if a call was cancelled client side vs. server side.
CallOptions
now usesAttributes
for affinity routing.- Added
CallStreamObserver
andServerCallStreamObserver
as specialized Stub observers. CallOptions
and stubs now uses Deadline instead of a long of nanoseconds.
Major bugs fixed:
- Fixed a memory leak involving
TransportSet
s. - Netty based transports now shutdown upon GOAWAY.
- DNS Resolution is retried on error.
Other Changes:
- The grpc-all release artifact no longer repackages source and classes from other grpc artifacts, and instead depends on them
- Statuses and their exceptions now have a lot more detail about where they came from.
- Split Protobuf into Protobuf-lite specific parts.
- Status messages now use a URL encoding for messages.
- It is now possible to send newlines as well as non-ASCII charcacters in Status messages.
- Stubs now use an an abstract base class, which allows for easier stub binding.
v0.13.2 Release
- Updates to Netty 4.1.0.CR3, which allows using netty-tcnative-boringssl-static 1.1.33.Fork14 which does not give a warning about executable stacks. All users of netty-tcnative must update to Fork14 due to a method signature change in tcnative
- Fixes a bug in the Netty transport when handling GOAWAY that would cause all new RPCs on a Channel to fail until all preexisting RPCs completed. The new RPCs would fail with a message similar to "Cannot create stream 5 since this endpoint has received a GOAWAY frame with last stream id 3"
- Fixes a deadlock when using the InProcess transport
v0.13.1 Release
This release contains a single fix (103d3d1) to avoid an out-of-order headers bug impacting Netty-4.1.0.CR1. The bug manifests when starting multiple RPCs simultaneously as an opaque error before receiving any responses or the RPC never receiving any response or status. If an RPC was successful then it was not impacted
v0.13.0 Release
New and Notable:
- Support netty-tcnative-boringssl-static, which does not require OpenSSL to be installed. See SECURITY.md. The current build works but omits a warning; a fixed build is expected in a few days
- Reduce number of generated classes for services. We now generate a fixed number of classes per service
- Blocking stub now avoids the default executor of the channel. Processing is done on the blocked thread instead. This avoids a thread hop and reduces number of threads
- Reworked compression API
Context.Key
now uses instance equality, so if you reduce visibility to yourKey
you are guaranteed others can't access the value- Updated README to point to renamed Maven protoc plugin that is available on Maven Central
Other changes:
- Now depending against protobuf-3.0.0-beta-2, protobuf-nano-3.0.0-alpha-5, and netty-4.1.0.CR1
- Can now override the
Executor
for callbacks per-RPC LoadBalancer
now uses generics to no longer depend on any internal classes- Add
Metadata.keys()
for iterating over all metadata - Fix hanging RPCs caused by deadline expiring before RPC started (#1343)
- Better status for some failed RPCs
- Fixed a
ConcurrentModificationException
caused when new RPCs are being made when we transition to a freshly-connected transport - Context no longer has an internal
ScheduledExecutorService
; you must provide one when setting a deadline - Context cancellation on server-side is now more reliable
- Fix a Netty transport
ByteBuffer
leak when queued RPCs fail (#1401) - In-process transport now calls
onReady()
correctly (#875) - Mostly resolve leak due to retaining RPCs, even after they are cancelled, when connecting persistently fails (#1342)
- Fix interruption handling of blocking stubs to throw
StatusRuntimeException
instead of aRuntimeException
v0.12.0 Release
General:
- Commas are now permitted in metadata values
- Header names are now verified to contain only permitted characters (A-Z, a-z, underscore, dash, and period)
- Addition of
{ManagedChannel,Server}Builder.directExecutor()
for low-latency use cases, with specialized handling internally to remove unnecessary locking - Further Compression support
{Client,Server}Call.request()
is now defined as thread-safe- Increased unit test code coverage
- Bug fixes
Android:
- Hostname verification on Android, when not providing your own
SSLCertificateSocketFactory
OkHttpChannelBuilder.overrideHostForAuthority()
is deprecated; useoverrideAuthority()
which is available on allManagedChannelBuilder
s- The codegen now places codegen intended for use with JavaNano protobuf in a 'nano' subpackage by default, like JavaNano does, and also observes
javanano_use_deprecated_package
- Codegen object allocation optimization for JavaNano protobuf
- No longer referencing internal OkHttp classes; grpc now has its own copy of such classes. This reduces grpc's dependence on a particular version of OkHttp
Servers/Datacenter:
- A strong beginning to client-side load balancing support. No server-side portion is provided, so not widely usable at this time. Providing custom load balancers is supported via
ManagedChannelBuilder.loadBalancerFactory
. Expect more in this area in the future - A strong beginning to name resolution support, via
ManagedChannel.forTarget()
. Providing custom name resolvers is supported viaManagedChannelBuilder.nameResolverFactory
. Currently only DNS is implemented. Expect more in this area in the future - Fixed potential for flow-control deadlocking when activity on one stream is based on another in Netty (#1175)
- Fix Netty transport failing to close all calls when notified that the TCP connection dropped (#1251)
Context:
Context
helpers forExecutor
s:Context.wrap(Executor)
andContext.propagate(Executor)
. The former uses the current context whereas the latter uses the currentContext
whenExecutor.execute()
is calledContext
no longer maintains a stack of attachments and now just maintains the "current". Now,attach()
returns the previously-attachedContext
which is then required to be passed toContext.detach()
. This allows naturally restoring a consistent state when applications have bugs when attached/detachingContext
s- During cancellation
Context
now notifies all its direct listeners before notifying child contexts - Initial support for
Context
on both client and server. For client, the currentContext
during new call creation will be the current context during callbacks. For server, a newContext
is created for each incoming call and cancelled when server responds
v0.9.1 Release
- Hostname verification on Android, when not providing your own
SSLCertificateSocketFactory
- Fix Netty transport failing to close all calls when notified that the TCP connection dropped (#1251)
v0.9.0 Release
This release of gRPC-Java is considered beta quality.
As of this release, we expect no breaking API changes unless marked otherwise. This applies to API in packages io.grpc
, io.grpc.auth
, io.grpc.stub
, and io.grpc.protobuf
, as well as normal protobuf generated code. This does not apply to undocumented behavior; we are very likely to align gRPC-Java with the other gRPC implementations by trying harder before failing RPCs.
The codegen is not yet guaranteed forward-compatible as it uses unstable APIs. This will be resolved by 1.0. For now, you must still use the same version of the gRPC-Java protoc plugin as runtime version.
Major changes
- APIs marked with
@Internal
should not be used and those marked with@ExperimentalApi
may change in the future - Daemon threads are now used for all default thread pools
StreamObserver.onValue
has been renamed toonNext
to align with RxJava- Uses of
ChannelImpl
should now becomeManagedChannel
ManagedChannelBuilder.forAddress(String, int)
is now the preferred way of obtaining a channel builder; all transport-specific APIs do not have guaranteed API stability. Similarly, there isServerBuilder.forPort(int)
for server-side- Support for using OpenSSL via tcnative. It is preferred over using jetty-alpn. It requires OpenSSL 1.0.1 or later to be installed. gRPC will automatically fallback to NPN for OpenSSL pre-1.0.2. Please see SECURITY.md for more information
- Metadata keys and ASCII values prohibit many characters, including comma. Comma may be permitted in the future
Minor changes
- Netty and OkHttp builders support
maxMessageSize(int)
configuration - Fixes to incorrect usages of various Status codes
- Updated to protobuf 3.0.0-beta-1. Codegen supports
javanano_use_deprecated_package
, but is not using it for determining which package to generate gRPC code. That will change in the next release - Zero-handshake JWT authentication support. To use, pass in
ServiceAccountJwtAccessCredentials
. In the future will likely support auto-conversion fromServiceAccountCredentials
for use withGoogleCredentials.getApplicationDefault()
- When server completes a call with an error,
ServerCall.onComplete()
is called instead ofServerCall.onCancel()
. This was already the behavior, but the documentation now agrees - General bug fixes