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

Forward more messages on the sd-notify socket #469

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

alexlarsson
Copy link
Contributor

@alexlarsson alexlarsson commented Dec 11, 2023

Several of the standard sd-notify messages are safe to use from a container and are very useful. This commit cleans up the general handling of notify messages and allows forwarding of:

  • READY=1
  • RELOADING=1
  • STOPPING=1
  • WATCHDOG=1
  • WATCHDOG=trigger
  • STATUS=...
  • ERRNO=...
  • BUSERROR=...
  • MONOTONIC_USEC...

See https://www.freedesktop.org/software/systemd/man/latest/sd_notify.html#Well-known%20assignments for documentation of these.

Note: We don't allow unknown messages to be forewarded. For one, all the file-descriptor based ones are currently unsupported (since the forwarding doesn't handle fds), but also some options (current and future) may be security sensitive.

fixes #461
fixes #311

@rhatdan
Copy link
Member

rhatdan commented Dec 11, 2023

LGTM
@giuseppe @haircommander PTAL

@vrothberg
Copy link
Member

Please make sure to run this change against Podman's system tests test/system. I think things should work fine but who knows.

@eriksjolund
Copy link

This PR also fixes #311

Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

LGTM

@alexlarsson
Copy link
Contributor Author

So, I ran the podman test/system, and we're failing on this:

 ✗ [075] podman exec - cat from stdin
   (from function `bail-now' in file test/system/helpers.bash, line 227,
    from function `is' in file test/system/helpers.bash, line 956,
    in test file test/system/075-exec.bats, line 84)
     `is "${lines[0]}" "3000+0 records in"  "dd: number of records in"' failed
   
   [11:10:24.237041104] $ /vcs/other/podman/bin/podman rm -t 0 --all --force --ignore
   
   [11:10:24.272179180] $ /vcs/other/podman/bin/podman ps --all --external --format {{.ID}} {{.Names}}
   
   [11:10:24.307984108] $ /vcs/other/podman/bin/podman images --all --format {{.Repository}}:{{.Tag}} {{.ID}}
   [11:10:24.339679735] quay.io/libpod/systemd-image:20230531 9984d4cfd1eb
   quay.io/libpod/testimage:20221018 f5a99120db64
   
   [11:10:24.357682655] $ /vcs/other/podman/bin/podman run -d quay.io/libpod/testimage:20221018 top
   [11:10:24.499542609] 76f963b708fe74814e8e078bbc41af84368beafaad2da932dc4ee7c3d6629409
   
   [11:10:24.512104004] $ /vcs/other/podman/bin/podman exec -i 76f963b708fe74814e8e078bbc41af84368beafaad2da932dc4ee7c3d6629409 cat
   [11:10:24.648299147] of9AOlHs62yCSNsgYav5
   1500+0 records in
   1500+0 records out
   1536000 bytes (1,5 MB, 1,5 MiB) copied, 0,00696935 s, 220 MB/s
   
   [11:10:24.670650275] $ /vcs/other/podman/bin/podman exec -i 76f963b708fe74814e8e078bbc41af84368beafaad2da932dc4ee7c3d6629409 dd of=/tmp/bigfile bs=512
   [11:10:24.768570699] 2999+1 records in
   2999+1 records out
   #/vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
   #|     FAIL: dd: number of records in
   #| expected: '3000+0 records in'
   #|   actual: '2999+1 records in'
   #\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   # [teardown]
   
   [11:10:24.785169774] $ /vcs/other/podman/bin/podman pod rm -t 0 --all --force --ignore
   
   [11:10:24.810581406] $ /vcs/other/podman/bin/podman rm -t 0 --all --force --ignore
   [11:10:24.919517158] 76f963b708fe74814e8e078bbc41af84368beafaad2da932dc4ee7c3d6629409
   
   [11:10:24.921240846] $ /vcs/other/podman/bin/podman network prune --force
   
   [11:10:24.947890495] $ /vcs/other/podman/bin/podman volume rm -a -f

However, this also fails on conmon master, and I bisected it to commit 3605a36

@alexlarsson
Copy link
Contributor Author

Pushed a nop-change rebase to see if the cio test works now, as that seems unrelated.

@alexlarsson
Copy link
Contributor Author

I created #470 for the podman test issue.

@eriksjolund
Copy link

If you modify the end of the PR description from

This fixes https://github.com/containers/conmon/issues/461 

to something like this

fixes https://github.com/containers/conmon/issues/461
fixes https://github.com/containers/conmon/issues/311

there will be web links to both issues. (I think changing the git commit message does not have any effect on the web links)

Several of the standard sd-notify messages are safe to use from a
container and are very useful. This commit cleans up the general
handling of notify messages and allows forwarding of:

 * READY=1
 * RELOADING=1
 * STOPPING=1
 * WATCHDOG=1
 * WATCHDOG=trigger
 * STATUS=...
 * ERRNO=...
 * BUSERROR=...
 * MONOTONIC_USEC...

See https://www.freedesktop.org/software/systemd/man/latest/sd_notify.html#Well-known%20assignments
for documentation of these.

Note: We don't allow unknown messages to be forewarded. For one, all
the file-descriptor based ones are currently unsupported (since the
forwarding doesn't handle fds), but also some options (current and
future) may be security sensitive.

fixes containers#461
fixes containers#311

Signed-off-by: Alexander Larsson <[email protected]>
@giuseppe giuseppe merged commit a3df678 into containers:main Dec 12, 2023
16 checks passed
@giuseppe
Copy link
Member

@haircommander could you please cut a new release?

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.

Why do we limit the messages that can be sent to the conmon socket. Support STATUS sd_notify
5 participants