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

Log the error from umount when it fails in the background #8561

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

vanja-p
Copy link
Contributor

@vanja-p vanja-p commented Mar 5, 2025

Previously, we logged Unmounted %s in the background, even after the context was canceled, even if the f.server.Unmount() call failed.

Also, there was a logging only race, where the context wouldn't be expired in the child goroutine, so it wouldn't log anything, and then it would be expired in the parent goroutine, which would indicate that we might unmount in the background.

@vanja-p vanja-p requested a review from maggie-lou March 5, 2025 21:34
Copy link
Contributor

@maggie-lou maggie-lou left a comment

Choose a reason for hiding this comment

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

I found this logic a bit challenging to follow 😅 (After thinking about it, I see that we will only hit the default case if the context is done and we never read from the channel below, but it took a sec) Is there a way to make this more readable or could you add some comments?

@vanja-p
Copy link
Contributor Author

vanja-p commented Mar 6, 2025

I left a comment since I found any other way to write this code very clunky and repetitive.

@vanja-p vanja-p enabled auto-merge (squash) March 6, 2025 22:09
@vanja-p vanja-p requested a review from maggie-lou March 7, 2025 03:37
Comment on lines 136 to 142
// Since resultCh is unbuffered, this only happens when the outer
// function received from the channel and will return this err.
if err != nil {
log.CtxErrorf(ctx, "Failed to unmount %s: %s", f.mountPath, err)
} else {
log.CtxDebugf(ctx, "Unmounted %s", f.mountPath)
}
Copy link
Member

Choose a reason for hiding this comment

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

In this case, shouldn't the caller function be responsible for logging the error (i.e. this case should be empty right?) I think this means we're handling the error in two places

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I guess what I missed is that firecracker.unmountAllVBDs skips logging on the first attempt. I'm not sure if this is helpful. If it fails because of a cancelled context, than maybe it makes sense to ignore logging, but if it fails because unmount failed, it seems useful to know what error was returned.

@vanja-p vanja-p requested a review from bduffany March 10, 2025 15:17
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