Skip to content

Commit 056aaae

Browse files
YHNdnzjbluca
authored andcommitted
core/manager: do not pop gc_unit_queue before unit_gc_sweep()
Follow-up for 52e3671 unit_gc_sweep() might try to add the unit to gc queue again. While that becomes no-op as Unit.in_gc_queue is not cleared yet, it induces minor inconsistency of states. (cherry picked from commit 741a184)
1 parent 4a64eeb commit 056aaae

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/core/manager.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,7 +1474,6 @@ static void unit_gc_sweep(Unit *u, unsigned gc_marker) {
14741474

14751475
static unsigned manager_dispatch_gc_unit_queue(Manager *m) {
14761476
unsigned n = 0, gc_marker;
1477-
Unit *u;
14781477

14791478
assert(m);
14801479

@@ -1486,11 +1485,13 @@ static unsigned manager_dispatch_gc_unit_queue(Manager *m) {
14861485

14871486
gc_marker = m->gc_marker;
14881487

1489-
while ((u = LIST_POP(gc_queue, m->gc_unit_queue))) {
1488+
Unit *u;
1489+
while ((u = m->gc_unit_queue)) {
14901490
assert(u->in_gc_queue);
14911491

14921492
unit_gc_sweep(u, gc_marker);
14931493

1494+
LIST_REMOVE(gc_queue, m->gc_unit_queue, u);
14941495
u->in_gc_queue = false;
14951496

14961497
n++;

0 commit comments

Comments
 (0)