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

fix: make lease functions less chatty #4100

Merged
merged 2 commits into from
Dec 12, 2024
Merged

fix: make lease functions less chatty #4100

merged 2 commits into from
Dec 12, 2024

Conversation

kzys
Copy link
Member

@kzys kzys commented Dec 3, 2024

Without this change, the console would be filled with "failed to release lease: lease not found" even if flyctl couldn't acquire one lease.

Updating existing machines in '...' with bluegreen strategy
WARN failed to acquire lease: failed to get lease on VM e7843075ad2408: request returned non-2xx status: 408:

WARN failed to release lease for machine 178122df9672d8: lease not found

WARN failed to release lease: lease not found

WARN failed to release lease for machine 7811772a5d7698: lease not found

WARN failed to release lease: lease not found

WARN failed to release lease for machine e286076f933508: lease not found

WARN failed to release lease: lease not found
...

Change Summary

What and Why:

How:

Related to:


Documentation

  • Fresh Produce
  • In superfly/docs, or asked for help from docs team
  • n/a

@kzys kzys marked this pull request as ready for review December 3, 2024 00:41
@@ -536,13 +537,7 @@ func (lm *leasableMachine) ReleaseLease(ctx context.Context) error {
defer cancel()
}

err := lm.flapsClient.ReleaseLease(ctx, lm.machine.ID, nonce)
contextTimedOutOrCanceled := errors.Is(err, context.DeadlineExceeded) || errors.Is(err, context.Canceled)
if err != nil && (!contextWasAlreadyCanceled || !contextTimedOutOrCanceled) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it make any difference for contextWasAlreadyCanceled and !contextTimedOutOrCanceled ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! There are places where we call ReleaseLease and not logging any errors from that. Let me adjust them.

@kzys
Copy link
Member Author

kzys commented Dec 3, 2024

Adding releaseLease() function to log the error from LeasableMachine#ReleaseLease(). I don't fully restore the if condition around context cancellation this time. I'll adding that back if that causes some issues.

kzys added 2 commits December 9, 2024 09:51
Without this change, the console would be filled with
"failed to release lease: lease not found" even if flyctl couldn't acquire
one lease.

```
Updating existing machines in '...' with bluegreen strategy
WARN failed to acquire lease: failed to get lease on VM e7843075ad2408: request returned non-2xx status: 408:

WARN failed to release lease for machine 178122df9672d8: lease not found

WARN failed to release lease: lease not found

WARN failed to release lease for machine 7811772a5d7698: lease not found

WARN failed to release lease: lease not found

WARN failed to release lease for machine e286076f933508: lease not found

WARN failed to release lease: lease not found
...
```
@kzys kzys merged commit 057290b into master Dec 12, 2024
30 checks passed
@kzys kzys deleted the fix-leases branch December 12, 2024 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants