Retry logic broken in RetryDeciderTrait for $httpRetryMessages #1813
Labels
api: core
priority: p1
Important issue which blocks shipping the next release. Will be fixed prior to next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Environment details
Description
The default retry logic of
RetryDeciderTrait
is broken. The code assumes that the exception message contains a valid json string that can be examined for areason
key.This assumption is incorrect, because the underlying Guzzle client will provide a "pretty" exception message that is also truncated (see guzzle/guzzle#2185 ). The actual content of the response can be retrieved via
$ex->getResponse()->getBody()->getContents();
.This issue mainly effects the
RequestWrapper
as it theRetryDeciderTrait
is used here to retrieve the default retry function.Steps to reproduce
The following unit test reproduces the problem. Please note that I deliberatly use the Guzzle Mock Handler in order to get an actual RequestException from Guzzle, triggered by a 4xx/5xx status code:
Proposed solution
The
RetryDeciderTrait
should check if the Exception is an instance of a Guzzle RequestException and use the reponse body in that case to check for the error:instead of
I would provide a correponsing pull request if this gets accepted.
PS: I guess #1273 is actually already resolved?
The text was updated successfully, but these errors were encountered: