fluent-bit icon indicating copy to clipboard operation
fluent-bit copied to clipboard

The dummy plugin mishandles rate

Open msamoylov opened this issue 6 years ago • 5 comments

Bug Report

The dummy input plugin doesn't work with the Rate configuration parameter set larger than 1.

To Reproduce

❯ fluent-bit -c fluentbit.conf
Fluent Bit v1.6.5
* Copyright (C) 2019-2020 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

[2020/11/24 18:40:59] [ info] [engine] started (pid=96682)
[2020/11/24 18:40:59] [ info] [storage] version=1.0.6, initializing...
[2020/11/24 18:40:59] [ info] [storage] in-memory
[2020/11/24 18:40:59] [ info] [storage] normal synchronization mode, checksum disabled, max_chunks_up=128
[2020/11/24 18:40:59] [ info] [sp] stream processor started
[0] dummy.log: [1606236059.408433000, {"message"=>"hello"}]
^C[2020/11/24 18:41:24] [engine] caught signal (SIGINT)
[2020/11/24 18:41:24] [ warn] [engine] service will stop in 5 seconds
[2020/11/24 18:41:29] [ info] [engine] service stopped
[2020/11/24 18:41:29] [ warn] [engine] shutdown delayed, grace period has finished but some tasks are still running.
[2020/11/24 18:41:29] [ info] [task] dummy/dummy.0 has 1 pending task(s):
[2020/11/24 18:41:29] [ info] [task]   task_id=0 still running on route(s): stdout/stdout.0
[2020/11/24 18:41:29] [ warn] [engine] service will stop in 5 seconds
^C[2020/11/24 18:41:29] [engine] caught signal (SIGINT)

Expected behavior

I expect 100 events per second according to the documentation.

Your Environment

  • Version used: 1.6.5
  • Configuration:
# fluentbit.conf
[INPUT]
    Name   dummy
    Tag    dummy.log
    Dummy  {"message":"hello"}
    Rate   100

[OUTPUT]
    Name   stdout
    Match  *
  • Environment name and version (e.g. Kubernetes? What version?):
  • Server type and version:
  • Operating System and version: macOS 10.15.7
  • Filters and plugins: dummy, stdout
❯ brew info fluent-bit
fluent-bit: stable 1.6.5 (bottled), HEAD
Data Collector for IoT
https://github.com/fluent/fluent-bit
/usr/local/Cellar/fluent-bit/1.6.5 (98 files, 6.3MB) *
  Poured from bottle on 2020-11-23 at 11:40:11
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/fluent-bit.rb
License: Apache-2.0
==> Dependencies
Build: bison ✔, cmake ✔, flex ✘

Additional context

I wanted to use this plugin for load testing my Fluentd deployment.

msamoylov avatar Nov 24 '20 16:11 msamoylov

Hmm, rate is working on my side with 1.7.0 for 100 / 1000 - I've used to perform a few benchmarks. Potentially related to Mac.

Is this still occurring on your side?

agup006 avatar Feb 19 '21 07:02 agup006

Same behavior here:

fluent-bit: stable 1.7.2 (bottled), HEAD Data Collector for IoT https://github.com/fluent/fluent-bit /usr/local/Cellar/fluent-bit/1.7.2 (104 files, 6.8MB) * Poured from bottle on 2021-03-09 at 12:36:21 From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/fluent-bit.rb License: Apache-2.0

my settings:

[INPUT]
    NAME   dummy
    Dummy  {"tool": "fluent", "sub": {"s1": {"s2": "bit"}}}
    Tag    test_tag
    Rate   2
ProductName:    Mac OS X
ProductVersion: 10.15.7
BuildVersion:   19H2

diegotremper avatar Mar 09 '21 18:03 diegotremper

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Apr 09 '21 02:04 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Apr 20 '21 02:04 github-actions[bot]

Please be sure to notice the observation after the second command output, it seems like it could get lost...

This appears to be a bug on Mac OS. I'm running fluent-bit 1.9.6 on Monterey (arm) and this command properly generates the default one message per second:

$ fluent-bit -i dummy -o stdout
Fluent Bit v1.9.6
* Copyright (C) 2015-2022 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

[2022/07/20 15:54:44] [ info] [fluent bit] version=1.9.6, commit=, pid=4807
[2022/07/20 15:54:44] [ info] [storage] version=1.2.0, type=memory-only, sync=normal, checksum=disabled, max_chunks_up=128
[2022/07/20 15:54:44] [ info] [cmetrics] version=0.3.5
[2022/07/20 15:54:44] [ info] [output:stdout:stdout.0] worker #0 started
[2022/07/20 15:54:44] [ info] [sp] stream processor started
[0] dummy.0: [1658354085.415445000, {"message"=>"dummy"}]
[0] dummy.0: [1658354086.414038000, {"message"=>"dummy"}]
[0] dummy.0: [1658354087.415585000, {"message"=>"dummy"}]
^C[2022/07/20 15:54:49] [engine] caught signal (SIGINT)
[0] dummy.0: [1658354088.416675000, {"message"=>"dummy"}]
[2022/07/20 15:54:49] [ warn] [engine] service will shutdown in max 5 seconds
[2022/07/20 15:54:50] [ info] [engine] service has stopped (0 pending tasks)
[2022/07/20 15:54:50] [ info] [output:stdout:stdout.0] thread worker #0 stopping...
[2022/07/20 15:54:50] [ info] [output:stdout:stdout.0] thread worker #0 stopped
[2022/07/20 15:54:50] [  Error] kevent: No such file or directory, errno=2 at /tmp/fluent-bit-20220715-49542-8kph0p/fluent-bit-1.9.6/lib/monkey/mk_core/mk_event_kqueue.c:151

