question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Retry` behaviour

See original GitHub issue

I tried to use very wrong retry policy:

val always: (Request[IO], Either[Throwable, Response[IO]]) => Boolean = (_, _) => true
Retry[IO](RetryPolicy(RetryPolicy.exponentialBackoff(maxWait = 1.second, maxRetry = 5), always))(client)

As expected, on each successful POST call, http4s retried it, but strangely enough with extra body attached.

My call code is like:

      httpClient.expect[ExpectedResponse](
        Request[IO](
          method = Method.POST,
          uri = uri / "resource",
          headers = headers,
        ).withEntity(payload.asJson),
      )

Assuming, that payload is {"one": 1, "other": "value"}, in logs I after 5th retry I got:

[2021-10-26T07:15:12.460Z] [error]     [DEBUG] 07:15:01 [TestKit.scala:58] HTTP/1.1 POST https://uri/resource Headers(Authorization: <REDACTED>, Content-Length: 446, Content-Type: application/json, Accept: application/json) body="{"one": 1, "other": "value"}{"one": 1, "other": "value"}{"one": 1, "other": "value"}{"one": 1, "other": "value"}{"one": 1, "other": "value"}{"one": 1, "other": "value"}

Payload was attached 6 times, once in original request and 5 more times with each retry (first retry contained doubled body, next one - tripled, etc)

Is that expected behaviour?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
armanbilgecommented, Nov 23, 2021

Please do! AFAIK no one is working on this 😃

1reaction
ashwinbhaskarcommented, Nov 23, 2021

can I give this a shot if no one has picked this up?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error handling and automatic retries in AWS Lambda
When you invoke a function, two types of error can occur. Invocation errors occur when the invocation request is rejected before your function...
Read more >
Web - SDK Retry Behaviour - Bluedot documentation
Web – SDK Retry Behaviour. A key target environment is mobile browsers, which can have intermittent network connections due to poor coverage ...
Read more >
How AWS Lambda Retry really works - Serverless Framework
Using Step Functions, the developer can decide the transition between states and retry behaviour (number of retries and delay duration).
Read more >
Retry - Spring
Retry. To make processing more robust and less prone to failure, it sometimes helps to automatically retry a failed operation in case it ......
Read more >
Retry | Kuma
The policy let you configure retry behaviour for HTTP , GRPC and TCP protocols. Example. Kubernetes; Universal. apiVersion ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found