Skip to content

fluent-bit: update to 5.0.8, adopt maintainer, fix musl startup segfault#29914

Merged
commodo merged 1 commit into
openwrt:masterfrom
commodo:fluent-bit-5.0.8
Jul 9, 2026
Merged

fluent-bit: update to 5.0.8, adopt maintainer, fix musl startup segfault#29914
commodo merged 1 commit into
openwrt:masterfrom
commodo:fluent-bit-5.0.8

Conversation

@commodo

@commodo commodo commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

📦 Package Details

Maintainer: me

Description:

Update 4.2.0 -> 5.0.8 and adopt maintainership. fluent-bit segfaulted at
startup on every musl target: 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). Force -DFLB_HAVE_C_TLS:BOOL=On for __thread TLS.

Fixes #29777


🧪 Run Testing Details

  • OpenWrt Version:
  • OpenWrt Target/Subtarget:
  • OpenWrt Device:

✅ Formalities

  • I have reviewed the CONTRIBUTING.md file for detailed contributing guidelines.

@commodo commodo force-pushed the fluent-bit-5.0.8 branch from 4bca94a to 51c5475 Compare July 4, 2026 19:13
@BKPepe

BKPepe commented Jul 5, 2026

Copy link
Copy Markdown
Member

So... it fixes #29777 this one, right?

@commodo

commodo commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

So... it fixes #29777 this one, right?

yes;
marking now

@BKPepe

BKPepe commented Jul 5, 2026

Copy link
Copy Markdown
Member

Can we do something about this one?

fluent-bit: [warn] Binary /usr/sbin/fluent-bit contains a hardcoded build path

@pprindeville pprindeville left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comment thread admin/fluent-bit/Makefile Outdated
-DWITH_ZLIB=No \
-DWITH_ZSTD=No
-DWITH_ZSTD=No \
-DFLB_HAVE_C_TLS:BOOL=On

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this what's causing the segfault or is it -DFLB_CORO_STACK_SIZE=4096?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

short answer: yes;

the crash is in pthread_getspecific() https://github.com/fluent/fluent-bit/blob/v5.0.8/include/fluent-bit/flb_thread_storage.h#L32-L69

when FLB_HAVE_C_TLS is undefined, then #define FLB_TLS_GET(key) pthread_getspecific(key)

the implementation differs from glibc to musl

glibc:
https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/pthread_getspecific.c;hb=HEAD

musl:
https://git.musl-libc.org/cgit/musl/tree/src/thread/pthread_getspecific.c

basically, for musl, we need to enforce thread-local-storage, otherwise pthread_getspecific() crashes, because it calls pthread_key_create() before pthread_getspecific().

glibc's pthread_getspecific() doesn't crash

this may be fixable also upstream in fluent-bit;
i'll report it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@commodo

commodo commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Can we do something about this one?

fluent-bit: [warn] Binary /usr/sbin/fluent-bit contains a hardcoded build path

We can patch it.
But I will also see about upstreaming this first.

@openwrt-ai openwrt-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed 1 new commit; commit message matches the diff. Version bump to 5.0.8 (upstream tag confirmed) with PKG_RELEASE correctly reset to 1, maintainer adoption, and a well-documented musl TLS fix. One minor style nit inline.


Generated by Claude Code

Comment thread admin/fluent-bit/Makefile Outdated
-DWITH_ZLIB=No \
-DWITH_ZSTD=No
-DWITH_ZSTD=No \
-DFLB_HAVE_C_TLS:BOOL=On

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: every other option in this CMAKE_OPTIONS block uses the bare =Yes/=No form (e.g. -DFLB_RELEASE=Yes, -DWITH_ZSTD=No). This one adds a :BOOL=On type annotation, which is functionally equivalent but stylistically inconsistent with the rest of the file.

Suggested change
-DFLB_HAVE_C_TLS:BOOL=On
-DFLB_HAVE_C_TLS=Yes

Generated by Claude Code

Update 4.2.0 -> 5.0.8 and adopt maintainership. fluent-bit segfaulted at
startup on every musl target: 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). Force -DFLB_HAVE_C_TLS=Yes for __thread TLS.

Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
@commodo

commodo commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author
y /usr/sbin/fluent-bit contains a hardcoded build path

fluent/fluent-bit#12077

@commodo commodo merged commit 7b5d7e3 into openwrt:master Jul 9, 2026
14 checks passed
@commodo commodo deleted the fluent-bit-5.0.8 branch July 9, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fluent-bit: tests are segfaulting

4 participants