Bryce Anderson

@BryceAnderson22

Posted April 11, 2018

April 2018 Release Notes - Version 18.4.0

Our April releases have arrived!

Finagle 18.4.0, Finatra 18.4.0, Scrooge 18.4.0, TwitterServer 18.4.0, and Util 18.4.0.

Finagle

New Features

  • finagle-core: c.t.f.filter.NackAdmissionFilter can now be disabled via a with-method. $Protocol.client.withAdmissionControl.noNackAdmissionControl 323a20f4

  • finagle-mysql: Exceptions now include the SQL that was being executed when possible. 5a54f45d

  • finagle-mysql: Address PreparedStatement usability from Java via PreparedStatement.asJava(). Through this, you can use the API with varargs and Java 8 lambdas. c5bd6b97

  • finagle-mysql: Added support for Option\s to Parameter implicits. This allows for the natural represention of nullable columns with an Option where a None is treated as a null. 48f688d1

  • finagle-netty4: Add ‘tls/connections’ gauge for Finagle on Netty 4 which tracks the number of open SSL/TLS connections per Finagle client or server. 911a01ce

  • finagle-redis: Support has been added for a number of new cluster commands introduced in Redis 3.0.0. 86b151bf

Bug Fixes

  • finagle-mysql: Fix handling of interrupts during transactions. 1b9111eb

Breaking API Changes

  • finagle-core: c.t.f.ssl.client.HostnameVerifier has been removed since it was using sun.security.util.HostnameChecker which is no longer accessible in JDK 9. 1313d9ba

  • finagle-thrift: Upgraded libthrift to 0.10.0, c.t.f.thrift.Protocols.TFinagleBinaryProtocol constructor now takes stringLengthLimit and containerLengthLimit, NO_LENGTH_LIMIT value changed from 0 to -1. 61c7a711

  • finagle-thrift: Move “stateless” methods in c.t.finagle.thrift.ThriftRichClient to c.t.finagle.thrift.ThriftClient. Then mix the ThriftClient trait into the ThriftMux and Thrift Client companions to make it clearer that these stateless methods are not affected by the changing state of the configured client instance but are instead simply utility methods which convert or wrap the incoming argument. 7a175a98

  • finagle-base-http: Removed deprecated c.t.f.Cookie.value_=; use c.t.f.Cookie.value instead. 4bdd261b

  • finagle-base-http: Removed deprecated c.t.f.Cookie.domain_=; use c.t.f.Cookie.domain instead. 4bdd261b

  • finagle-base-http: Removed deprecated c.t.f.Cookie.path_=; use c.t.f.Cookie.path instead. 4bdd261b

Runtime Behavior Changes

  • finagle-core: Add minimum request threshold for successRateWithinDuration failure accrual. b6caf3dd

  • finagle-core: c.t.f.filter.NackAdmissionFilter no longer takes effect when the client’s request rate is too low to accurately update the EMA value or drop requests. 387d87d4

  • finagle-core: SSL/TLS client hostname verification is no longer performed by c.t.f.ssl.client.HostnameVerifier. The same underlying library sun.security.util.HostnameChecker is used to perform the hostname verification. However it now occurs before the SSL/TLS handshake has been completed, and the exception on failure has changes from a c.t.f.SslHostVerificationException to a javax.net.ssl.CertificateException. 1313d9ba

  • finagle-core: Closing c.t.f.NullServer is now a no-op. 36aac62c

  • finagle-netty4: Netty ByteBuf leak tracking is enabled by default. 24690b13

Deprecations

  • finagle-thrift: System property “-Dorg.apache.thrift.readLength” is deprecated. Use constructors to set read length limit for TBinaryProtocol.Factory and TCompactProtocol.Factory. 61c7a711

Finatra

Added

  • finatra-http: Added the ability for requests to have a maximum forward depth to c.t.finatra.http.routing.HttpRouter, which prevents requests from being forwarded an infinite number of times. By default the maximum forward depth is 5. cb236294

  • inject-thrift-client: Update configureServicePerEndpoint and configureMethodBuilder in ThriftMethodBuilderClientModule to also pass a c.t.inject.Injector instance which allows users to use bound instances from the object graph when providing further thriftmux.MethodBuilder or ThriftMethodBuilderFactory configuration. ee16c1c6

  • inject-thrift-client: Update configureThriftMuxClient in ThriftClientModuleTrait to also pass a c.t.inject.Injector instance which allows users to use bound instances from the object graph when providing further ThriftMux.client configuration. e3047fe3

  • inject-server: Capture errors on close of the underlying TwitterServer. The embedded testing utilities can now capture and report on an exception that occurs during close of the underlying TwitterServer. EmbeddedTwitterServer#assertCleanShutdown inspects for any Throwable captured from closing the underlying server which it will then throw. 0e304bbc

  • finatra-http: Created a new API into c.t.f.h.response.StreamingResponse which permits passing a transformer which is an AsynStream[T] => AsyncStream[(U, Buf)] for serialization purposes, as well as two callbacks – onDisconnect, called when the stream is disconnected, and onWrite, which is a respond side-effecting callback to every individual write to the stream. ab44378c

