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

ws-manager: Fix consistency of disposed ws between ws-daemon and ws-manager #12028

Merged
merged 1 commit into from
Aug 16, 2022

Conversation

utam0k
Copy link
Contributor

@utam0k utam0k commented Aug 10, 2022

Description

Due to a retry timing issue, there were cases where the workspace had already been successfully backed up on the ws-daemon side, but ws-manager was trying to back it up again with an error.

More detail

Related Issue(s)

Fixes #11710

How to test

Is there any good way to do this?

Release Notes

Fixed a rare case in which prebuild was terminating successfully but failing

Documentation

Werft options:

  • /werft with-preview

@utam0k utam0k requested a review from a team August 10, 2022 08:46
@github-actions github-actions bot added the team: workspace Issue belongs to the Workspace team label Aug 10, 2022
Comment on lines 1105 to 1117
val, ok := m.finalizerMap.LoadAndDelete(workspaceID)
if ok {
cancelReq := val.(context.CancelFunc)
cancelReq()
}
return false, &csapi.GitStatus{}, nil
}
Copy link
Contributor

@jenting jenting Aug 10, 2022

Choose a reason for hiding this comment

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

Can we move these lines upper?

ctx, cancelReq := context.WithTimeout(ctx, time.Duration(m.manager.Config.Timeouts.ContentFinalization))
m.finalizerMap.Store(workspaceID, cancelReq)
defer func() {
// we're done disposing - remove from the finalizerMap
val, ok := m.finalizerMap.LoadAndDelete(workspaceID)
if !ok {
return
}
cancelReq := val.(context.CancelFunc)
cancelReq()
}()

Therefore, we can reuse the defer function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jenting Thanks for your feedback. fixed

@utam0k
Copy link
Contributor Author

utam0k commented Aug 16, 2022

/werft with-preview

👎 unknown command: with-preview
Use /werft help to list the available commands

@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-to-retry-prebuild.3 because the annotations in the pull request description changed
(with .werft/ from main)

@roboquat roboquat merged commit b89a417 into main Aug 16, 2022
@roboquat roboquat deleted the to/retry-prebuild branch August 16, 2022 18:36
@roboquat roboquat added deployed: workspace Workspace team change is running in production deployed Change is completely running in production labels Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: workspace Workspace team change is running in production deployed Change is completely running in production release-note size/M team: workspace Issue belongs to the Workspace team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ws-daemon] Unexpected cannot find workspace during DisposeWorkspace
4 participants