-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
core: coldplug possible nop_job #13124
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can reproduce the issue:
$ systemctl list-jobs
JOB UNIT TYPE STATE
1810 foo.service nop waiting
1 jobs listed.
src/core/unit.c
Outdated
@@ -3857,8 +3858,9 @@ int unit_coldplug(Unit *u) { | |||
r = q; | |||
} | |||
|
|||
if (u->job) { | |||
q = job_coldplug(u->job); | |||
uj = (u->job) ? u->job : u->nop_job; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uj = u->job ?: u->nop_job;
Yep, this commits seems to fix the issue. I'll force-push with the trivial style fix and merge. |
ceaca6b
to
321255e
Compare
Almost there:
|
Uhh, okay, the issue above is not related to this PR, cc'ing @yuwata and re-setting the green CI label. |
As mentioned above, the UBSan issue is not relevant to this PR and is being fixed in #13577. |
When a unit in a state INACTIVE or DEACTIVATING, JobType JOB_TRY_RESTART or JOB_TRY_RELOAD will be collapsed to JOB_NOP. And use u->nop_job instead of u->job. If a JOB_NOP job is going on with a waiting state, a parallel daemon-reload just install it during deserialization. Without a coldplug, the job will not be in m->run_queue, which results in a hung try-restart or try-reload process. Reproduce: 1. run systemctl try-restart test.servcie (inactive) repeatly in a terminal. 2. run systemctl daemon-reload repeatly in other terminals. After successful reproduce, systemctl list-jobs will list the hang job. Upsteam: systemd/systemd#13124
When a unit in a state INACTIVE or DEACTIVATING, JobType JOB_TRY_RESTART or JOB_TRY_RELOAD will be collapsed to JOB_NOP. And use u->nop_job instead of u->job. If a JOB_NOP job is going on with a waiting state, a parallel daemon-reload just install it during deserialization. Without a coldplug, the job will not be in m->run_queue, which results in a hung try-restart or try-reload process. Reproduce: run systemctl try-restart test.servcie (inactive) repeatly in a terminal. run systemctl daemon-reload repeatly in other terminals. After successful reproduce, systemctl list-jobs will list the hang job. Upsteam: systemd/systemd#13124
When a unit in a state INACTIVE or DEACTIVATING, JobType JOB_TRY_RESTART or JOB_TRY_RELOAD will be collapsed to JOB_NOP. And use u->nop_job instead of u->job. If a JOB_NOP job is going on with a waiting state, a parallel daemon-reload just install it during deserialization. Without a coldplug, the job will not be in m->run_queue, which results in a hung try-restart or try-reload process. Reproduce: 1. run systemctl try-restart test.servcie (inactive) repeatly in a terminal. 2. run systemctl daemon-reload repeatly in other terminals. After successful reproduce, systemctl list-jobs will list the hang job. Upsteam: systemd/systemd#13124
When a unit in a state INACTIVE or DEACTIVATING, JobType JOB_TRY_RESTART or JOB_TRY_RELOAD will be collapsed to JOB_NOP. And use u->nop_job instead of u->job. If a JOB_NOP job is going on with a waiting state, a parallel daemon-reload just install it during deserialization. Without a coldplug, the job will not be in m->run_queue, which results in a hung try-restart or try-reload process. Reproduce: 1. run systemctl try-restart test.servcie (inactive) repeatly in a terminal. 2. run systemctl daemon-reload repeatly in other terminals. After successful reproduce, systemctl list-jobs will list the hang job. Upsteam: systemd/systemd#13124 Resolves: #1829754
When a unit in a state INACTIVE or DEACTIVATING, JobType JOB_TRY_RESTART or JOB_TRY_RELOAD will be collapsed to JOB_NOP. And use u->nop_job instead of u->job. If a JOB_NOP job is going on with a waiting state, a parallel daemon-reload just install it during deserialization. Without a coldplug, the job will not be in m->run_queue, which results in a hung try-restart or try-reload process. Reproduce: run systemctl try-restart test.servcie (inactive) repeatly in a terminal. run systemctl daemon-reload repeatly in other terminals. After successful reproduce, systemctl list-jobs will list the hang job. Upsteam: systemd/systemd#13124 (cherry picked from commit b49e14d) Resolves: #1829798
When a unit in a state INACTIVE or DEACTIVATING, JobType JOB_TRY_RESTART or JOB_TRY_RELOAD will be collapsed to JOB_NOP. And use u->nop_job instead of u->job. If a JOB_NOP job is going on with a waiting state, a parallel daemon-reload just install it during deserialization. Without a coldplug, the job will not be in m->run_queue, which results in a hung try-restart or try-reload process. Reproduce: 1. run systemctl try-restart test.servcie (inactive) repeatly in a terminal. 2. run systemctl daemon-reload repeatly in other terminals. After successful reproduce, systemctl list-jobs will list the hang job. Upsteam: systemd/systemd#13124 (cherry picked from commit 8ee6529) Resolves: #1847336
When a unit in a state INACTIVE or DEACTIVATING, JobType JOB_TRY_RESTART or JOB_TRY_RELOAD will be collapsed to JOB_NOP. And use u->nop_job instead of u->job. If a JOB_NOP job is going on with a waiting state, a parallel daemon-reload just install it during deserialization. Without a coldplug, the job will not be in m->run_queue, which results in a hung try-restart or try-reload process. Reproduce: 1. run systemctl try-restart test.servcie (inactive) repeatly in a terminal. 2. run systemctl daemon-reload repeatly in other terminals. After successful reproduce, systemctl list-jobs will list the hang job. Upsteam: systemd/systemd#13124 Resolves: #1847335 (cherry picked from commit 8ee6529)
When a unit in a state INACTIVE or DEACTIVATING, JobType JOB_TRY_RESTART or JOB_TRY_RELOAD will be collapsed to JOB_NOP. And use u->nop_job instead of u->job. If a JOB_NOP job is going on with a waiting state, a parallel daemon-reload just install it during deserialization. Without a coldplug, the job will not be in m->run_queue, which results in a hung try-restart or try-reload process. Reproduce: 1. run systemctl try-restart test.servcie (inactive) repeatly in a terminal. 2. run systemctl daemon-reload repeatly in other terminals. After successful reproduce, systemctl list-jobs will list the hang job. Upsteam: systemd/systemd#13124 (cherry picked from commit 8ee6529) Resolves: #1847334
When a unit in a state INACTIVE or DEACTIVATING, JobType JOB_TRY_RESTART or JOB_TRY_RELOAD will be collapsed to JOB_NOP. And use u->nop_job instead of u->job. If a JOB_NOP job is going on with a waiting state, a parallel daemon-reload just install it during deserialization. Without a coldplug, the job will not be in m->run_queue, which results in a hung try-restart or try-reload process. Reproduce: 1. run systemctl try-restart test.servcie (inactive) repeatly in a terminal. 2. run systemctl daemon-reload repeatly in other terminals. After successful reproduce, systemctl list-jobs will list the hang job. Upsteam: systemd/systemd#13124 (cherry picked from commit 8ee6529) Resolves: #1847335
When a unit in a state INACTIVE or DEACTIVATING, JobType JOB_TRY_RESTART or JOB_TRY_RELOAD will be collapsed to JOB_NOP. And use u->nop_job instead of u->job. If a JOB_NOP job is going on with a waiting state, a parallel daemon-reload just install it during deserialization. Without a coldplug, the job will not be in m->run_queue, which results in a hung try-restart or try-reload process. Reproduce: 1. run systemctl try-restart test.servcie (inactive) repeatly in a terminal. 2. run systemctl daemon-reload repeatly in other terminals. After successful reproduce, systemctl list-jobs will list the hang job. Upsteam: systemd/systemd#13124 (cherry picked from commit 8ee6529) Resolves: #1847334
When a unit in a state INACTIVE or DEACTIVATING, JobType JOB_TRY_RESTART or JOB_TRY_RELOAD will be collapsed to JOB_NOP. And use u->nop_job instead of u->job. If a JOB_NOP job is going on with a waiting state, a parallel daemon-reload just install it during deserialization. Without a coldplug, the job will not be in m->run_queue, which results in a hung try-restart or try-reload process. Reproduce: 1. run systemctl try-restart test.servcie (inactive) repeatly in a terminal. 2. run systemctl daemon-reload repeatly in other terminals. After successful reproduce, systemctl list-jobs will list the hang job. Upsteam: systemd/systemd#13124 (cherry picked from commit 8ee6529) Resolves: #1847335
When a unit in a state INACTIVE or DEACTIVATING, JobType JOB_TRY_RESTART or JOB_TRY_RELOAD will be collapsed to JOB_NOP. And use u->nop_job instead of u->job. If a JOB_NOP job is going on with a waiting state, a parallel daemon-reload just install it during deserialization. Without a coldplug, the job will not be in m->run_queue, which results in a hung try-restart or try-reload process. Reproduce: 1. run systemctl try-restart test.servcie (inactive) repeatly in a terminal. 2. run systemctl daemon-reload repeatly in other terminals. After successful reproduce, systemctl list-jobs will list the hang job. Upsteam: systemd/systemd#13124 (cherry picked from commit 8ee6529) Resolves: #1847336
Fix #7180 Update systemd to v247 in order to pick the fix for "core: coldplug possible nop_job" systemd/systemd#13124 Install systemd, systemd-sysv from buster-backports. Pass "systemd.unified_cgroup_hierarchy=0" as kernel argument to force systemd to not use unified cgroup hierarchy, otherwise dockerd won't start moby/moby#16238. Also, chown $FILSYSTEM_ROOT for root, otherwise apt systemd installation complains, see similar https://unix.stackexchange.com/questions/593529/can-not-configure-systemd-inside-a-chrooted-environment Signed-off-by: Stepan Blyschak <[email protected]>
Fix #7180 Update systemd to v247 in order to pick the fix for "core: coldplug possible nop_job" systemd/systemd#13124 Install systemd, systemd-sysv from buster-backports. Pass "systemd.unified_cgroup_hierarchy=0" as kernel argument to force systemd to not use unified cgroup hierarchy, otherwise dockerd won't start moby/moby#16238. Also, chown $FILSYSTEM_ROOT for root, otherwise apt systemd installation complains, see similar https://unix.stackexchange.com/questions/593529/can-not-configure-systemd-inside-a-chrooted-environment Signed-off-by: Stepan Blyschak <[email protected]>
…#7228) Fix sonic-net#7180 Update systemd to v247 in order to pick the fix for "core: coldplug possible nop_job" systemd/systemd#13124 Install systemd, systemd-sysv from buster-backports. Pass "systemd.unified_cgroup_hierarchy=0" as kernel argument to force systemd to not use unified cgroup hierarchy, otherwise dockerd won't start moby/moby#16238. Also, chown $FILSYSTEM_ROOT for root, otherwise apt systemd installation complains, see similar https://unix.stackexchange.com/questions/593529/can-not-configure-systemd-inside-a-chrooted-environment Signed-off-by: Stepan Blyschak <[email protected]>
…#7228) Fix sonic-net#7180 Update systemd to v247 in order to pick the fix for "core: coldplug possible nop_job" systemd/systemd#13124 Install systemd, systemd-sysv from buster-backports. Pass "systemd.unified_cgroup_hierarchy=0" as kernel argument to force systemd to not use unified cgroup hierarchy, otherwise dockerd won't start moby/moby#16238. Also, chown $FILSYSTEM_ROOT for root, otherwise apt systemd installation complains, see similar https://unix.stackexchange.com/questions/593529/can-not-configure-systemd-inside-a-chrooted-environment Signed-off-by: Stepan Blyschak <[email protected]>
When a unit in a state INACTIVE or DEACTIVATING, JobType JOB_TRY_RESTART or JOB_TRY_RELOAD will be collapsed to JOB_NOP. And use u->nop_job instead of u->job. If a JOB_NOP job is going on with a waiting state, a parallel daemon-reload just install it during deserialization. Without a coldplug, the job will not be in m->run_queue, which results in a hung try-restart or try-reload process. Reproduce: run systemctl try-restart test.servcie (inactive) repeatly in a terminal. run systemctl daemon-reload repeatly in other terminals. After successful reproduce, systemctl list-jobs will list the hang job. Upsteam: systemd/systemd#13124 (cherry picked from commit b49e14d5f3081dfcd363d8199a14c0924ae9152f) Resolves: #1829798
Recently, I ran into a problem similar to issue#2419. I noticed that invoking
try-restart
to an inactive service may hang when adaemon-reload
is invoked before thetry-restart
returned.To reproduce the problem, one could create a terminal running
and manually invoke
daemon-reload
in another terminal. In fresh installed Ubuntu 16.04 (v229) and Ubuntu 18.04 (v237), I could observe that the first terminal stops printing new timestamp (which implies that the process hangs intry-restart
) in less than 10 daemon-reload trials.When the problem occurred, one could see that a job with
TYPE == nop
andSTATE == waiting
stuck in the job list, but it could never be resolved.The problem may result from the fact that an nop job is not coldplugged after
daemon-reload
, and thus never enters the run_queue hereafter, unless another nop installed into this job.This coldplugs nop_job for any units
u
withu->job == NULL
butu->nop_job != NULL
.