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

fixed locker not released after workspace removal warning #24085

Merged
merged 1 commit into from Feb 12, 2020
Merged

fixed locker not released after workspace removal warning #24085

merged 1 commit into from Feb 12, 2020

Conversation

likexian
Copy link
Contributor

See: #24019

The locker is not released after workspace removal warning.

@likexian likexian changed the title fixed locker not released after workspace removal warning #24019 fixed locker not released after workspace removal warning Feb 12, 2020
@pselle pselle requested a review from a team February 12, 2020 12:22
@mildwonkey
Copy link
Contributor

Have you considered using a defer() function to take care of this? Several other commands have something this:
defer stateLocker.Unlock(nil)

I don't think it makes a difference in today, but the benefit is that we won't need to add Unlocks before every return which (I think) will help in the future.

@likexian
Copy link
Contributor Author

Have you considered using a defer() function to take care of this? Several other commands have something this:
defer stateLocker.Unlock(nil)

I don't think it makes a difference in today, but the benefit is that we won't need to add Unlocks before every return which (I think) will help in the future.

My answer is NO.

defer is not suitable for this function, because we have to release the lock before calling delete workspace, see: https://github.com/hashicorp/terraform/blob/master/command/workspace_delete.go#L133

If we add defer stateLocker.Unlock(nil), it works when getting warning, but will do unlock twice when no warning.

@mildwonkey
Copy link
Contributor

Thanks for that @likexian!

@ghost
Copy link

ghost commented Apr 1, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@hashicorp hashicorp locked and limited conversation to collaborators Apr 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants