-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Bug Report
Describe the bug
While I'm running fluent-bit with the -d option, the fluent-bit daemon doesn't stop by the SIGTERM.
Without the -d option (in case Fluent-bit runs in the foreground), it stops normally.
I see this issue in FreeBSD 14.3 Release.
To Reproduce
- Steps to reproduce the problem:
Build & run Fluent-bit in FreeBSD 14.3-R.
Expected behavior
The fluent-bit daemon stops by the SIGTERM.
Screenshots
none.
Your Environment
- Version used: Latest code in the fluent-bit repository
- Configuration: any
- Environment name and version (e.g. Kubernetes? What version?): bare metal
- Server type and version:
- Operating System and version: FreeBSD 14.3 Release
- Filters and plugins: any
Additional context
The kqueue(2) on BSD platforms is not inherited by a child process, unlike Linux epoll(2). The kqueue is wrapped by the event_loop member in the flb_ctx_t. This is created at the flb_create() before daemonize. And then, the main thread calls the flb_start() and waits for the started signal via the event_loop. But it fails to wait because kqueue isn't available after forking. The main thread doesn't read pipes in the following loop; it will never know the TERM signal arrives.