Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fluent-bit: modify hot reload handler #8041

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/fluent-bit.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,6 @@ static void flb_signal_handler_status_line(struct flb_cf *cf_opts)
char s[] = "[engine] caught signal (";
time_t now;
struct tm *cur;
flb_ctx_t *ctx = flb_context_get();

now = time(NULL);
cur = localtime(&now);
Expand Down Expand Up @@ -609,9 +608,6 @@ static void flb_signal_handler(int signal)
#ifndef FLB_HAVE_STATIC_CONF
if (flb_bin_restarting == FLB_RELOAD_IDLE) {
flb_bin_restarting = FLB_RELOAD_IN_PROGRESS;
/* reload by using same config files/path */
flb_reload(ctx, cf_opts);
flb_bin_restarting = FLB_RELOAD_IDLE;
}
else {
flb_utils_error(FLB_ERR_RELOADING_IN_PROGRESS);
Expand Down Expand Up @@ -1396,12 +1392,18 @@ int flb_main(int argc, char **argv)
#ifdef FLB_SYSTEM_WINDOWS
flb_console_handler_set_ctx(ctx, cf_opts);
#endif
if (flb_bin_restarting == FLB_RELOAD_IN_PROGRESS) {
/* reload by using same config files/path */
flb_reload(ctx, cf_opts);
ctx = flb_context_get();
flb_bin_restarting = FLB_RELOAD_IDLE;
}
}

if (exit_signal) {
flb_signal_exit(exit_signal);
}
ret = config->exit_status_code;
ret = ctx->config->exit_status_code;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to prevent touching old config and following warning.

^C[2023/10/14 10:28:56] [engine] caught signal (SIGINT)
==33368== Invalid read of size 4
==33368==    at 0x1C84B2: flb_main (fluent-bit.c:1404)
==33368==    by 0x1C859B: main (fluent-bit.c:1437)
==33368==  Address 0x541f6d8 is 808 bytes inside a block of size 18,592 free'd
==33368==    at 0x484B27F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==33368==    by 0x22418D: flb_free (flb_mem.h:127)
==33368==    by 0x22C28B: flb_config_exit (flb_config.c:545)
==33368==    by 0x1DDB0A: flb_destroy (flb_lib.c:242)
==33368==    by 0x28ECFB: flb_reload (flb_reload.c:504)
==33368==    by 0x1C6E86: flb_signal_handler (fluent-bit.c:613)
==33368==    by 0x4FA151F: ??? (in /usr/lib/x86_64-linux-gnu/libc.so.6)
==33368==    by 0x50447F7: clock_nanosleep@@GLIBC_2.17 (clock_nanosleep.c:78)
==33368==    by 0x5049676: nanosleep (nanosleep.c:25)
==33368==    by 0x50495AD: sleep (sleep.c:55)
==33368==    by 0x1C846A: flb_main (fluent-bit.c:1380)
==33368==    by 0x1C859B: main (fluent-bit.c:1437)
==33368==  Block was alloc'd at
==33368==    at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==33368==    by 0x224173: flb_calloc (flb_mem.h:95)
==33368==    by 0x22B647: flb_config_init (flb_config.c:201)
==33368==    by 0x1DD88C: flb_create (flb_lib.c:162)
==33368==    by 0x1C784D: flb_main (fluent-bit.c:1050)
==33368==    by 0x1C859B: main (fluent-bit.c:1437)
==33368== 


cf_opts = flb_cf_context_get();

Expand Down
Loading