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

config_format: windows: Handle static config on windows correctly #9582

Merged
merged 2 commits into from
Nov 13, 2024

Conversation

cosmo0920
Copy link
Contributor

@cosmo0920 cosmo0920 commented Nov 12, 2024

In the current master on Fluent Bit, we didn't follow the changes of enabling FLB_STATIC_CONF case.
With tons of changes after we introduced that option on cmake, this option does not work for using enabling with -DFLB_STATIC_CONF=/path/to/confdir.

I followed the subsequent changes since that feature was introduced and plug a NULL pointer exception for feof(3).
This is because this is always needed for reading from the actual configuration files. However, reading from buffer on memory is not needed to check the end of the contents for Fluent Bit configuration.

I supposed that we can omit that checker when enabling static config.

Closes #9556.


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]
    log_level debug
    Log_File /path/to/fluent-bit-debug.log

[INPUT]
    Name cpu
    Tag  cpu_metrics

[OUTPUT]
    Name stdout
    Match *
  • Debug log output from testing the change
Fluent Bit v3.2.0
* Copyright (C) 2015-2024 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

______ _                  _    ______ _ _           _____  _____ 
|  ___| |                | |   | ___ (_) |         |____ |/ __  \
| |_  | |_   _  ___ _ __ | |_  | |_/ /_| |_  __   __   / /`' / /'
|  _| | | | | |/ _ \ '_ \| __| | ___ \ | __| \ \ / /   \ \  / /  
| |   | | |_| |  __/ | | | |_  | |_/ / | |_   \ V /.___/ /./ /___
\_|   |_|\__,_|\___|_| |_|\__| \____/|_|\__|   \_/ \____(_)_____/


[2024/11/13 15:50:33] [ info] Configuration:
[2024/11/13 15:50:33] [ info]  flush time     | 1.000000 seconds
[2024/11/13 15:50:33] [ info]  grace          | 5 seconds
[2024/11/13 15:50:33] [ info]  daemon         | 0
[2024/11/13 15:50:33] [ info] ___________
[2024/11/13 15:50:33] [ info]  inputs:
[2024/11/13 15:50:33] [ info]      cpu
[2024/11/13 15:50:33] [ info] ___________
[2024/11/13 15:50:33] [ info]  filters:
[2024/11/13 15:50:33] [ info] ___________
[2024/11/13 15:50:33] [ info]  outputs:
[2024/11/13 15:50:33] [ info]      stdout.0
[2024/11/13 15:50:33] [ info] ___________
[2024/11/13 15:50:33] [ info]  collectors:
[0] cpu_metrics: [[1731480634.533452284, {}], {"cpu_p"=>0.500000, "user_p"=>0.392857, "system_p"=>0.107143, "cpu0.p_cpu"=>0.000000, "cpu0.p_user"=>0.000000, "cpu0.p_system"=>0.000000, "cpu1.p_cpu"=>1.000000, "cpu1.p_user"=>0.000000, "cpu1.p_system"=>1.000000, "cpu2.p_cpu"=>1.000000, "cpu2.p_user"=>1.000000, "cpu2.p_system"=>0.000000, "cpu3.p_cpu"=>0.000000, "cpu3.p_user"=>0.000000, "cpu3.p_system"=>0.000000, "cpu4.p_cpu"=>0.000000, "cpu4.p_user"=>0.000000, "cpu4.p_system"=>0.000000, "cpu5.p_cpu"=>0.000000, "cpu5.p_user"=>0.000000, "cpu5.p_system"=>0.000000, "cpu6.p_cpu"=>1.000000, "cpu6.p_user"=>1.000000, "cpu6.p_system"=>0.000000, "cpu7.p_cpu"=>0.000000, "cpu7.p_user"=>0.000000, "cpu7.p_system"=>0.000000, "cpu8.p_cpu"=>1.000000, "cpu8.p_user"=>1.000000, "cpu8.p_system"=>0.000000, "cpu9.p_cpu"=>0.000000, "cpu9.p_user"=>0.000000, "cpu9.p_system"=>0.000000, "cpu10.p_cpu"=>5.000000, "cpu10.p_user"=>5.000000, "cpu10.p_system"=>0.000000, "cpu11.p_cpu"=>0.000000, "cpu11.p_user"=>0.000000, "cpu11.p_system"=>0.000000, "cpu12.p_cpu"=>1.000000, "cpu12.p_user"=>1.000000, "cpu12.p_system"=>0.000000, "cpu13.p_cpu"=>0.000000, "cpu13.p_user"=>0.000000, "cpu13.p_system"=>0.000000, "cpu14.p_cpu"=>0.000000, "cpu14.p_user"=>0.000000, "cpu14.p_system"=>0.000000, "cpu15.p_cpu"=>0.000000, "cpu15.p_user"=>0.000000, "cpu15.p_system"=>0.000000, "cpu16.p_cpu"=>0.000000, "cpu16.p_user"=>0.000000, "cpu16.p_system"=>0.000000, "cpu17.p_cpu"=>0.000000, "cpu17.p_user"=>0.000000, "cpu17.p_system"=>0.000000, "cpu18.p_cpu"=>0.000000, "cpu18.p_user"=>0.000000, "cpu18.p_system"=>0.000000, "cpu19.p_cpu"=>0.000000, "cpu19.p_user"=>0.000000, "cpu19.p_system"=>0.000000, "cpu20.p_cpu"=>0.000000, "cpu20.p_user"=>0.000000, "cpu20.p_system"=>0.000000, "cpu21.p_cpu"=>0.000000, "cpu21.p_user"=>0.000000, "cpu21.p_system"=>0.000000, "cpu22.p_cpu"=>1.000000, "cpu22.p_user"=>1.000000, "cpu22.p_system"=>0.000000, "cpu23.p_cpu"=>0.000000, "cpu23.p_user"=>0.000000, "cpu23.p_system"=>0.000000, "cpu24.p_cpu"=>0.000000, "cpu24.p_user"=>0.000000, "cpu24.p_system"=>0.000000, "cpu25.p_cpu"=>0.000000, "cpu25.p_user"=>0.000000, "cpu25.p_system"=>0.000000, "cpu26.p_cpu"=>1.000000, "cpu26.p_user"=>1.000000, "cpu26.p_system"=>0.000000, "cpu27.p_cpu"=>2.000000, "cpu27.p_user"=>1.000000, "cpu27.p_system"=>1.000000}]
^C[2024/11/13 15:50:35] [engine] caught signal (SIGINT)
[0] cpu_metrics: [[1731480635.529347000, {}], {"cpu_p"=>0.357143, "user_p"=>0.214286, "system_p"=>0.142857, "cpu0.p_cpu"=>0.000000, "cpu0.p_user"=>0.000000, "cpu0.p_system"=>0.000000, "cpu1.p_cpu"=>2.000000, "cpu1.p_user"=>0.000000, "cpu1.p_system"=>2.000000, "cpu2.p_cpu"=>0.000000, "cpu2.p_user"=>0.000000, "cpu2.p_system"=>0.000000, "cpu3.p_cpu"=>0.000000, "cpu3.p_user"=>0.000000, "cpu3.p_system"=>0.000000, "cpu4.p_cpu"=>0.000000, "cpu4.p_user"=>0.000000, "cpu4.p_system"=>0.000000, "cpu5.p_cpu"=>0.000000, "cpu5.p_user"=>0.000000, "cpu5.p_system"=>0.000000, "cpu6.p_cpu"=>0.000000, "cpu6.p_user"=>0.000000, "cpu6.p_system"=>0.000000, "cpu7.p_cpu"=>0.000000, "cpu7.p_user"=>0.000000, "cpu7.p_system"=>0.000000, "cpu8.p_cpu"=>0.000000, "cpu8.p_user"=>0.000000, "cpu8.p_system"=>0.000000, "cpu9.p_cpu"=>0.000000, "cpu9.p_user"=>0.000000, "cpu9.p_system"=>0.000000, "cpu10.p_cpu"=>4.000000, "cpu10.p_user"=>4.000000, "cpu10.p_system"=>0.000000, "cpu11.p_cpu"=>0.000000, "cpu11.p_user"=>0.000000, "cpu11.p_system"=>0.000000, "cpu12.p_cpu"=>0.000000, "cpu12.p_user"=>0.000000, "cpu12.p_system"=>0.000000, "cpu13.p_cpu"=>0.000000, "cpu13.p_user"=>0.000000, "cpu13.p_system"=>0.000000, "cpu14.p_cpu"=>0.000000, "cpu14.p_user"=>0.000000, "cpu14.p_system"=>0.000000, "cpu15.p_cpu"=>0.000000, "cpu15.p_user"=>0.000000, "cpu15.p_system"=>0.000000, "cpu16.p_cpu"=>0.000000, "cpu16.p_user"=>0.000000, "cpu16.p_system"=>0.000000, "cpu17.p_cpu"=>0.000000, "cpu17.p_user"=>0.000000, "cpu17.p_system"=>0.000000, "cpu18.p_cpu"=>1.000000, "cpu18.p_user"=>1.000000, "cpu18.p_system"=>0.000000, "cpu19.p_cpu"=>0.000000, "cpu19.p_user"=>0.000000, "cpu19.p_system"=>0.000000, "cpu20.p_cpu"=>0.000000, "cpu20.p_user"=>0.000000, "cpu20.p_system"=>0.000000, "cpu21.p_cpu"=>0.000000, "cpu21.p_user"=>0.000000, "cpu21.p_system"=>0.000000, "cpu22.p_cpu"=>0.000000, "cpu22.p_user"=>0.000000, "cpu22.p_system"=>0.000000, "cpu23.p_cpu"=>0.000000, "cpu23.p_user"=>0.000000, "cpu23.p_system"=>0.000000, "cpu24.p_cpu"=>0.000000, "cpu24.p_user"=>0.000000, "cpu24.p_system"=>0.000000, "cpu25.p_cpu"=>0.000000, "cpu25.p_user"=>0.000000, "cpu25.p_system"=>0.000000, "cpu26.p_cpu"=>0.000000, "cpu26.p_user"=>0.000000, "cpu26.p_system"=>0.000000, "cpu27.p_cpu"=>0.000000, "cpu27.p_user"=>0.000000, "cpu27.p_system"=>0.000000}]
  • Attached Valgrind output that shows no leaks or memory corruption was found
==1445132== 
==1445132== HEAP SUMMARY:
==1445132==     in use at exit: 0 bytes in 0 blocks
==1445132==   total heap usage: 2,985 allocs, 2,985 frees, 1,094,104 bytes allocated
==1445132== 
==1445132== All heap blocks were freed -- no leaks are possible
==1445132== 
==1445132== For lists of detected and suppressed errors, rerun with: -s
==1445132== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

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.

@cosmo0920 cosmo0920 marked this pull request as ready for review November 13, 2024 06:51
@cosmo0920 cosmo0920 added this to the Fluent Bit Next milestone Nov 13, 2024
@edsiper edsiper merged commit 57530ed into master Nov 13, 2024
52 of 53 checks passed
@edsiper edsiper deleted the cosmo0920-handle-static-config-on-windows-correctly branch November 13, 2024 15:47
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.

Fluent Bit v3.2.0 exits immediately on Windows if build with static conf
2 participants