chore(patches): revert "[backport -> release/3.2.x] fix(balancer): respect max retries (#12346)" #12498
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reverts #12372
This PR introduces a minor behavioral change: when Nginx retrieves a connection from the keepalive pool and finds it broken during its use, it will add retry until it has exhausted all the connections in the keepalive pool and attempts to establish a new connection with the upstream server in the next retry round. From Nginx's perspective, retrying on a broken connection is not considered a real retry. This is also the default behavior of Kong.
This PR modifies this behavior by treating the retry on a broken connection as a valid retry and, at most, retrieving 5 (default) connections from the keepalive pool. If all of them are broken, the system will stop retrying, even if there are still connections available in the keepalive pool. It will also not attempt to establish a new connection with the upstream server. Although this is a very rare case, to maintain consistency in behavior, we believe it is necessary to be more cautious.
Therefore, we intend to adopt a difficult but correct fix: addressing the issue regarding statistics.