Repository navigation
session-helper: Lock runtime directory to prevent tmpfiles cleanup - #6754
Conversation
smcv
left a comment
There was a problem hiding this comment.
This looks fine as an easy, backportable bug-fix.
In the long term it would perhaps be better if the flatpak-session-helper held a fd to this directory open, and took a BSD flock(2) lock on it. That would mean that cleanup would be prevented if and only if the flatpak-session-helper is, in fact, still running. (But that would make little practical difference, because the flatpak-session-helper normally continues to run until the user logs out anyway.)
|
Do we know that this is actually the root cause of #6341? One of the reporters of that issue is on Debian 13, which I also use, and I couldn't find a reason why it would be doing age-based cleanup of (Not an objection to either this change or my |
7304ceb to
a78befa
Compare
|
I completely missed the file locking approach. That is indeed cleaner because it ties it to the lifetime of the helper process, so I implemented that instead. The code is still very minimal and should be backportable.
Hard to know, but I don't see our code removing the files and this is definitely an issue we should fix either way. I guess we'll see if people continue to complain. |
By default it doesn't (seem to), and we have no actual evidence that this is what's happening, so I'd prefer to say something less confident in the commit message, perhaps "systemd-tmpfiles might be configured to clean /run/user periodically, which could remove the session helper's p11-kit socket". |
997f9c7 to
fb8bd49
Compare
systemd-tmpfiles can be configured to periodically cleans /run/user, which can remove the session helper's p11-kit socket. Once removed, all subsequent Flatpak launches fail with "Can't find source path" until the session helper restarts. Take a shared flock on the .flatpak-helper directory for the lifetime of the process. systemd-tmpfiles --clean skips directories that are locked. Helps: flatpak#6341
fb8bd49 to
e0bde5c
Compare
|
No matter if this is the root cause for everyone or no one there, this seems like the right thing to do anyway. The commit is now just saying |
Yeah, agreed.
Thanks, that seems completely appropriate. |
|
As a note, this accidentally closed #6341 even though the |
systemd-tmpfiles periodically cleans /run/user, which can remove the
session helper's p11-kit socket. Once removed, all subsequent Flatpak
launches fail with "Can't find source path" until the session helper
restarts.
Take a shared flock on the .flatpak-helper directory for the lifetime
of the process. systemd-tmpfiles --clean skips directories that are
locked.
Closes: #6341