]> git.99rst.org Git - openwrt-packages.git/commitdiff
fluent-bit: fix HTTP output SIGSEGV on too-small coroutine stack
authorAlexandru Ardelean <redacted>
Fri, 31 Jul 2026 09:38:33 +0000 (12:38 +0300)
committerAlexandru Ardelean <redacted>
Sat, 1 Aug 2026 18:19:47 +0000 (21:19 +0300)
Each output flush runs in a coroutine whose stack was forced to 4096 (one
page). The HTTP output plugin overflows it and crashes with SIGSEGV after
the flush (issue #30113). Pin FLB_CORO_STACK_SIZE to upstream's own 64K
floor (FLB_CORO_STACK_SIZE_MIN_BYTE), which the musl-shrunk default undercuts.

Also add a regression test: drive the dummy input into the http output and
assert fluent-bit survives a few flush cycles instead of dying from a signal
(no listener needed -- the overflow happens while composing the request).

Fixes: https://github.com/openwrt/packages/issues/30113
Signed-off-by: Alexandru Ardelean <redacted>
admin/fluent-bit/Makefile
admin/fluent-bit/test.sh [new file with mode: 0755]

index 05b1b0937c0fd19cca4dd7b27acc53bb53eaeb5e..96a7d8e24efc9917448c982dc0f478ab9c3e8233 100644 (file)
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=fluent-bit
 PKG_VERSION:=5.0.8
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/fluent/fluent-bit.git
@@ -47,7 +47,7 @@ CMAKE_OPTIONS+= \
        -DFLB_BACKTRACE=No \
        -DFLB_WASM=No \
        -DFLB_LUAJIT=No \
-       -DFLB_CORO_STACK_SIZE=4096 \
+       -DFLB_CORO_STACK_SIZE=65536 \
        -DWITH_SASL=No \
        -DWITH_ZLIB=No \
        -DWITH_ZSTD=No \
diff --git a/admin/fluent-bit/test.sh b/admin/fluent-bit/test.sh
new file mode 100755 (executable)
index 0000000..b493c7d
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/sh
+# Regression test for issue #30113: with too small a coroutine stack the HTTP
+# output plugin overflows and dies (SIGSEGV/abort) on its first flush. Drive the
+# dummy input into the http output and make sure fluent-bit survives a few flush
+# cycles. No server is needed -- the crash happens while composing/sending the
+# request, so a refused local port is enough to exercise it.
+
+case "$1" in
+fluent-bit) ;;
+*) exit 0 ;;
+esac
+
+BIN=/usr/sbin/fluent-bit
+[ -x "$BIN" ] || { echo "FAIL: $BIN not installed"; exit 1; }
+
+cfg=/tmp/fluent-bit-http.conf
+cat > "$cfg" <<'EOF'
+[SERVICE]
+    flush     1
+    daemon    off
+    log_level error
+[INPUT]
+    name      dummy
+    dummy     {"message":"regress-30113"}
+    rate      100
+[OUTPUT]
+    name      http
+    match     *
+    host      127.0.0.1
+    port      5170
+    format    json
+EOF
+
+# A healthy run keeps retrying the refused endpoint until timeout stops it
+# (rc 124); a coroutine-stack overflow dies from a signal (rc >= 128) within
+# the first flush cycle.
+timeout 6 "$BIN" -c "$cfg" >/tmp/fluent-bit-http.out 2>&1
+rc=$?
+
+if [ "$rc" -ge 128 ]; then
+       echo "FAIL: fluent-bit http output died from a signal (rc=$rc) -- coro stack too small"
+       grep -iE 'signal|SIGSEGV' /tmp/fluent-bit-http.out | head -1
+       exit 1
+fi
+
+echo "fluent-bit: http output survived flush cycles (rc=$rc)"
git clone https://git.99rst.org/PROJECT