Skip to content

Commit 19ffe2b

Browse files
yuwatabluca
authored andcommitted
machine: GC machine when no leader PID is set
After d8854ff, if a serialized leader PID of a machine is already dead when deserialized, then the leader PID and PIDFD are unset for the machine, and subsequent machine_start() -> machine_watch_pidfd() will trigger an assertion. This makes a Machine object without leader PID GCed. Fixes a bug introduced by the combination of d8854ff (v255) and 1762c2c (v257). Fixes #35602. (cherry picked from commit 51a0a3b) (cherry picked from commit 962bdd1) (cherry picked from commit 0df46d1)
1 parent 79b3378 commit 19ffe2b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/machine/machine.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,9 @@ bool machine_may_gc(Machine *m, bool drop_not_started) {
540540
if (m->class == MACHINE_HOST)
541541
return false;
542542

543+
if (!pidref_is_set(&m->leader))
544+
return true;
545+
543546
if (drop_not_started && !m->started)
544547
return true;
545548

0 commit comments

Comments
 (0)