Skip to content

Commit 4dde8c9

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) (cherry picked from commit 9645e94)
1 parent 587f84a commit 4dde8c9

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
@@ -1413,7 +1413,6 @@ static void unit_gc_sweep(Unit *u, unsigned gc_marker) {
14131413

14141414
static unsigned manager_dispatch_gc_unit_queue(Manager *m) {
14151415
unsigned n = 0, gc_marker;
1416-
Unit *u;
14171416

14181417
assert(m);
14191418

@@ -1425,11 +1424,13 @@ static unsigned manager_dispatch_gc_unit_queue(Manager *m) {
14251424

14261425
gc_marker = m->gc_marker;
14271426

1428-
while ((u = LIST_POP(gc_queue, m->gc_unit_queue))) {
1427+
Unit *u;
1428+
while ((u = m->gc_unit_queue)) {
14291429
assert(u->in_gc_queue);
14301430

14311431
unit_gc_sweep(u, gc_marker);
14321432

1433+
LIST_REMOVE(gc_queue, m->gc_unit_queue, u);
14331434
u->in_gc_queue = false;
14341435

14351436
n++;

0 commit comments

Comments
 (0)