-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Conversation
Signed-off-by: Takahiro Yamashita <[email protected]>
} | ||
|
||
if (exit_signal) { | ||
flb_signal_exit(exit_signal); | ||
} | ||
ret = config->exit_status_code; | ||
ret = ctx->config->exit_status_code; |
There was a problem hiding this comment.
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==
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. 😍 I confirmed that this PR fixes the most of the SEGV cases with more severe conditions which is using with Golang plugin that is built on top of our Golang infrastructure: https://github.com/calyptia/plugin
Thanks for plugging SEGV case! 👍
Signed-off-by: Takahiro Yamashita <[email protected]>
Signed-off-by: Takahiro Yamashita <[email protected]>
This patch is to modify signal handler for hot reloading.
Multiple SIGHUP can cause SIGSEGV like following log.
This patch is to prevent it.
Note: SIG31-C. Do not access shared objects in signal handlers
https://wiki.sei.cmu.edu/confluence/x/VdYxBQ
Enter
[N/A]
in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-test
label to test for all targets (requires maintainer to do).Documentation
Backporting
Configuration
Debug/Valgrind log
Valgrind reported an error that is not related this PR.
The error is also occurred on current master
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.