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

network: utils: Fix int conversion errors #8555

Merged
merged 2 commits into from
Mar 12, 2024

Conversation

cosmo0920
Copy link
Contributor

@cosmo0920 cosmo0920 commented Mar 6, 2024

After updated the latest command line tools, I got int conversion errors.
These should be generated using POSIX version of strerror_r and needless flb_free calling.

The latter one is able to be confirmed with:

 % leaks -atExit -- bin/flb-it-utils test_flb_utils_get_machine_id
 flb-it-utils(34841) MallocStackLogging: could not tag MSL-related memory as no_footprint, so those pages will be inc
luded in process footprint - (null)
 flb-it-utils(34841) MallocStackLogging: recording malloc and VM allocation stacks using lite mode
 Test test_flb_utils_get_machine_id...           [ OK ]
 SUCCESS: All unit tests have passed.
 Process 34841 is not debuggable. Due to security restrictions, leaks can only show or save contents of readonly memo
ry of restricted processes.
    
 Process:         flb-it-utils [34841]
 Path:            /Users/USER/*/flb-it-utils
 Load Address:    0x1023cc000
 Identifier:      flb-it-utils
 Version:         0
 Code Type:       ARM64
 Platform:        macOS
 Parent Process:  leaks [34840]
    
 Date/Time:       2024-03-06 23:42:29.641 +0900
 Launch Time:     2024-03-06 23:42:29.596 +0900
 OS Version:      macOS 14.3.1 (23D60)
 Report Version:  7
 Analysis Tool:   /usr/bin/leaks
    
 Physical footprint:         4385K
 Physical footprint (peak):  4385K
 Idle exit:                  untracked
 ----
    
 leaks Report Version: 4.0, multi-line stacks
 Process 34841: 516 nodes malloced for 42 KB
 Process 34841: 0 leaks for 0 total leaked bytes.

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

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

out_size is just for used to return the lentgth of ID string.
Removing this flb_free does not cause memory leaks.

```
% leaks -atExit -- bin/flb-it-utils test_flb_utils_get_machine_id
flb-it-utils(34841) MallocStackLogging: could not tag MSL-related memory as no_footprint, so those pages will be included in process footprint - (null)
flb-it-utils(34841) MallocStackLogging: recording malloc and VM allocation stacks using lite mode
Test test_flb_utils_get_machine_id...           [ OK ]
SUCCESS: All unit tests have passed.
Process 34841 is not debuggable. Due to security restrictions, leaks can only show or save contents of readonly memory of restricted processes.

Process:         flb-it-utils [34841]
Path:            /Users/USER/*/flb-it-utils
Load Address:    0x1023cc000
Identifier:      flb-it-utils
Version:         0
Code Type:       ARM64
Platform:        macOS
Parent Process:  leaks [34840]

Date/Time:       2024-03-06 23:42:29.641 +0900
Launch Time:     2024-03-06 23:42:29.596 +0900
OS Version:      macOS 14.3.1 (23D60)
Report Version:  7
Analysis Tool:   /usr/bin/leaks

Physical footprint:         4385K
Physical footprint (peak):  4385K
Idle exit:                  untracked
----

leaks Report Version: 4.0, multi-line stacks
Process 34841: 516 nodes malloced for 42 KB
Process 34841: 0 leaks for 0 total leaked bytes.
```

Signed-off-by: Hiroshi Hatake <[email protected]>
@edsiper
Copy link
Member

edsiper commented Mar 7, 2024

(I am glad I resisted to upgrade command line tools XD )

@cosmo0920 cosmo0920 marked this pull request as ready for review March 8, 2024 08:16
@cosmo0920
Copy link
Contributor Author

cosmo0920 commented Mar 8, 2024

Then, we should process reviewing! ;-)

Copy link
Contributor

@pwhelan pwhelan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I was able to build it on macOS without any warnings or errors in src/flb_network.c.

@edsiper edsiper merged commit efa1e89 into master Mar 12, 2024
44 of 45 checks passed
@edsiper edsiper deleted the cosmo0920-fix-int-conversion-errors branch March 12, 2024 16:41
@edsiper
Copy link
Member

edsiper commented Mar 12, 2024

thanks!

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