Skip to content

Conversation

charleskorn
Copy link
Contributor

What this PR does

MQE panics when the estimated memory consumption of a query goes negative, as this indicates that something was returned to a pool multiple times, which could lead to incorrect query results.

However, when this happens in a production environment, it can be quite difficult to debug this, as it's often difficult to determine which query was affected: the panic often happens when Query.Close() is called, which is not tracked by the activity tracker, and so the query doesn't appear in the list of inflight queries when the querier restarts.

So, in this PR, I'm adding the query expression to the panic message to make it a bit easier to figure out what happened.

Which issue(s) this PR fixes or relates to

#10067

Checklist

  • Tests updated.
  • [n/a] Documentation added.
  • [covered by Mimir Query Engine #10067] CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • [n/a] about-versioning.md updated with experimental features.

@charleskorn charleskorn marked this pull request as ready for review June 3, 2025 09:45
@charleskorn charleskorn requested a review from a team as a code owner June 3, 2025 09:45
@charleskorn charleskorn force-pushed the charleskorn/improve-panic-message branch from 7bf0da0 to fbcf221 Compare June 3, 2025 09:50
@charleskorn charleskorn enabled auto-merge (squash) June 3, 2025 09:57
@charleskorn charleskorn merged commit 8139c71 into main Jun 3, 2025
30 checks passed
@charleskorn charleskorn deleted the charleskorn/improve-panic-message branch June 3, 2025 10:16
@mimir-github-bot
Copy link
Contributor

The backport to r345 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-11615-to-r345 origin/r345
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 8139c71bb0ee9b8c66aea781b6c4cf0c37c4e01b
# Push it to GitHub
git push --set-upstream origin backport-11615-to-r345
git switch main
# Remove the local backport branch
git branch -D backport-11615-to-r345

Then, create a pull request where the base branch is r345 and the compare/head branch is backport-11615-to-r345.

charleskorn added a commit that referenced this pull request Jun 4, 2025
…memory consumption is negative (#11615)

(cherry picked from commit 8139c71)
@charleskorn charleskorn mentioned this pull request Jun 4, 2025
1 task
charleskorn added a commit that referenced this pull request Jun 4, 2025
…memory consumption is negative (#11615) (#11622)

(cherry picked from commit 8139c71)
@mimir-github-bot
Copy link
Contributor

The backport to r341 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-11615-to-r341 origin/r341
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 8139c71bb0ee9b8c66aea781b6c4cf0c37c4e01b
# Push it to GitHub
git push --set-upstream origin backport-11615-to-r341
git switch main
# Remove the local backport branch
git branch -D backport-11615-to-r341

Then, create a pull request where the base branch is r341 and the compare/head branch is backport-11615-to-r341.

@mimir-github-bot
Copy link
Contributor

The backport to r343 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-11615-to-r343 origin/r343
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 8139c71bb0ee9b8c66aea781b6c4cf0c37c4e01b
# Push it to GitHub
git push --set-upstream origin backport-11615-to-r343
git switch main
# Remove the local backport branch
git branch -D backport-11615-to-r343

Then, create a pull request where the base branch is r343 and the compare/head branch is backport-11615-to-r343.

@mimir-github-bot
Copy link
Contributor

The backport to r344 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-11615-to-r344 origin/r344
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 8139c71bb0ee9b8c66aea781b6c4cf0c37c4e01b
# Push it to GitHub
git push --set-upstream origin backport-11615-to-r344
git switch main
# Remove the local backport branch
git branch -D backport-11615-to-r344

Then, create a pull request where the base branch is r344 and the compare/head branch is backport-11615-to-r344.

charleskorn added a commit that referenced this pull request Jun 6, 2025
…memory consumption is negative (#11615)

(cherry picked from commit 8139c71)
@charleskorn charleskorn mentioned this pull request Jun 6, 2025
1 task
charleskorn added a commit that referenced this pull request Jun 6, 2025
…memory consumption is negative (#11615)

(cherry picked from commit 8139c71)
@charleskorn charleskorn mentioned this pull request Jun 6, 2025
1 task
charleskorn added a commit that referenced this pull request Jun 6, 2025
…memory consumption is negative (#11615)

(cherry picked from commit 8139c71)
@charleskorn charleskorn mentioned this pull request Jun 6, 2025
1 task
charleskorn added a commit that referenced this pull request Jun 6, 2025
…memory consumption is negative (#11615) (#11651)

(cherry picked from commit 8139c71)
charleskorn added a commit that referenced this pull request Jun 6, 2025
…memory consumption is negative (#11615) (#11652)

(cherry picked from commit 8139c71)
charleskorn added a commit that referenced this pull request Jun 6, 2025
…memory consumption is negative (#11615) (#11653)

(cherry picked from commit 8139c71)
charleskorn added a commit that referenced this pull request Jun 17, 2025
… becomes negative (#11713)

#### What this PR does

This PR adds the trace ID (if any) to the panic message used if the
estimated memory consumption of a query becomes negative.

#### Which issue(s) this PR fixes or relates to

#11615, #11654

#### Checklist

- [x] Tests updated.
- [n/a] Documentation added.
- [covered by #10067] `CHANGELOG.md` updated - the order of entries
should be `[CHANGE]`, `[FEATURE]`, `[ENHANCEMENT]`, `[BUGFIX]`.
- [n/a]
[`about-versioning.md`](https://github.com/grafana/mimir/blob/main/docs/sources/mimir/configure/about-versioning.md)
updated with experimental features.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants