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 panics when cloning a special query #8531

Merged
merged 3 commits into from
Feb 15, 2023
Merged

Conversation

garrettlish
Copy link
Contributor

What this PR does / why we need it:
Sometimes we will get panics when parse the expression which is cloning a special query: syntax error: unexpected $end, expecting NUMBER or { or (", line:1, col:1025}.

Which issue(s) this PR fixes:
Fixes #7155

Special notes for your reviewer:
N/A

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • CHANGELOG.md updated
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/upgrading/_index.md

sometimes we will get panics when parse the expression which is cloning a special query: `syntax error: unexpected $end, expecting NUMBER or { or (", line:1, col:1025}`.

similar to grafana#7155 reported by DylanGuedes

Signed-off-by: garrettlish <garrett.li.sh@gmail.com>
@garrettlish garrettlish requested a review from a team as a code owner February 15, 2023 10:36
Copy link
Contributor

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

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

@garrettlish can you please explain why this change should fix the issue?
This breaks other tests btw: https://drone.grafana.net/grafana/loki/20419/3/5

I would appreciate if you could reduce those test cases down to more simple forms, which describe the actual problem at hand; these queries are complex and they will be difficult to interpret by future readers.

@pull-request-size pull-request-size bot added size/M and removed size/S labels Feb 15, 2023
@garrettlish
Copy link
Contributor Author

@dannykopping sorry for break other tests in the first commit. I add that complex query is because the syntax parse will panic for these kinds of complex queries only, looks like goyacc cannot parse the complex queries properly if we don't have space between by and (, let me try to refine the query.

Copy link
Contributor

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

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

Thanks!

The fix looks good, but I think we should address the underlying panic as well.
I'll raise this with the team 👍

@dannykopping dannykopping merged commit 433d5bf into grafana:main Feb 15, 2023
@DylanGuedes DylanGuedes added kind/bug backport release-2.7.x add to a PR to backport it into release 2.7.x labels Feb 23, 2023
@grafanabot
Copy link
Collaborator

Hello @DylanGuedes!
Backport pull requests need to be either:

  • Pull requests which address bugs,
  • Urgent fixes which need product approval, in order to get merged,
  • Docs changes.

Please, if the current pull request addresses a bug fix, label it with the type/bug label.
If it already has the product approval, please add the product-approved label. For docs changes, please add the type/docs label.
If none of the above applies, please consider removing the backport label and target the next major/minor release.
Thanks!

@DylanGuedes DylanGuedes added backport release-2.7.x add to a PR to backport it into release 2.7.x and removed backport release-2.7.x add to a PR to backport it into release 2.7.x labels Feb 23, 2023
grafanabot pushed a commit that referenced this pull request Feb 23, 2023
Signed-off-by: garrettlish <garrett.li.sh@gmail.com>
(cherry picked from commit 433d5bf)
DylanGuedes added a commit that referenced this pull request Feb 24, 2023
Backport 433d5bf from #8531

---------

Co-authored-by: Garrett <garrett.li.sh@gmail.com>
Co-authored-by: Dylan Guedes <djmgguedes@gmail.com>
@chaudum chaudum added the type/bug Somehing is not working as expected label Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport release-2.7.x add to a PR to backport it into release 2.7.x size/M type/bug Somehing is not working as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

QueryFrontend panics when cloning a special query
5 participants