snapd icon indicating copy to clipboard operation
snapd copied to clipboard

cgroup: add Snap/Cgroup monitoring capabilities

Open sergio-costas opened this issue 3 years ago • 7 comments

This MR adds a Snap/Cgroup monitor that allows other parts of the code to wait until all the instances of a Snap have ended and it can be safely refreshed. It is the first step for a bigger MR that will allow to automagically refresh a snap after the system has notified the user that there is a refresh available and that they must close it.

This MR and a future one overrides https://github.com/snapcore/snapd/pull/12155 . The changes from that MR will be proposed in a step-by-step manner to simplify the revision process.

Thanks for helping us make a better snapd! Have you signed the license agreement and read the contribution guide?

sergio-costas avatar Oct 05 '22 09:10 sergio-costas

@Meulengracht Done. About those two, I didn't miss them... I don't know why did they still appear to you. (maybe I fix them but forgot to do a push...?)

sergio-costas avatar Oct 07 '22 10:10 sergio-costas

@mardy All done.

sergio-costas avatar Oct 07 '22 10:10 sergio-costas

@Meulengracht Done. About those two, I didn't miss them... I don't know why did they still appear to you. (maybe I fix them but forgot to do a push...?)

They still appear here in this PR because they are not changed here, if they appear different to you, you may have messed up your branch locally. Take a look at your branch online, it appears just as here (https://github.com/sergio-costas/snapd/blob/DT-576-snapd-refresh-awareness-ux-implementation_add-file-monitoring-support/sandbox/cgroup/monitor.go#L84)

Meulengracht avatar Oct 07 '22 11:10 Meulengracht

@Meulengracht This is what I see in your link, which is the same that I see in my local code...

imagen

You asked me to remove an "if newApp.npaths < 0" that was unneeded, and it isn't there... Or was there another change to do that I missed?

sergio-costas avatar Oct 07 '22 11:10 sergio-costas

@Meulengracht This is what I see in your link, which is the same that I see in my local code...

imagen

You asked me to remove an "if newApp.npaths < 0" that was unneeded, and it isn't there... Or was there another change to do that I missed?

Ah, I think we are talking past each other :-) I was talking about adding a return inside the if statement and then removing the else, since it isn't needed.

Meulengracht avatar Oct 07 '22 11:10 Meulengracht

@mardy @pedronis @mvo5 @Meulengracht I wrote an alternative patch for the monitor itself, where I fully remove the singleton. It reuses the changes in cgroup/scanning.go, which were the most reviewed by you, and completely rewrite and simplify the cgroup/monitor.go file.

https://github.com/snapcore/snapd/pull/12280

Which one do you prefer?

sergio-costas avatar Oct 18 '22 14:10 sergio-costas

I marked this one as Draft because https://github.com/snapcore/snapd/pull/12280 is a better implementation.

sergio-costas avatar Oct 31 '22 11:10 sergio-costas

Closing this too because all the work is being done in https://github.com/snapcore/snapd/pull/12280

sergio-costas avatar Nov 25 '22 18:11 sergio-costas