X Tutup
Skip to content

Commit 7a2ba40

Browse files
committed
core/cgroup: upgrade log level when we fail to rescope a pid
See https://bugzilla.redhat.com/show_bug.cgi?id=1973058 again: systemd[1779]: Started Application launched by gnome-session-binary. systemd[1779]: app-glib-liveinst\x2dsetup-1897.scope: Failed to add PIDs to scope's control group: No such process systemd[1779]: app-glib-liveinst\x2dsetup-1897.scope: Failed with result 'resources'. systemd[1779]: Failed to start Application launched by gnome-session-binary. systemd[1779]: app-glib-xdg\x2duser\x2ddirs-1900.scope: Failed to add PIDs to scope's control group: No such process systemd[1779]: app-glib-xdg\x2duser\x2ddirs-1900.scope: Failed with result 'resources'. systemd[1779]: Failed to start Application launched by gnome-session-binary. systemd[1779]: app-gnome-gsettings\x2ddata\x2dconvert-1902.scope: Failed to add PIDs to scope's control group: No such process systemd[1779]: app-gnome-gsettings\x2ddata\x2dconvert-1902.scope: Failed with result 'resources'. systemd[1779]: Failed to start Application launched by gnome-session-binary. Since we don't show the PID anywhere, it can be quite hard to figure out what is going on. There may be logs from the pid above or below in the log, but we have no PID number to identify them. So let's upgrade the log from unit_attach_pids_to_cgroup() to tell us precisely which PIDs and why couldn't be handled.
1 parent e861662 commit 7a2ba40

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/core/cgroup.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2164,19 +2164,23 @@ int unit_attach_pids_to_cgroup(Unit *u, Set *pids, const char *suffix_path) {
21642164
/* First, attach the PID to the main cgroup hierarchy */
21652165
q = cg_attach(SYSTEMD_CGROUP_CONTROLLER, p, pid);
21662166
if (q < 0) {
2167-
log_unit_debug_errno(u, q, "Couldn't move process " PID_FMT " to requested cgroup '%s': %m", pid, p);
2167+
bool again = MANAGER_IS_USER(u->manager) && ERRNO_IS_PRIVILEGE(q);
21682168

2169-
if (MANAGER_IS_USER(u->manager) && ERRNO_IS_PRIVILEGE(q)) {
2169+
log_unit_full_errno(u, again ? LOG_DEBUG : LOG_INFO, q,
2170+
"Couldn't move process "PID_FMT" to%s requested cgroup '%s': %m",
2171+
pid, again ? " directly" : "", p);
2172+
2173+
if (again) {
21702174
int z;
21712175

2172-
/* If we are in a user instance, and we can't move the process ourselves due to
2173-
* permission problems, let's ask the system instance about it instead. Since it's more
2174-
* privileged it might be able to move the process across the leaves of a subtree who's
2175-
* top node is not owned by us. */
2176+
/* If we are in a user instance, and we can't move the process ourselves due
2177+
* to permission problems, let's ask the system instance about it instead.
2178+
* Since it's more privileged it might be able to move the process across the
2179+
* leaves of a subtree whose top node is not owned by us. */
21762180

21772181
z = unit_attach_pid_to_cgroup_via_bus(u, pid, suffix_path);
21782182
if (z < 0)
2179-
log_unit_debug_errno(u, z, "Couldn't move process " PID_FMT " to requested cgroup '%s' via the system bus either: %m", pid, p);
2183+
log_unit_info_errno(u, z, "Couldn't move process "PID_FMT" to requested cgroup '%s' (directly or via the system bus): %m", pid, p);
21802184
else
21812185
continue; /* When the bus thing worked via the bus we are fully done for this PID. */
21822186
}

0 commit comments

Comments
 (0)
X Tutup