Skip to content

Commit 70c10ee

Browse files
LucaGuerrapoiana
authored andcommitted
fix(engine): sync outputs before printing stats at shutdown
Signed-off-by: Luca Guerra <[email protected]>
1 parent d3a67c1 commit 70c10ee

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

userspace/falco/app/actions/process_events.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,12 @@ falco::app::run_result falco::app::actions::process_events(falco::app::state& s)
585585
}
586586
}
587587

588+
// By deleting s.outputs, we make sure that the engine will wait until
589+
// regular output has been completely sent before printing stats, avoiding
590+
// intermixed stats with output.
591+
// Note that this will only work if this is the last reference held by the
592+
// shared pointer.
593+
s.outputs.reset();
588594
s.engine->print_stats();
589595

590596
return res;

0 commit comments

Comments
 (0)