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

pkg/logql: fix panic on invalid regex in matcher #951

Closed
wants to merge 1 commit into from

Conversation

rfratto
Copy link
Member

@rfratto rfratto commented Aug 29, 2019

loqgl.ParseExpr has been modified to use a defer/recover to recover from a panic caused by a failed regex parse in the parser.

A defer and panic were used over adding an error return into mustNewMatcher by imitating how Go's parser works: the exposed interface returns an error while the internal mechanisms use panic. This simplifies the design and implementation of the parser.

Fixes #949.

@rfratto rfratto force-pushed the fix-logql-regex-panic branch 2 times, most recently from ed71f8d to ffae7fa Compare August 29, 2019 07:41
loqgl.ParseExpr has been modified to use a defer/recover to recover from
a panic caused by a failed regex parse in the parser.

A defer and panic were used over adding an error return into
mustNewMatcher by imitating how Go's parser works[1]: the exposed
interface returns an error while the internal mechanisms use panic. This
simplifies the design and implementation of the parser.

Closes grafana#949.

[1]: https://golang.org/src/go/parser/interface.go#L92
@cyriltovena
Copy link
Contributor

Do you need to rebase or the issue is fixed ?

@rfratto
Copy link
Member Author

rfratto commented Sep 5, 2019

This is superseded by #654, closing

@rfratto rfratto closed this Sep 5, 2019
@rfratto rfratto deleted the fix-logql-regex-panic branch September 25, 2019 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ingester crashes on invalid regex query
2 participants