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

output: release instance when init failed #3576

Merged
merged 1 commit into from
May 30, 2021

Conversation

nokute78
Copy link
Collaborator

Some error cases at flb_output_init_all, instance is not released.
This patch is to release the instance on these cases.


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
  • [N/A] Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

Documentation

  • [N/A] Documentation required for this feature

Valgrind output

$ valgrind --leak-check=full ../bin/fluent-bit -i cpu -o stdout
==49522== Memcheck, a memory error detector
==49522== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==49522== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==49522== Command: ../bin/fluent-bit -i cpu -o stdout
==49522== 
Fluent Bit v1.8.0
* 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

[2021/05/30 20:43:23] [ info] [engine] started (pid=49522)
[2021/05/30 20:43:23] [ info] [storage] version=1.1.1, initializing...
[2021/05/30 20:43:23] [ info] [storage] in-memory
[2021/05/30 20:43:23] [ info] [storage] normal synchronization mode, checksum disabled, max_chunks_up=128
[2021/05/30 20:43:23] [ info] [sp] stream processor started
==49522== Warning: client switching stacks?  SP change: 0x57e48b8 --> 0x4c66840
==49522==          to suppress, use: --max-stackframe=12050552 or greater
==49522== Warning: client switching stacks?  SP change: 0x4c667b8 --> 0x57e48b8
==49522==          to suppress, use: --max-stackframe=12050688 or greater
==49522== Warning: client switching stacks?  SP change: 0x57e48b8 --> 0x4c667b8
==49522==          to suppress, use: --max-stackframe=12050688 or greater
==49522==          further instances of this message will not be shown.
[0] cpu.0: [1622375004.134126815, {"cpu_p"=>4.000000, "user_p"=>3.000000, "system_p"=>1.000000, "cpu0.p_cpu"=>4.000000, "cpu0.p_user"=>3.000000, "cpu0.p_system"=>1.000000}]
[1] cpu.0: [1622375005.121508633, {"cpu_p"=>8.000000, "user_p"=>7.000000, "system_p"=>1.000000, "cpu0.p_cpu"=>8.000000, "cpu0.p_user"=>7.000000, "cpu0.p_system"=>1.000000}]
[2] cpu.0: [1622375006.121929391, {"cpu_p"=>1.000000, "user_p"=>1.000000, "system_p"=>0.000000, "cpu0.p_cpu"=>1.000000, "cpu0.p_user"=>1.000000, "cpu0.p_system"=>0.000000}]
[3] cpu.0: [1622375007.121601192, {"cpu_p"=>1.000000, "user_p"=>1.000000, "system_p"=>0.000000, "cpu0.p_cpu"=>1.000000, "cpu0.p_user"=>1.000000, "cpu0.p_system"=>0.000000}]
^C[2021/05/30 20:43:28] [engine] caught signal (SIGINT)
[2021/05/30 20:43:28] [ info] [input] pausing cpu.0
[0] cpu.0: [1622375008.172850773, {"cpu_p"=>7.000000, "user_p"=>6.000000, "system_p"=>1.000000, "cpu0.p_cpu"=>7.000000, "cpu0.p_user"=>6.000000, "cpu0.p_system"=>1.000000}]
[2021/05/30 20:43:28] [ warn] [engine] service will stop in 5 seconds
[2021/05/30 20:43:33] [ info] [engine] service stopped
==49522== 
==49522== HEAP SUMMARY:
==49522==     in use at exit: 0 bytes in 0 blocks
==49522==   total heap usage: 287 allocs, 287 frees, 977,143 bytes allocated
==49522== 
==49522== All heap blocks were freed -- no leaks are possible
==49522== 
==49522== For lists of detected and suppressed errors, rerun with: -s
==49522== ERROR SUMMARY: 0 errors from 0 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.

@edsiper edsiper merged commit cc1d93a into fluent:master May 30, 2021
edsiper pushed a commit that referenced this pull request May 30, 2021
@nokute78 nokute78 deleted the release_output_instance branch May 31, 2021 10:52
Shikugawa pushed a commit to Shikugawa/fluent-bit that referenced this pull request Jun 14, 2021
xmcqueen pushed a commit to xmcqueen/fluent-bit that referenced this pull request Jun 29, 2021
Shikugawa pushed a commit to Shikugawa/fluent-bit that referenced this pull request Sep 29, 2021
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