Skip to content

race condition causing pending-upgrade status #13637

@gzb1128

Description

@gzb1128

I run into a situation that a Helm release stuck in pending-upgrade status.

Scene:
I use helm upgrade and send SIGTERM signal, then release stuck in pending-upgrade.

Suspicious path:
helm upgrade start upgrade in function releasingUpgrade, also call a handleContext function.
In handleContext, when context is done, it call reportToPerformUpgrade, follow the code we can see failRelease call, failRelease, recordRelease, storage update. Lets specify a driver such as Secret which my environment is using, update, newSecretsObject. We can see the newSecret is not filled with ResourceVersion, so race condition may happen.
Lets look into releasingUpgrade function. In execHook we see the recordRelease function is also called.
So there is a situation, when the execHook is recording hook status, it creates a pending-upgrade secret, ready to update. At this point, user send SIGTERM, context is cancelled. So failRelease is called, secret is created with status failed, update succeeded. And hook secret is just about to submit, finally turning release status to pending-upgrade. This cause a race condition.

Advice:
I think a mutex should be introduced to hold release status. But right now I dont have a answer to it, I need some input from helm team. If this is confirmed to be a bug, I'd like to fix it by myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions