Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • aports aports
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 749
    • Issues 749
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 324
    • Merge requests 324
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • alpine
  • aportsaports
  • Issues
  • #13466
Closed
Open
Created Jan 24, 2022 by s-kibayashi@s-kibayashi

testing/fluent-bit: segfaults on 3.15 with multiple file outputs configuration

I tried fluent-bit on 3.15 armhf-build.

In case multiple file outputs configuration, segfaults were occured. (Please refer to the following configuration example and gdb dump)

When I checked 'CMakeCache.txt' after package building with original APKBUILD, '-Os -fomit-frame-pointer' was applied as GCC option. (It may be CMake's default value.)

As a test, I changed GCC option to '-O2 -fomit-frame-pointer' and tried fluent-bit rebuild, the problem of segfaults was sloved. (Please refer to the following APKBUILD modification example)

GCC's binary size optimization may be doing something wrong.

Please check this issue at the next release.

configuration example (/etc/fluent-bit/fluent-bit.conf):

[INPUT]
    name cpu
    tag  cpu.local

    # Read interval (sec) Default: 1
    interval_sec 1
[OUTPUT]
    name file
    match *
    path /tmp
    file sample0.log
[OUTPUT]
    name file
    match *
    path /tmp
    file sample1.log
[OUTPUT]
    name file
    match *
    path /tmp
    file sample2.log

gdb dump (3.15 armhf-build fluent-bit original package):

(gdb) run -v -c /etc/fluent-bit/fluent-bit.conf
Starting program: /usr/bin/fluent-bit -v -c /etc/fluent-bit/fluent-bit.conf
Fluent Bit v1.8.9
* Copyright (C) 2019-2021 The Fluent Bit Authors
* Copyright (C) 2015-2018 Treasure Data
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

[2022/01/20 11:45:58] [ info] Configuration:
[2022/01/20 11:45:58] [ info]  flush time     | 5.000000 seconds
[2022/01/20 11:45:58] [ info]  grace          | 5 seconds
[2022/01/20 11:45:58] [ info]  daemon         | 0
[2022/01/20 11:45:58] [ info] ___________
[2022/01/20 11:45:58] [ info]  inputs:
[2022/01/20 11:45:58] [ info]      cpu
[2022/01/20 11:45:58] [ info] ___________
[2022/01/20 11:45:58] [ info]  filters:
[2022/01/20 11:45:58] [ info] ___________
[2022/01/20 11:45:58] [ info]  outputs:
[2022/01/20 11:45:58] [ info]      file.0
[2022/01/20 11:45:58] [ info]      file.1
[2022/01/20 11:45:58] [ info]      file.2
[2022/01/20 11:45:58] [ info] ___________
[2022/01/20 11:45:58] [ info]  collectors:
[New LWP 2837]
[New LWP 2838]
[2022/01/20 11:45:58] [ info] [engine] started (pid=2834)
[2022/01/20 11:45:58] [debug] [engine] coroutine stack size: 24576 bytes (24.0K)
[2022/01/20 11:45:58] [debug] [storage] [cio stream] new stream registered: cpu.0
[2022/01/20 11:45:58] [ info] [storage] version=1.1.5, initializing...
[2022/01/20 11:45:58] [ info] [storage] in-memory
[2022/01/20 11:45:58] [ info] [storage] normal synchronization mode, checksum disabled, max_chunks_up=128
[2022/01/20 11:45:58] [ info] [cmetrics] version=0.2.2
[2022/01/20 11:45:58] [debug] [file:file.0] created event channels: read=19 write=20
[2022/01/20 11:45:58] [debug] [file:file.1] created event channels: read=21 write=22
[2022/01/20 11:45:58] [debug] [file:file.2] created event channels: read=23 write=24
[2022/01/20 11:45:58] [debug] [router] match rule cpu.0:file.0
[2022/01/20 11:45:58] [debug] [router] match rule cpu.0:file.1
[2022/01/20 11:45:58] [debug] [router] match rule cpu.0:file.2
[2022/01/20 11:45:58] [ info] [sp] stream processor started
[2022/01/20 11:46:03] [debug] [task] created task=0x76ecc0e0 id=0 OK

Thread 2 "flb-pipeline" received signal SIGSEGV, Segmentation fault.
[Switching to LWP 2837]
0x0044f2e4 in flb_input_event_type_is_metric ()
(gdb) info threads
  Id   Target Id               Frame
  1    LWP 2834 "fluent-bit"   0x76fadc88 in __aeabi_read_tp ()
   from /lib/ld-musl-armhf.so.1
* 2    LWP 2837 "flb-pipeline" 0x0044f2e4 in flb_input_event_type_is_metric ()
  3    LWP 2838 "flb-logger"   0x76fadc8c in __aeabi_read_tp ()
   from /lib/ld-musl-armhf.so.1
(gdb) backtrace
#0  0x0044f2e4 in flb_input_event_type_is_metric ()
#1  0x004aedd4 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

APKBUILD modification example (overwriting C_FLAGS/CXX_FLAGS):


build() {
    if [ "$CBUILD" != "$CHOST" ]; then
        CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux" 
    fi
    # default CORE_STACK_SIZE=((3 * PTHREAD_STACK_MIN) / 2)=3072 is invalid
    # based on https://docs.fluentbit.io/manual/administration/configuring-fluent-bit/configuration-file
    # set default to 24576
    cmake -B build \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_INSTALL_LIBDIR=lib \
        -DCMAKE_BUILD_TYPE=None \
+        -DCMAKE_CXX_FLAGS='-O2 -fomit-frame-pointer'
+        -DCMAKE_C_FLAGS='-O2 -fomit-frame-pointer'
        -DFLB_CORO_STACK_SIZE=24576 \
        -DFLB_TESTS_INTERNAL=Yes \
        -DFLB_TLS=Yes \
        -DFLB_HTTP_SERVER=Yes \
        $CMAKE_CROSSOPTS .
    make -C build
}
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking