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

man: document that sd_notify() is racy in some cases #5239

Merged
merged 3 commits into from Feb 6, 2017

Conversation

poettering
Copy link
Member

Document that sd_notify() is racy in some cases, as a follow-up to opencontainers/runc#1308 (comment)

<varname>WatchdogSec=</varname> (see above). If those options are used but <varname>NotifyAccess=</varname> is
not configured, it will be implicitly set to <option>main</option>.</para>

<para>Note that <function>sd_notify()</function> notifications maybe attributed to units correctly only if
Copy link
Contributor

Choose a reason for hiding this comment

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

should it be 'may be' here?

Copy link
Member Author

Choose a reason for hiding this comment

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

indeed! thanks for the pointer! will force push fix shortly.

@giuseppe
Copy link
Contributor

giuseppe commented Feb 6, 2017

thanks for clarifying this point. LGTM

<option>exec</option>. Conversely, if an auxiliary process of the unit sends an
<function>sd_notify()</function> message and immediately exits, the service manager might not be able to
properly attribute the message to the unit, and thus will ignore it, even if
<varname>NotifyAccess=</varname><option>all</option> is set for it.</para></listitem>
Copy link
Member

@evverx evverx Feb 6, 2017

Choose a reason for hiding this comment

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

Hm, it would be great to update sd_pid_notify_with_fds(3) and systemd-notify(1) too (mainly root/non_root-case). Related to #2737, #2739

Copy link
Member Author

Choose a reason for hiding this comment

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

i force pushed a new version that adds this there, too

Copy link
Member

Choose a reason for hiding this comment

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

Well, I'm not sure the documentation makes it clear why does this service work

[Service]
NotifyAccess=main
ExecStart=/bin/sh -c 'sleep 5; systemd-notify --ready; sleep 1000'
Type=notify

And this service doesn't work

[Service]
NotifyAccess=main
ExecStart=/bin/sh -c 'sleep 5; systemd-notify --ready; sleep 1000'
Type=notify
User=some-non-root

Maybe, this doesn't really matter

@poettering
Copy link
Member Author

I added another commit now that explains the faking of the PID we do in the systemd-notify tool, which is hopefully useful to explain why the systemd-notify service examples @evverx provided behave the way they do.

@evverx evverx merged commit 1fb8579 into systemd:master Feb 6, 2017
@evverx evverx added the notify label Feb 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants