Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

engine: add sleep to output logs on init #7931

Merged
merged 1 commit into from
Sep 22, 2023

Conversation

nokute78
Copy link
Collaborator

This patch is a workaround to output initialization error logs.

Example:

$ bin/fluent-bit -i dummy -p aaa=bbb -o stdout
Fluent Bit v2.1.9
* Copyright (C) 2015-2022 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io
[2023/09/16 09:43:38] [error] [lib] backend failed
[2023/09/16 09:43:38] [ info] [fluent bit] version=2.1.9, commit=3c2c5004b1, pid=24686
$

Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • [N/A] Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • [N/A] Run local packaging test showing all targets (including any new ones) build.
  • [N/A] Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • [N/A] Documentation required for this feature

Backporting

  • Backport to latest stable release.

Debug output

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

[2023/09/16 09:45:58] [error] [lib] backend failed
[2023/09/16 09:45:58] [ info] [fluent bit] version=2.1.10, commit=47b42dd4df, pid=24709
[2023/09/16 09:45:58] [ info] [storage] ver=1.2.0, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2023/09/16 09:45:58] [ info] [cmetrics] version=0.6.3
[2023/09/16 09:45:58] [ info] [ctraces ] version=0.3.1
[2023/09/16 09:45:58] [error] [config] dummy: unknown configuration property 'aaa'. The following properties are allowed: samples, dummy, metadata, rate, copies, start_time_sec, start_time_nsec, and fixed_timestamp.
[2023/09/16 09:45:58] [ help] try the command: bin/fluent-bit -i dummy -h

[2023/09/16 09:45:58] [error] [engine] input initialization failed

Valgrind output

Valgrind reported a leak that is not related this PR.

$ valgrind --leak-check=full bin/fluent-bit -i dummy -p aaa=bbb -o stdout
==24723== Memcheck, a memory error detector
==24723== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==24723== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==24723== Command: bin/fluent-bit -i dummy -p aaa=bbb -o stdout
==24723== 
Fluent Bit v2.1.10
* Copyright (C) 2015-2022 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

[2023/09/16 09:46:36] [ info] [fluent bit] version=2.1.10, commit=47b42dd4df, pid=24723
[2023/09/16 09:46:36] [ info] [storage] ver=1.2.0, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2023/09/16 09:46:36] [ info] [cmetrics] version=0.6.3
[2023/09/16 09:46:36] [ info] [ctraces ] version=0.3.1
[2023/09/16 09:46:36] [error] [config] dummy: unknown configuration property 'aaa'. The following properties are allowed: samples, dummy, metadata, rate, copies, start_time_sec, start_time_nsec, and fixed_timestamp.
[2023/09/16 09:46:36] [ help] try the command: bin/fluent-bit -i dummy -h

[2023/09/16 09:46:36] [error] [engine] input initialization failed
[2023/09/16 09:46:36] [error] [lib] backend failed
==24723== 
==24723== HEAP SUMMARY:
==24723==     in use at exit: 7 bytes in 1 blocks
==24723==   total heap usage: 1,178 allocs, 1,177 frees, 221,010 bytes allocated
==24723== 
==24723== 7 bytes in 1 blocks are definitely lost in loss record 1 of 1
==24723==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==24723==    by 0x1C3E60: flb_malloc (flb_mem.h:80)
==24723==    by 0x1C414A: flb_strndup (flb_str.h:34)
==24723==    by 0x1C41B1: flb_strdup (flb_str.h:46)
==24723==    by 0x1C681C: flb_main (fluent-bit.c:928)
==24723==    by 0x1C7594: main (fluent-bit.c:1358)
==24723== 
==24723== LEAK SUMMARY:
==24723==    definitely lost: 7 bytes in 1 blocks
==24723==    indirectly lost: 0 bytes in 0 blocks
==24723==      possibly lost: 0 bytes in 0 blocks
==24723==    still reachable: 0 bytes in 0 blocks
==24723==         suppressed: 0 bytes in 0 blocks
==24723== 
==24723== For lists of detected and suppressed errors, rerun with: -s
==24723== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

@nokute78 nokute78 temporarily deployed to pr September 16, 2023 00:49 — with GitHub Actions Inactive
@nokute78 nokute78 temporarily deployed to pr September 16, 2023 00:49 — with GitHub Actions Inactive
@nokute78 nokute78 temporarily deployed to pr September 16, 2023 00:49 — with GitHub Actions Inactive
@nokute78 nokute78 temporarily deployed to pr September 16, 2023 01:19 — with GitHub Actions Inactive
@edsiper edsiper merged commit 2631ca1 into fluent:master Sep 22, 2023
41 of 42 checks passed
@nokute78 nokute78 deleted the output_error_log_on_init branch September 22, 2023 22:32
leonardo-albertovich pushed a commit that referenced this pull request Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants