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

go: plugin_proxy: Handle FLBPluginInit(cb_init) error correctly and plug a SEGV case #8273

Merged
merged 1 commit into from
Dec 19, 2023

Conversation

cosmo0920
Copy link
Contributor

@cosmo0920 cosmo0920 commented Dec 12, 2023

As described in #8253, we should handle an error on initialization from Golang output plugin.
Currently, this should be discarded and not handled correctly. We should handle it properly.


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:

  • Example configuration file for the change
[SERVICE]
    Flush        5
    Daemon       Off
    Log_Level    info
    Plugins_File plugins.conf
    HTTP_Server  On
    HTTP_Listen  0.0.0.0
    HTTP_Port    2020
    storage.metrics On

[INPUT]
    Name gdummy
    Tag  dummy.local.ins1
    Dummy {"compact": true, "schema": 1, "message": "ok"}
    # threaded on

[OUTPUT]
    Name  gstdout
    Match *
[PLUGINS]
  Path /path/to/fluent-bit/build/in_gdummy.so
  Path /path/to/fluent-bit/build/out_gstdout.so
  • Debug log output from testing the change
    If an error occurred on Golang plugin side, we can obtain the following log instead of SEGV:
% bin/fluent-bit -c fluent-bit.conf -Y -v -H -P 2020 -vv
* Copyright (C) 2015-2023 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

[2023/12/12 13:39:18] [ info] [fluent bit] version=2.2.1, commit=40978390b6, pid=2799088
[2023/12/12 13:39:18] [ info] [storage] ver=1.1.6, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2023/12/12 13:39:18] [ info] [cmetrics] version=0.6.5
[2023/12/12 13:39:18] [ info] [ctraces ] version=0.3.1
[2023/12/12 13:39:18] [ info] [input:gdummy:gdummy.0] initializing
[2023/12/12 13:39:18] [ info] [input:gdummy:gdummy.0] storage_strategy='memory' (memory only)
[2023/12/12 13:39:18] [ info] [gdummy] plugin initialized
[2023/12/12 13:39:18] [ info] [input:gdummy:gdummy.0] thread instance initialized
[flb-go] plugin parameter = ''
[2023/12/12 13:39:18] [error] [go proxy]: plugin 'gstdout' failed to initialize
[2023/12/12 13:39:18] [error] [output] could not initialize 'gstdout' plugin
[2023/12/12 13:39:18] [error] [output] failed to initialize 'gstdout' plugin
[2023/12/12 13:39:18] [error] [engine] output initialization failed
[2023/12/12 13:39:18] [error] [lib] backend failed
[2023/12/12 13:39:19] [error] [input:gdummy:gdummy.0] wrong event, type=2 op=1

[2023/12/12 13:39:19] [error] could not retrieve collectors signal from parent thread on 'gdummy.0'

  • 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.

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

Documentation

  • Documentation required for this feature

Backporting

  • Backport to latest stable release.

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.

…lug a SEGV case

Signed-off-by: Hiroshi Hatake <hatake@calyptia.com>
@ezdev128
Copy link

As described in #8253, we should handle an error on initialization from Golang output plugin. Currently, this should be discarded and not handled correctly. We should handle it properly.

Thanks a lot!

@edsiper edsiper merged commit 79e61bd into master Dec 19, 2023
45 checks passed
@edsiper edsiper deleted the cosmo0920-plug-SEGV-on-returning-error-at-go-init branch December 19, 2023 19:28
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.

3 participants