Skip to content

fix(cnpgi,connection): improve retry algorithm#8554

Merged
mnencia merged 1 commit intocloudnative-pg:mainfrom
leonardoce:get-connection-retry
Sep 10, 2025
Merged

fix(cnpgi,connection): improve retry algorithm#8554
mnencia merged 1 commit intocloudnative-pg:mainfrom
leonardoce:get-connection-retry

Conversation

@leonardoce
Copy link
Contributor

@leonardoce leonardoce commented Sep 9, 2025

On each execution of the plugin reconciliation loop, the plugin’s connection pool is closed and recreated with the newly detected settings.

If a connection request occurs while the pool is being recreated, the request may fail with a "closed pool" error.

This patch improves the reconciliation logic to properly detect pool changes and enhances the retry mechanism by introducing an exponential backoff strategy.

Fixes: #8553

On each execution of the plugin reconciliation loop, the plugin’s connection
pool is closed and recreated with the newly detected settings.

If a connection request occurs while the pool is being recreated, the request
may fail with a "closed pool" error.

This patch improves the reconciliation logic to properly detect pool changes
and enhances the retry mechanism by introducing an exponential backoff strategy.

Fixes: cloudnative-pg#8553

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
@leonardoce leonardoce requested a review from a team as a code owner September 9, 2025 11:19
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Sep 9, 2025
@cnpg-bot cnpg-bot added backport-requested ◀️ This pull request should be backported to all supported releases release-1.25 release-1.26 release-1.27 labels Sep 9, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2025

❗ By default, the pull request is configured to backport to all release branches.

  • To stop backporting this pr, remove the label: backport-requested ◀️ or add the label 'do not backport'
  • To stop backporting this pr to a certain release branch, remove the specific branch label: release-x.y

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 9, 2025
@armru armru changed the title fix: get plugin connection retry algorithm fix(cnpgi,connection): get plugin connection retry algorithm Sep 9, 2025
@armru armru changed the title fix(cnpgi,connection): get plugin connection retry algorithm fix(cnpgi,connection): improve retry algorithm Sep 9, 2025
@mnencia
Copy link
Member

mnencia commented Sep 9, 2025

/test

@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2025

@mnencia, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/17587060344

@cnpg-bot cnpg-bot added the ok to merge 👌 This PR can be merged label Sep 9, 2025
@jakubhajek
Copy link

We are testing that change in our dev environment. We haven't found any errors related to the closed pool in the last 12 hours. I'll keep you updated later to confirm that this behavior has been fixed by that change.

I would like to express my sincere gratitude for your prompt and efficient contribution, @leonardoce. Your assistance in resolving the issue is greatly appreciated.

@mnencia
Copy link
Member

mnencia commented Sep 10, 2025

Thanks @jakubhajek, for the confirmation. I'm going to merge this PR.

@mnencia mnencia merged commit efc4192 into cloudnative-pg:main Sep 10, 2025
37 of 50 checks passed
cnpg-bot pushed a commit that referenced this pull request Sep 10, 2025
On each execution of the plugin reconciliation loop, the plugin’s
connection pool is closed and recreated with the newly detected
settings.

If a connection request occurs while the pool is being recreated, the
request may fail with a "closed pool" error.

This patch improves the reconciliation logic to properly detect pool
changes and enhances the retry mechanism by introducing an exponential
backoff strategy.

Fixes: #8553

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
(cherry picked from commit efc4192)
cnpg-bot pushed a commit that referenced this pull request Sep 10, 2025
On each execution of the plugin reconciliation loop, the plugin’s
connection pool is closed and recreated with the newly detected
settings.

If a connection request occurs while the pool is being recreated, the
request may fail with a "closed pool" error.

This patch improves the reconciliation logic to properly detect pool
changes and enhances the retry mechanism by introducing an exponential
backoff strategy.

Fixes: #8553

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
(cherry picked from commit efc4192)
cnpg-bot pushed a commit that referenced this pull request Sep 10, 2025
On each execution of the plugin reconciliation loop, the plugin’s
connection pool is closed and recreated with the newly detected
settings.

If a connection request occurs while the pool is being recreated, the
request may fail with a "closed pool" error.

This patch improves the reconciliation logic to properly detect pool
changes and enhances the retry mechanism by introducing an exponential
backoff strategy.

Fixes: #8553

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
(cherry picked from commit efc4192)
rossigee pushed a commit to rossigee/cloudnative-pg that referenced this pull request Oct 2, 2025
On each execution of the plugin reconciliation loop, the plugin’s
connection pool is closed and recreated with the newly detected
settings.

If a connection request occurs while the pool is being recreated, the
request may fail with a "closed pool" error.

This patch improves the reconciliation logic to properly detect pool
changes and enhances the retry mechanism by introducing an exponential
backoff strategy.

Fixes: cloudnative-pg#8553

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
THE-BRAHMA pushed a commit to THE-BRAHMA/cloudnative-pg that referenced this pull request Oct 30, 2025
On each execution of the plugin reconciliation loop, the plugin’s
connection pool is closed and recreated with the newly detected
settings.

If a connection request occurs while the pool is being recreated, the
request may fail with a "closed pool" error.

This patch improves the reconciliation logic to properly detect pool
changes and enhances the retry mechanism by introducing an exponential
backoff strategy.

Fixes: cloudnative-pg#8553

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
Signed-off-by: theBrahma <office.utpal.brahma@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-requested ◀️ This pull request should be backported to all supported releases lgtm This PR has been approved by a maintainer ok to merge 👌 This PR can be merged release-1.25 release-1.26 release-1.27 size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Plugin service "closed pool" error during cluster reconcillation

6 participants