Skip to content

Fluent-bit doesn't stop while running in background mode on BSD platforms #11170

@yuichiro-naito

Description

@yuichiro-naito

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions