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

HTTP Client does not retry all types of requests #1710

Closed
mefellows opened this issue Aug 30, 2023 · 1 comment
Closed

HTTP Client does not retry all types of requests #1710

mefellows opened this issue Aug 30, 2023 · 1 comment
Labels
bug Indicates an unexpected problem or unintended behavior smartbear-supported SmartBear engineering team will support this issue. See https://docs.pact.io/help/smartbear

Comments

@mefellows
Copy link
Member

When the broker errors with a 5xx status code the HTTP client should attempt, up to a configurable limit, to retry the request.

We currently use the DefaultHttpRequestRetryStrategy here: https://github.com/pact-foundation/pact-jvm/blob/2b2055f0d9e0d10c2bfe51898d7163e037a772d9/core/support/src/main/kotlin/au/com/dius/pact/core/support/HttpClient.kt#L89C49-L89C49, however this strategy ignores potentially non-idempotent requests. So all POST, PUT, DELETE etc. will not be retried.

This includes local verification which takes a body for the "pacts for verification" endpoint.

From the docs on that class: https://hc.apache.org/httpcomponents-client-4.5.x/current/tutorial/html/fundamentals.html#d5e293

By default HttpClient assumes only non-entity enclosing methods such as GET and HEAD to be idempotent and entity enclosing methods such as POST and PUT to be not for compatibility reasons.

The Pact Broker assumes retries because it's designed for CI/CD systems where builds can be re-run multiple times, so it is safe to retry all requests.

Discovered via this slack conversation: https://pact-foundation.slack.com/archives/CLS16AVEE/p1692695354797019.

@mefellows mefellows added bug Indicates an unexpected problem or unintended behavior smartbear-supported SmartBear engineering team will support this issue. See https://docs.pact.io/help/smartbear labels Aug 30, 2023
@github-actions
Copy link

👋 Hi! The 'smartbear-supported' label has just been added to this issue, which will create an internal tracking ticket in PactFlow's Jira (PACT-1286). We will use this to prioritise and assign a team member to this task. All activity will be public on this ticket. For now, sit tight and we'll update this ticket once we have more information on the next steps.

See our documentation for more information.

monochromata added a commit to monochromata/pact-jvm that referenced this issue Sep 4, 2023
monochromata added a commit to monochromata/pact-jvm that referenced this issue Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior smartbear-supported SmartBear engineering team will support this issue. See https://docs.pact.io/help/smartbear
Projects
Status: Closed
Development

No branches or pull requests

2 participants