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

[backport -> release/3.2.x] fix(balancer): respect max retries (#12346) #12372

Merged

Conversation

tzssangglass
Copy link
Member

@tzssangglass tzssangglass commented Jan 19, 2024

Summary

this is a backport form #12346

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

FIX FTI-5616

@tzssangglass tzssangglass force-pushed the backport-12346-to-release/3.2.x branch from 8764e65 to 27ef442 Compare January 19, 2024 06:55
@tzssangglass tzssangglass marked this pull request as ready for review January 19, 2024 07:18
@tzssangglass tzssangglass changed the title fix(balancer): respect max retries (#12346) [backport -> release/3.2.x] fix(balancer): respect max retries (#12346) Jan 19, 2024
@tzssangglass tzssangglass force-pushed the backport-12346-to-release/3.2.x branch from 27ef442 to d6a28d0 Compare January 22, 2024 02:57
In the balancer phase, when obtaining a connection from the upstream
connection pool, the `cached` attribute of the peer connection is set
to 1(`pc->cached = 1;`), indicating that the connection is obtained
from the cache.

If an error occurs during the use of this connection, such as
"upstream prematurely closed connection" the system will increase the
`tries` attribute of the peer connection by executing
`u->peer.tries++`.

`tries` represents the maximum number of attempts to connect to an
upstream server. It is equal to the normal 1 attempt + `retries`
(default value is 5) = 6.
The occurrence of `u->peer.tries++` is unexpected and it results
in the actual retry count exceeding 6 in worst cases.

This PR restores tries by callbacks to the balancer when
`u->peer.tries++` is unexpectedly set.

FIX [FTI-5616](https://konghq.atlassian.net/browse/FTI-5616)

Signed-off-by: tzssangglass <[email protected]>
@tzssangglass tzssangglass force-pushed the backport-12346-to-release/3.2.x branch from d6a28d0 to a558a31 Compare January 22, 2024 03:27
@tzssangglass tzssangglass added the cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee label Jan 22, 2024
@windmgc windmgc merged commit 2c7d1d6 into Kong:release/3.2.x Jan 24, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build/bazel cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants