Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http4s Blaze Client wait queue full failure #630

Open
kmr4u opened this issue May 18, 2022 · 3 comments
Open

Http4s Blaze Client wait queue full failure #630

kmr4u opened this issue May 18, 2022 · 3 comments

Comments

@kmr4u
Copy link

kmr4u commented May 18, 2022

We have a use case where for a single incoming request, a microservice has to make many(in the order of 1000s) outgoing HTTP calls to other microservice to fetch GET some details. Our service is built using Scala, Http4s and Cats-Effect and is using http4s-blaze-client library for making outbound HTTP calls.

Currently in production we are seeing the failure org.http4s.client.WaitQueueFullFailure: Wait queue is full and org.http4s.client.PoolManager: Max wait queue limit of 1024 reached, not scheduling. Once the service goes into this state, its never recovering from it and we are completely blocked.

Below is the Blaze Client configuration we are using:

BlazeClientBuilder[F](global)
  .withMaxWaitQueueLimit(1024)
  .withRequestTimeout(20.seconds)
  .resource
  .map { client =>
      ResponseLogger(logHeaders = false, logBody = true)(
      RequestLogger(logHeaders = true, logBody = true, redactHeadersWhen = Middleware.SensitiveHeaders)(client)
    )
  }

Initially we were using the default setting of 256 for max wait queue limit but then decided to increase to 512 and then to 1024. Currently even the 1024 is not working.

I am not sure if this happens when the outbound HTTP request is slow or times out. There is a possibility that the API response is slow sometimes(but that will still return within 20seconds timeout that we set). But I do not have sufficient evidence to claim that it is the case here.

We are currently using the version http4s-blaze-client_2.13:0.21.0-M6.

I am not sure if increasing the wait queue size further would help. Is it possible to implement custom logic within the service to check the wait queue size and wait before submitting the request to the client? Please advise how to get around with this issue. Any help would be really appreciated.

@danicheg
Copy link
Member

I'll say a super obvious and a little annoying thing, but did you try to bump the blaze-client version (at least to 0.21.33 if changing the major version isn't an option)?

@kmr4u
Copy link
Author

kmr4u commented May 19, 2022

Haven't tried upgrading the blaze-client version. Currently we are using http4s@0.21.0-M6 and scala@2.13.1. Do you know if I have to worry about the compatability of Scala version if I upgrade http4s to latest stable version?

@danicheg
Copy link
Member

I can't be sure on 100%, but I bet that forward compatibility is working ok for the 2.13 series. Though I'd give one more unsolicited piece of advice - it's better to bump the Scala version to the latest 2.13 too. It shouldn't be as hard as bumping it from 2.12.

@rossabaker rossabaker transferred this issue from http4s/http4s May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants