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

Fix segfault in processors/parser #9283

Merged
merged 6 commits into from
Jun 15, 2021

Conversation

srebhan
Copy link
Contributor

@srebhan srebhan commented May 20, 2021

Required for all PRs:

  • Updated associated README.md.
  • Wrote appropriate unit tests.

resolves #9282

Parsers can use the telegraf logging facility by defining a Log field. When using those parsers in inputs the logging facility is automatically set by telegraf after instantiation. However, in this processor the parsers are instantiated manually and setting the log facility is omitted. This in turn leads to segfault-panics for all parsers that rely on the logging facility.

This PR fixes the issue by passing its (newly added) logging facility on to the parser and in this step also gets rid of the unrecommended usage of the log package.
Additionally, some minor improvements like making the parser private and fixing the remaining linter issues are performed.

@telegraf-tiger telegraf-tiger bot added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label May 20, 2021
@srebhan srebhan added fix pr to fix corresponding bug plugin/processor labels May 20, 2021
@mirkocomparetti-synesis

Tested. Looks good for me!

Copy link
Contributor

@ssoroka ssoroka left a comment

Choose a reason for hiding this comment

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

Not sure about the debug lines (see comment), but otherwise looks good

plugins/parsers/xml/parser.go Outdated Show resolved Hide resolved
@reimda reimda merged commit 6cc942f into influxdata:master Jun 15, 2021
reimda pushed a commit that referenced this pull request Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin fix pr to fix corresponding bug plugin/processor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[processors.parser] Segmentation fault in nested parsing
4 participants