Skip to content

activation: keep going on PID mismatch#156

Merged
lucab merged 2 commits intomasterfrom
ups/activation-pid-mismatch
Apr 7, 2025
Merged

activation: keep going on PID mismatch#156
lucab merged 2 commits intomasterfrom
ups/activation-pid-mismatch

Conversation

@lucab
Copy link
Owner

@lucab lucab commented Apr 4, 2025

This tweaks the file descriptor logic in order to avoid spurious errors when there is a $LISTEN_PID mismatch, or when the variables are unset.

Closes #155

This tweaks the file descriptor logic in order to avoid spurioous errors when there is a `$LISTEN_PID` mismatch, or when the variables are unset.
.context("failed to parse LISTEN_PID")?;
let current_pid = process::id();
if pid != current_pid {
log::warn!(
Copy link

Choose a reason for hiding this comment

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

I think encountering this is not really broken, so warn seems too high severity to me. I'd use some lower severity with a message along the lines of "systemd activation environment is set but not meant for this process".

Basically, I'd treat it as pretty normal case but logging it still has value in case someone is debugging systemd itself.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yes, this is mostly meant for debugging.
I've lowered the log level and reworded the message a bit.
Thanks for the feedback.

.context("failed to parse LISTEN_PID")?;
let current_pid = process::id();
if pid != current_pid {
log::warn!(
Copy link

Choose a reason for hiding this comment

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

Same as above.

@lucab lucab merged commit 03ee3cc into master Apr 7, 2025
10 checks passed
@Kixunil
Copy link

Kixunil commented Apr 7, 2025

Looks good, thanks for the fix!

@lucab lucab deleted the ups/activation-pid-mismatch branch April 7, 2025 08:48
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.

In socket activation, the error returned when the PIDs don't match needs to be distinguishable

2 participants