Skip to content

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

Open
commodo wants to merge 1 commit into
openwrt:masterfrom
commodo:fluent-bit-5.0.8
Open

fluent-bit: update to 5.0.8, adopt maintainer, fix musl startup segfault#29914
commodo wants to merge 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
-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.

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.

Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
@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.

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

3 participants