While any other rate specified causes a single dummy message, then nothing:

$ fluent-bit -i dummy -p rate=2 -o stdout
Fluent Bit v1.9.6
* Copyright (C) 2015-2022 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

[2022/07/20 15:57:11] [ info] [fluent bit] version=1.9.6, commit=, pid=5108
[2022/07/20 15:57:11] [ info] [storage] version=1.2.0, type=memory-only, sync=normal, checksum=disabled, max_chunks_up=128
[2022/07/20 15:57:11] [ info] [cmetrics] version=0.3.5
[2022/07/20 15:57:11] [ info] [sp] stream processor started
[2022/07/20 15:57:11] [ info] [output:stdout:stdout.0] worker #0 started
[0] dummy.0: [1658354231.986751000, {"message"=>"dummy"}]
<several seconds later>
^C[2022/07/20 15:57:30] [engine] caught signal (SIGINT)
[2022/07/20 15:57:30] [ warn] [engine] service will shutdown in max 5 seconds
[2022/07/20 15:57:31] [ info] [engine] service has stopped (0 pending tasks)
[2022/07/20 15:57:31] [ info] [output:stdout:stdout.0] thread worker #0 stopping...
[2022/07/20 15:57:31] [ info] [output:stdout:stdout.0] thread worker #0 stopped
[2022/07/20 15:57:31] [  Error] kevent: No such file or directory, errno=2 at /tmp/fluent-bit-20220715-49542-8kph0p/fluent-bit-1.9.6/lib/monkey/mk_core/mk_event_kqueue.c:151

NOTE HERE: Interestingly, specifying -p rate=1 on the command line behaves properly with one message per second.

The same behavior is exhibited when using a config file:

[INPUT]
    Name   dummy
    Tag    dummy.log
    Rate   30

[FILTER]
    Name    lua
    Match   *
    Script  throttle.lua
    Call    send_or_dont

[OUTPUT]
    Name    stdout

$ fluent-bit -c test_config.cfg
Fluent Bit v1.9.6
* Copyright (C) 2015-2022 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

[2022/07/20 15:59:33] [ info] [fluent bit] version=1.9.6, commit=, pid=5565
[2022/07/20 15:59:33] [ info] [storage] version=1.2.0, type=memory-only, sync=normal, checksum=disabled, max_chunks_up=128
[2022/07/20 15:59:33] [ info] [cmetrics] version=0.3.5
[2022/07/20 15:59:33] [ info] [output:stdout:stdout.0] worker #0 started
[2022/07/20 15:59:33] [ info] [sp] stream processor started
[0] dummy.log: [1658354373.678347000, {"message"=>"dummy"}]
<several seconds later>
^C[2022/07/20 15:59:39] [engine] caught signal (SIGINT)
[2022/07/20 15:59:39] [ warn] [engine] service will shutdown in max 5 seconds
[2022/07/20 15:59:40] [ info] [engine] service has stopped (0 pending tasks)
[2022/07/20 15:59:40] [ info] [output:stdout:stdout.0] thread worker #0 stopping...
[2022/07/20 15:59:40] [ info] [output:stdout:stdout.0] thread worker #0 stopped
[2022/07/20 15:59:40] [  Error] kevent: No such file or directory, errno=2 at /tmp/fluent-bit-20220715-49542-8kph0p/fluent-bit-1.9.6/lib/monkey/mk_core/mk_event_kqueue.c:151

This is not the behavior I see on Ubuntu:

$ /opt/fluent-bit/bin/fluent-bit --version
Fluent Bit v1.9.6
Git commit:

$ /opt/fluent-bit/bin/fluent-bit -i dummy -p rate=2 -o stdout
Fluent Bit v1.9.6
* Copyright (C) 2015-2022 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

[2022/07/20 16:07:05] [ info] [fluent bit] version=1.9.6, commit=, pid=1811806
[2022/07/20 16:07:05] [ info] [storage] version=1.2.0, type=memory-only, sync=normal, checksum=disabled, max_chunks_up=128
[2022/07/20 16:07:05] [ info] [cmetrics] version=0.3.5
[2022/07/20 16:07:05] [ info] [sp] stream processor started
[2022/07/20 16:07:05] [ info] [output:stdout:stdout.0] worker #0 started
[0] dummy.0: [1658354825.732224613, {"message"=>"dummy"}]
[0] dummy.0: [1658354825.806136938, {"message"=>"dummy"}]
[1] dummy.0: [1658354826.306101821, {"message"=>"dummy"}]
[0] dummy.0: [1658354826.806155553, {"message"=>"dummy"}]
[1] dummy.0: [1658354827.306095146, {"message"=>"dummy"}]
[0] dummy.0: [1658354827.806117363, {"message"=>"dummy"}]
[1] dummy.0: [1658354828.306089636, {"message"=>"dummy"}]
^C[2022/07/20 16:07:09] [engine] caught signal (SIGINT)
[0] dummy.0: [1658354828.806123869, {"message"=>"dummy"}]
[1] dummy.0: [1658354829.306093434, {"message"=>"dummy"}]
[2022/07/20 16:07:09] [ warn] [engine] service will shutdown in max 5 seconds
[2022/07/20 16:07:09] [ info] [engine] service has stopped (0 pending tasks)
[2022/07/20 16:07:09] [ info] [output:stdout:stdout.0] thread worker #0 stopping...
[2022/07/20 16:07:09] [ info] [output:stdout:stdout.0] thread worker #0 stopped

brunson avatar Jul 20 '22 22:07 brunson