Skip to content

fluent-bit crashes with musl libc #12065

Description

@commodo

Bug Report

Describe the bug

fluent-bit segfaults at startup musl targets.
Under GCC 14 the upstream C-TLS probe no longer compiles (undeclared __tls_get_addr), so the pthread_key fallback calls pthread_getspecific() before pthread_key_create() and derefs a NULL tsd array on musl (glibc is unaffected).

A workaround for this is to force -DFLB_HAVE_C_TLS:BOOL=On for __thread TLS.

Another fix may be to make sure pthread_key_create() is called before pthread_getspecific()

Related:
openwrt/packages#29914

To Reproduce

  • Compile fluent-bit with musl libc
  • Start it and watch it crash

Expected behavior

No crash.

Screenshots

Your Environment

OpenWrt, which prefers musl libc.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions