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

lxd/device/proxy: Remove unix socket from host upon proxy device removal #15081

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kadinsayani
Copy link
Contributor

@kadinsayani kadinsayani commented Feb 27, 2025

Fixes #14972.
Co-authored by @simondeziel.

@kadinsayani kadinsayani force-pushed the proxy-device-fixes branch 4 times, most recently from 2cd415d to 9f56637 Compare February 27, 2025 18:07
@kadinsayani kadinsayani marked this pull request as ready for review February 27, 2025 19:14
@kadinsayani kadinsayani marked this pull request as draft February 27, 2025 19:21
@kadinsayani kadinsayani force-pushed the proxy-device-fixes branch 3 times, most recently from 1ed8a89 to e98a073 Compare February 28, 2025 19:14
@kadinsayani kadinsayani changed the title lxd/device/proxy: Remove host unix socket upon unix proxy device removal lxd/device/proxy: Remove unix socket from host upon proxy device removal Feb 28, 2025
…device

Fixes canonical#14972.

Rather than just kill the proxy process by sending `SIGKILL`, we should
also perform any necessary cleanup (removing the created unix socket)
since `forkproxy` only performs cleanup steps upon receiving `SIGTERM`.

Signed-off-by: Kadin Sayani <[email protected]>
…l upon unix proxy device removal

Signed-off-by: Kadin Sayani <[email protected]>
return fmt.Errorf("Could not read pid file: %s", err)
}

err = p.Stop()
Copy link
Member

Choose a reason for hiding this comment

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

This p.Stop() is where the forkproxy is being sent the KILL signal. Based on our discussions, since the socket was opened with O_CLOEXEC, it shouldn't not be killed but instead TERM'ed to get a chance to do the cleanup?

@tomponline using KILL here seems to mimic what's done in the other fork* helpers but maybe this one warrants a different approach? Or it doesn't and it's OK to do the cleanup "manually" rather than relying on O_CLOEXEC.

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.

Removing proxy device doesn't remove unix socket
2 participants