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.