Changed

  • inject-app: Update and improve the test #bind[T] DSL. The testing #bind[T] DSL is lacking in its ability to be used from Java and we would like to revise the API to be more expressive such that it also includes binding from a Type to a Type. Due to wanting to also support the ability to bind a Type to a Type, the DSL has been re-worked to more closely match the actual Guice binding DSL.

For Scala users the #bind[T] DSL now looks as follows:

    bind[T].to[U <: T]
    bind[T].to[Class[U <: T]]
    bind[T].toInstance(T)

    bind[T].annotatedWith[Ann].to[U <: T]
    bind[T].annotatedWith[Ann].to[Class[U <: T]]
    bind[T].annotatedWith[Ann].toInstance(T)

    bind[T].annotatedWith[Class[Ann]].to[U <: T]
    bind[T].annotatedWith[Class[Ann]].to[Class[U <: T]]
    bind[T].annotatedWith[Class[Ann]].toInstance(T)

    bind[T].annotatedWith(Annotation).to[U <: T]
    bind[T].annotatedWith(Annotation).to[Class[U <: T]]
    bind[T].annotatedWith(Annotation).toInstance(T)

    bindClass(Class[T]).to[T]
    bindClass(Class[T]).to[Class[U <: T]]
    bindClass(Class[T]).toInstance(T)

    bindClass(Class[T]).annotatedWith[Class[Ann]].to[T]
    bindClass(Class[T]).annotatedWith[Class[Ann]].[Class[U <: T]]
    bindClass(Class[T]).annotatedWith[Class[Ann]].toInstance(T)

    bindClass(Class[T]).annotatedWith(Annotation).to[T]
    bindClass(Class[T]).annotatedWith(Annotation).[Class[U <: T]]
    bindClass(Class[T]).annotatedWith(Annotation).toInstance(T)

For Java users, there are more Java-friendly methods:

    bindClass(Class[T], T)
    bindClass(Class[T], Annotation, T)
    bindClass(Class[T], Class[Annotation], T)

    bindClass(Class[T], Class[U <: T])
    bindClass(Class[T],  Annotation, Class[U <: T])
    bindClass(Class[T], Class[Annotation], Class[U <: T])

Additionally, these changes highlighted the lack of Java-support in the TwitterModule for creating injectable Flags. Thus c.t.inject.TwitterModuleFlags has been updated to also provide Java-friendly flag creation methods:

    protected def createFlag[T](name: String, default: T, help: String, flggble: Flaggable[T]): Flag[T]
    protected def createMandatoryFlag[T](name: String, help: String, usage: String, flggble: Flaggable[T]): Flag[T]

0d532084

  • inject-thrift-client: The “retryBudget” in the c.t.inject.thrift.modules.ThriftMethodBuilderClientModule should be a RetryBudget and not the generic Budget configuration Param. Updated the type. 8feea4bb

  • inject-server: Move HTTP-related concerns out of the embedded testing utilities into specific HTTP “clients”. The exposed httpAdminClient in the EmbeddedTwitterServer and the httpClient and httpsClient in the EmbeddedHttpServer are no longer just Finagle Services from Request to Response, but actual objects. The underlying Finagle Service[Request, Response] can be accessed via Client.service. 0e304bbc

Scrooge

  • scrooge-generator: Add support for construction_required fields. Add a validateNewInstance method to all generated scala companion objects. cbde3312

  • scrooge-core: Check for corruption in size meta field of container and throw an exception if size is found corrupted. 75392161

  • scrooge: Upgrade libthrift to 0.10.0. 997f2464

TwitterServer

No Changes

Util

New Features

  • util-app: Add the ability to bind specific implementations for LoadService.apply via App.loadServiceBindings. 74058678

  • util-core: Introduce the ClosableOnce trait which extends the guarantees of Closable to include idempotency of the close method. ccd1c697

Runtime Behavior Changes

  • util-app: Add visibility for NonFatal exceptions during exiting of c.t.app.App. Added visibility into any NonFatal exceptions which occur during the closing of resources during App#close. b152745e

  • util-core: Ensure the Awaitable.CloseAwaitably0.closeAwaitably Future returns. Because the closed AtomicBoolean is flipped, we want to make sure that executing the passed in f function satisfies the onClose Promise even the cases of thrown exceptions. 0c793f97

  • util-stats: Alphabetically sort stats printed to the given PrintStream in the c.t.finagle.stats.InMemoryStatsReceiver#print(PrintStream) function.

    To include stats headers which provide better visual separation for the different types of stats being printedm, set includeHeaders to true. E.g.,

    InMemoryStatsReceiver#print(PrintStream, includeHeaders = true)
    

    a60a311c

Changelogs