TimeoutException: Client response header timeout after 0 milliseconds. - Again
See original GitHub issueThis issue is a continuation of this issue, but using 0.19.0-M3 with BlazeClientBuilder
.
The exception is as follows:
Exception in thread "main" java.util.concurrent.TimeoutException: Client response header timeout after 0 milliseconds.
at org.http4s.client.blaze.ClientTimeoutStage$$anon$1.run(ClientTimeoutStage.scala:45)
at org.http4s.blaze.util.Execution$$anon$3.execute(Execution.scala:66)
at org.http4s.blaze.util.TickWheelExecutor.schedule(TickWheelExecutor.scala:111)
at org.http4s.client.blaze.ClientTimeoutStage.activateResponseHeaderTimeout(ClientTimeoutStage.scala:170)
at org.http4s.client.blaze.ClientTimeoutStage.outboundCommand(ClientTimeoutStage.scala:93)
at org.http4s.blaze.pipeline.Tail.sendOutboundCommand(Stages.scala:131)
at org.http4s.blaze.pipeline.Tail.sendOutboundCommand$(Stages.scala:128)
at org.http4s.client.blaze.Http1Connection.sendOutboundCommand(Http1Connection.scala:25)
at org.http4s.client.blaze.Http1Connection.$anonfun$executeRequest$3(Http1Connection.scala:149)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at monix.eval.internal.TaskRunLoop$.startFull(TaskRunLoop.scala:80)
at monix.eval.internal.TaskRestartCallback.syncOnSuccess(TaskRestartCallback.scala:107)
at monix.eval.internal.TaskRestartCallback.onSuccess(TaskRestartCallback.scala:73)
at monix.eval.Callback$BaseCallback.run(Callback.scala:246)
at monix.execution.internal.Trampoline.monix$execution$internal$Trampoline$$immediateLoop(Trampoline.scala:65)
at monix.execution.internal.Trampoline.startLoop(Trampoline.scala:31)
at monix.execution.schedulers.TrampolineExecutionContext$JVMOptimalTrampoline.startLoop(TrampolineExecutionContext.scala:146)
at monix.execution.internal.Trampoline.execute(Trampoline.scala:38)
at monix.execution.schedulers.TrampolineExecutionContext.execute(TrampolineExecutionContext.scala:65)
at monix.execution.schedulers.BatchingScheduler.execute(BatchingScheduler.scala:50)
at monix.execution.schedulers.BatchingScheduler.execute$(BatchingScheduler.scala:47)
at monix.execution.schedulers.AsyncScheduler.execute(AsyncScheduler.scala:29)
at monix.eval.Callback$BaseCallback.onSuccess(Callback.scala:229)
at monix.eval.Callback.apply(Callback.scala:64)
at monix.eval.Callback.apply(Callback.scala:42)
at org.http4s.syntax.AsyncOps$.$anonfun$fromFuture$2(AsyncSyntax.scala:19)
at org.http4s.syntax.AsyncOps$.$anonfun$fromFuture$2$adapted(AsyncSyntax.scala:17)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
The snippet in question is:
/** */
private def withClient[A](f: Client[Task] => Task[A]) =
BlazeClientBuilder.apply[Task](ExecutionContext.global)
.withMaxTotalConnections(2)
.resource
.use(f)
The client successfully runs about ~30 requests (client.expect[Json](...)
, see here) for ~20 seconds before the exception occurs.
Excuse any missing information or mistakes, I’m still learning.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Java HTTP Client Request with defined timeout - Stack Overflow
http.connection.timeout Integer The timeout until a connection is established. A value of zero means the timeout is not used. – maveroid.
Read more >http4s/http4s - Gitter
The requests actually fail: java.util.concurrent.TimeoutException: Client response header timeout after 9954 milliseconds. at org.http4s.client.blaze.
Read more >Common Timeouts effecting Web Services, HTTP and SOAP ...
The default value is 5 seconds. Increase the value to 30 seconds or greater. Set the value using the administrative console.
Read more >Apache HttpClient Timeout - Baeldung
How to set up timeout for an HttpClient - connection and socket timeouts, and a mechanism for hard timeout of ongoing http connections....
Read more >Java.util.concurrentTimeout Exception : Request timed out to ...
TimeoutException : Request timed out to alphaint/192.168.1.50:443 of 60000 ms. at com.ning.http.client.providers.netty.request.timeout.
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
Fixed by #2166.
Thanks for the quick reply @rossabaker! After doing a little bit more digging, I’m suspecting the hang to be this issue: https://github.com/http4s/http4s/issues/2068. If increasing
maxTotalConnections
to be strictly greater than the number of parallel requests, I’m no longer experiencing any hangs.