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

Implement background process manager #5826

Open
stgraber opened this issue Jun 6, 2019 · 6 comments

Comments

@stgraber
Copy link
Member

commented Jun 6, 2019

LXD currently spawns a number of background processes and then attempts to track them as they run. This isn't done very consistently and is the source of quite a bit of code duplication.

Instead we should add a new package that provides functions to both spawn a background process and keep track of it as well as import existing background processes and keep track of those too.

The process struct should then let us stop, start, restart, reload, signal, wait for the process.
When spawning a process, we will need to provide a way to specify the environment and process ownership information so we can properly respawn the process should it die.

The process monitoring logic should auto-respawn processes up to a limit within a reasonable time period and when available should make use of pidfds as a race free way of keeping track of those processes.

Initial users should be:

  • forkdns
  • dnsmasq
  • forkproxy
@stgraber stgraber added the Feature label Jun 6, 2019
@stgraber stgraber added this to the soon milestone Jun 6, 2019
@stgraber stgraber self-assigned this Jun 6, 2019
@stgraber stgraber removed their assignment Sep 9, 2019
@stgraber stgraber modified the milestones: soon, later Sep 9, 2019
@ribsthakkar

This comment has been minimized.

Copy link

commented Sep 17, 2019

Hi @stgraber, my team with @abbykrish, @anusha-paul, and myself will work on this issue

@stgraber

This comment has been minimized.

Copy link
Member Author

commented Sep 18, 2019

@ribsthakkar assigned it to you for now, I'll need to have the other two comment so Github lets me assign it to them too.

@stgraber

This comment has been minimized.

Copy link
Member Author

commented Sep 23, 2019

For this issue, we'd like a completely standalone Go package that we could then transition some of our code over. So rather than directly modifying LXD from the start, this should start as a new Go package under our shared/ directory, defining the struct and functions to achieve the goals outlined in this issue.

Once we think it covers all we need to spawn/stop/restart/track background processes on Linux, we can add some unit tests for it, clean the package up to be of the same standard as our newer standalone packages and then have separate commits or even a separate branch making use of it to drive dnsmasq and forkdns as two of the easier users of this.

Down the line, we'll want to make this use pidfs but that's I believe out of scope for the current chunk of work and something that @brauner and myself should think about later on.

@stgraber

This comment has been minimized.

Copy link
Member Author

commented Sep 23, 2019

For this one, good contacts would be @brauner, @tomponline and myself

@ribsthakkar

This comment has been minimized.

Copy link

commented Sep 23, 2019

Thank you for the updated information. We'll let you know about updates when we get to working on them!

@abbykrish

This comment has been minimized.

Copy link

commented Sep 27, 2019

Hi @stgraber, I'm Abby, could you assign me to the issue? Thanks ahead!

@stgraber stgraber modified the milestones: later, soon Oct 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.