core/unit: fix resource usage message when the unit stops#33145
core/unit: fix resource usage message when the unit stops#33145michaelolbrich wants to merge 1 commit intosystemd:mainfrom
Conversation
The log message with the used CPU time, memory, etc. is currently not shown because the cgroup data is destroy before the message is created. Call unit_log_resources() before unit_prune_cgroup() to fix this.
|
Important An -rc1 tag has been created and a release is being prepared, so please note that PRs introducing new features and APIs will be held back until the new version has been released. |
YHNdnzj
left a comment
There was a problem hiding this comment.
No. unit_log_resources uses values cached by unit_prune_cgroup, so the current order is correct. Also, we really should log about them after the cgroup has been destroyed, making sure that the peak values are accurate. Hence I'm not convinced.
If you have a specific problem, please describe it so that we can come up with a proper fix.
|
See #33149. |
|
The CGroupRuntime struct managing the cgroup contains the cached values. So if logging first is not acceptable, and the cgroup must be removed first, then either the struct must stay around after the cgroup is removed or the cached values need to go elsewhere. |
|
The cached values aren't only for logging. Previously we also show them after the cgroup/unit terminates. Hence this is indeed something we should fix, but the approach is not feasible. |
Fixes systemd#33149 Replaces systemd#33145 (cherry picked from commit 4918f14)
The log message with the used CPU time, memory, etc. is currently not shown because the cgroup data is destroy before the message is created.
Call unit_log_resources() before unit_prune_cgroup() to fix this.