Error during inactivity of SSL connections
See original GitHub issueI have encountered error when after making a call to some SSL endpoint using Blaze Client, and then having some inactivity period (5-7minutes) client starts to log error javax.net.ssl.SSLException: SSL Handshake WRAP produced 0 bytes: Status = OK HandshakeStatus = NEED_WRAP bytesConsumed = 0 bytesProduced = 0
.
To reproduce this, take http4s quickstart
example ($ sbt -sbt-version 1.2.8 new http4s/http4s.g8 -b 0.20
) and add SSL certifiacte to blaze server. Call https://localhost:8080/joke
. Observe logs:
javax.net.ssl.SSLException: SSL Handshake WRAP produced 0 bytes: Status = OK HandshakeStatus = NEED_WRAP
bytesConsumed = 0 bytesProduced = 0
at org.http4s.blaze.pipeline.stages.SSLStage.sslHandshakeLoop$1(SSLStage.scala:206)
at org.http4s.blaze.pipeline.stages.SSLStage.sslHandshake(SSLStage.scala:229)
at org.http4s.blaze.pipeline.stages.SSLStage.$anonfun$sslHandshake$2(SSLStage.scala:209)
at org.http4s.blaze.pipeline.stages.SSLStage.$anonfun$sslHandshake$2$adapted(SSLStage.scala:208)
at scala.concurrent.impl.CallbackRunnable.run$$$capture(Promise.scala:64)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala)
at org.http4s.blaze.util.SerialExecutionContext$$anon$1.act(SerialExecutionContext.scala:19)
at org.http4s.blaze.util.SerialExecutionContext$$anon$1.act(SerialExecutionContext.scala:18)
at org.http4s.blaze.util.Actor$RecycleableRunnable.go$1(Actor.scala:57)
at org.http4s.blaze.util.Actor$RecycleableRunnable.run(Actor.scala:72)
at org.http4s.blaze.util.Execution$$anon$3.execute(Execution.scala:67)
at org.http4s.blaze.util.Actor.$bang(Actor.scala:45)
at org.http4s.blaze.util.SerialExecutionContext.execute(SerialExecutionContext.scala:25)
at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:72)
at scala.concurrent.impl.Promise$DefaultPromise.$anonfun$tryComplete$1(Promise.scala:288)
at scala.concurrent.impl.Promise$DefaultPromise.$anonfun$tryComplete$1$adapted(Promise.scala:288)
at scala.concurrent.impl.Promise$DefaultPromise.tryComplete(Promise.scala:288)
at scala.concurrent.Promise.complete(Promise.scala:53)
at scala.concurrent.Promise.complete$(Promise.scala:52)
at scala.concurrent.impl.Promise$DefaultPromise.complete(Promise.scala:187)
at scala.concurrent.Promise.success(Promise.scala:86)
at scala.concurrent.Promise.success$(Promise.scala:86)
at scala.concurrent.impl.Promise$DefaultPromise.success(Promise.scala:187)
at org.http4s.blaze.channel.nio2.ByteBufferHead$$anon$1.completed(ByteBufferHead.scala:53)
at org.http4s.blaze.channel.nio2.ByteBufferHead$$anon$1.completed(ByteBufferHead.scala:43)
at java.base/sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:127)
at java.base/sun.nio.ch.Invoker$2.run(Invoker.java:219)
at java.base/sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)```
You can also check https://github.com/retriku/quickstart-http4s-ssl for runnable code:
- sbt run
- https://localhost:8080/joke
Possibly duplicate of https://github.com/http4s/http4s/issues/2192
Setup
JVM: openjdk version "11.0.2" 2019-01-15
Scala: 2.12.8
Http4s: 0.20.6
Blaze: 0.14.6
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top Results From Across the Web
http4s/blaze - Error during inactivity of SSL connections #647
I have encountered error when after making a call to some SSL endpoint using Blaze Client, and then having some inactivity period ...
Read more >What Do SSL Certificate Errors Mean: Causes & How to Fix ...
The inactive certificate error occurs when the browser receives an SSL certificate whose validity period has not yet started.
Read more >ssl-io-inactivity-timeout - IBM
Specifies the number of seconds that an SSL connection waits for a response before timing out. There is no range limitation for this...
Read more >SSL connection error - Microsoft Community
Ever since I upgraded to Windows 10, I have been unable to access the webpages of Google, Yahoo, Youtube, Twitter and Facebook.
Read more >Remote host closed connection. Possible SSL/TLS ...
CAUSE · HTTP requester may be using persistent connections that may be killed after a period of inactivity. · Possible SSL or certificate...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am having this issue as well. JDK 11, Scala 2.13. It happens often on the very first SSL usage within the app lifetime, and only then (so far).
I just got this exception by running http4s/http4s.g8 example locally on JDK11. Switching to Java 8 helps, but this is weird: we have multiple web services based on http4s running in production on JDK11 and we never encounter such behavior. We didn’t ever use JDK8 with http4s and I never saw “Handshake failure with no pending results” in our logs nor high CPU for such applications. For now, I’m clueless what could be the difference.