Skip to content

Commit ef497ca

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 9645e946f9e323965116d89fce8009cc86418c9d) (cherry picked from commit 4dde8c94854754c1cb43d5d0adb5cb8085853c40)
1 parent 3d68612 commit ef497ca

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

13651365
static unsigned manager_dispatch_gc_unit_queue(Manager *m) {
13661366
unsigned n = 0, gc_marker;
1367-
Unit *u;
13681367

13691368
assert(m);
13701369

@@ -1376,11 +1375,13 @@ static unsigned manager_dispatch_gc_unit_queue(Manager *m) {
13761375

13771376
gc_marker = m->gc_marker;
13781377

1379-
while ((u = LIST_POP(gc_queue, m->gc_unit_queue))) {
1378+
Unit *u;
1379+
while ((u = m->gc_unit_queue)) {
13801380
assert(u->in_gc_queue);
13811381

13821382
unit_gc_sweep(u, gc_marker);
13831383

1384+
LIST_REMOVE(gc_queue, m->gc_unit_queue, u);
13841385
u->in_gc_queue = false;
13851386

13861387
n++;

0 commit comments

Comments
 (0)