Skip to content

Reorder rlock/runlock to prevent mutex locking#5633

Merged
mattdurham merged 6 commits intografana:mainfrom
mattdurham:resolve_recursive_locking
Sep 10, 2025
Merged

Reorder rlock/runlock to prevent mutex locking#5633
mattdurham merged 6 commits intografana:mainfrom
mattdurham:resolve_recursive_locking

Conversation

@mattdurham
Copy link
Copy Markdown
Contributor

@mattdurham mattdurham commented Sep 9, 2025

Removed the blocking out of iterateBlocks and depend on the parent blocking. Its not the most intuitive but this is a relatively low rate of code change to fix the issue. The alternative would be for the mutex to be only in iterate blocks a but that makes it easier to recreate the issue.

The committed offset is totally unrelated but it really jams up the logs.

@mattdurham mattdurham changed the title Commit changes to prevent mutex locking Reorder rlock/runlock to prevent mutex locking Sep 9, 2025
@mattdurham mattdurham marked this pull request as ready for review September 9, 2025 19:49
Comment thread modules/livestore/instance_search.go Outdated
return nil
}

i.blocksMtx.RLock()
Copy link
Copy Markdown
Collaborator

@joe-elliott joe-elliott Sep 9, 2025

Choose a reason for hiding this comment

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

we should leave this in iterateBlocks() and just remove the lock in QueryRange. are you saying the livestore still locks with that change?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1, I think it's simpler code if locking is in iterateBlocks()

@mattdurham mattdurham merged commit 26a7392 into grafana:main Sep 10, 2025
22 checks passed
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.

3 participants