-
Notifications
You must be signed in to change notification settings - Fork 1.9k
engine: fix several file descriptor leaks. #8393
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a0e5129
log: free log worker pipe when appropriate.
pwhelan bfd93e4
sched: free the base timer used by the scheduler.
pwhelan 178177f
engine: destroy self events channels on shutdown.
pwhelan 07454f1
output_thread: destroy thread events channel on shutdown.
pwhelan bbbe4dc
output_thread: destroy parent events channel on shutdown.
pwhelan 3c8d17d
config: release data pipe using flb_pipe_destroy.
pwhelan 5de388c
log: use flb_pipe_destroy to close worker log pipe on error.
pwhelan f197e5f
sched: use sched->evl when freeing the scheduler timer.
pwhelan c1bbded
log_cache: avoid double free by setting the log_cache pointer to NULL.
pwhelan fdd0bbe
in_calyptia_fleet: fix memory leak when setting conf_path_file.
pwhelan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems to me that before restart the event loop is not being destroyed, I would suggest to identify the root cause for this
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will look into this. This specific piece of code was added in to mitigate crashes in the following tests:
The other
flb-rt-filter_stdouttest,json_multiple, does not crash in the same manner as the other test.This is most likely due to the manner in which these tests use the fluent-bit API to instantiate the pipelines they use. The
case_insensitive_nametest executesflb_destroywithout first callingflb_stop. Upon trying to callflb_stopin the test it crashes when attempting to callpthread_joininsideflb_stop. This is most likely due to the fact that the test also does not callflb_startto initialize the thread.The easiest way out of this would be to simply leave the check there. Another alternative would be to move the deletion of the event channel into flb_stop, where it might be better placed. This would of course go against the symmetry it has with the channel being created inside
flb_engine.cin theflb_engine_startfunction. If we move the destruction of the channel toflb_stopwe should also probably move its creationflb_start. At the moment I have no idea what the consequences of this would be. The most obvious consequence would be that it would be linked toctx->event_channelinside theflb_ctx_tinstead of toconfig->event_thread_init, which is linked to the configuration.This could also be due to the fact that
flb_config_initsetsconfig->is_runningtoTRUEinstead of where I would expect it, inflb_engine_start. If it is set there insteadflb_engine_shutdownwould not get called inflb_destroy.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving
config->is_runningintoflb_engine_startedavoids the SIGSEGV caused by destroying thech_self_eventschannel but causes the memory used by all the custom, input, output and filter plugins to be leaked when using in several tests. The deallocation of plugins could be moved toflb_config_exitor similar, but that seems to me to be a bit ouf of scope. If that is the approach we want to take I can open a new PR later with the code to do so.