Java client: frequent SSLExceptions

Hi there!

We are using Fauna’s latest Java client 3.0.0 in a Kotlin 1.3 app that runs on AWS Lambda on JDK 11.

It works most of the time, but fairly regularly (a few times per hour) requests to Fauna fail with the exception below. The exception is thrown upon invoking get() on the result of an invocation of FaunaClient.query().

Has anybody else experienced this? Are these exceptions indications of outages on Fauna’s side? Are we using the client wrong? Is it a bug in the client? Any pointers will be greatly appreciated!



java.util.concurrent.ExecutionException: SSLEngine closed already
    at java.util.concurrent.CompletableFuture.reportGet
    at java.util.concurrent.CompletableFuture.get
    at <our application code>

caused by: SSLEngine closed already
    at io.netty.handler.ssl.SslHandler.wrap(
    at io.netty.handler.ssl.SslHandler.wrapAndFlush(
    at io.netty.handler.ssl.SslHandler.flush(
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(
    at io.netty.util.concurrent.SingleThreadEventExecutor$
    at io.netty.util.internal.ThreadExecutorMap$

@Felix I am not aware of this exception and definitely not an indication of Faunadb outage. Probably something related to driver + load + payload size. Let me dig around to see if we can repro this. Meanwhile appreciate if you could share how your workloads are ? any load test ? TPS, payload size etc.

Hi Jay, thank you for your response. The load is low (a few requests per minute). Most of those errors occur when we Create single documents that each are about 1 kB in size when encoded as JSON. The app runs on AWS Lambda and runs Fauna queries synchronously, so there should be no possibility of client-side concurrency issues. The problem appears only sporadically, so I don’t think I have a reliable way of reproducing it.

Could it be related to this ?

1 Like

Sure sounds like it! I’ll change our Lambdas to reinstantiate FaunaClient for every run and report back here. Thanks!

So it seems that instantiating a new FaunaClient for each Lambda invocation fixes it (also probably-related exceptions like UnavailableException, NoSuchElementException, and ClosedChannelException). Thanks,@Jay!

And a note for posterity: If you don’t FaunaClient.close() after you’re done with it, you may end up with IOExceptions or SocketExceptions about too many open files (i.e. sockets).