Skip to content

Commit bf74f1d

Browse files
cosmo0920edsiper
authored andcommitted
bin: Handle CONT signal properly under leaks command
On macOS, we need to handle COND signal properly. This is because under controling leaks command, it also sends COND signal after releasing its managing process(es). To mitigate this, we need to use flag to mark for distinguish dump to be requested. And we need to run it inside main loop. Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
1 parent 2e7f2e8 commit bf74f1d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/fluent-bit.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ flb_ctx_t *ctx;
7474
struct flb_config *config;
7575
volatile sig_atomic_t exit_signal = 0;
7676
volatile sig_atomic_t flb_bin_restarting = FLB_RELOAD_IDLE;
77+
volatile sig_atomic_t dump_requested = 0;
7778

7879
#ifdef FLB_HAVE_LIBBACKTRACE
7980
struct flb_stacktrace flb_st;
@@ -636,7 +637,7 @@ static void flb_signal_handler(int signal)
636637
abort();
637638
#ifndef FLB_SYSTEM_WINDOWS
638639
case SIGCONT:
639-
flb_dump(ctx->config);
640+
dump_requested = 1;
640641
break;
641642
#ifndef FLB_HAVE_STATIC_CONF
642643
case SIGHUP:
@@ -1491,6 +1492,11 @@ static int flb_main_run(int argc, char **argv)
14911492
#ifdef FLB_SYSTEM_WINDOWS
14921493
flb_console_handler_set_ctx(ctx, cf_opts);
14931494
#endif
1495+
if (dump_requested) {
1496+
dump_requested = 0;
1497+
flb_dump(ctx->config);
1498+
}
1499+
14941500
if (flb_bin_restarting == FLB_RELOAD_IN_PROGRESS) {
14951501
if (supervisor_reload_notified == FLB_FALSE &&
14961502
ctx != NULL && ctx->config != NULL) {

0 commit comments

Comments
 (0)