-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
fix(parsers): Memory leak for plugins using ParserFunc. #11815
Conversation
…lugins use ParserFunc.
@srebhan why was Telegraf keeping track of the running parsers? |
@sspaink when moving to the more plugin-like structure we used it to initialize the parsers just as we do with the other plugins, but I don't think it is necessary. |
Download PR build artifacts for linux_amd64.tar.gz, darwin_amd64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
(cherry picked from commit 3b3584b)
resolves #11809
When input plugins (or processors) use the passed
ParserFunc
, the new parser gets added to the list of running parsers inconfig.Parsers
. As this instantiation of parsers can happen often and is out of the control of Telegraf's general framework, the array of running parsers will keep growing and is newer cleaned up. This means that a reference to the no-longer-used parsers is kept, garbage collection cannot free the parsers' space and we slowly eat up all memory.The PR completely removes tracking the running parsers and thus solves the memory leak. However, once we want to go to dynamic plugin starting/stopping this problem will hit us for other categories as well as there is currently no way to remove running plugin instances from the corresponding lists.