Fix deadlock on Actix RT in Cluster Info#7267
Merged
Conversation
agourlay
commented
Sep 17, 2025
| }); | ||
| let segments = self.segments.clone(); | ||
| let hw_counter = hw_measurement_acc.get_counter_cell(); | ||
| // clone filter for spawning task |
Member
Author
There was a problem hiding this comment.
I did not find an alternative to cloning the incoming Filter as it can't be bound to 'a to be transferred to a spawned task.
agourlay
commented
Sep 17, 2025
| &'a self, | ||
| filter: Option<&'a Filter>, | ||
| hw_counter: &HardwareCounterCell, | ||
| hw_measurement_acc: &HwMeasurementAcc, |
Member
Author
There was a problem hiding this comment.
refactor to using HwMeasurementAcc as HardwareCounterCell is not Send/Sync
agourlay
commented
Sep 17, 2025
| hw_measurement_acc: HwMeasurementAcc, | ||
| ) -> CollectionResult<BTreeSet<PointIdType>> { | ||
| let stopping_guard = StoppingGuard::new(); | ||
| // cloning filter spawning task |
Member
Author
There was a problem hiding this comment.
highlighting that we already clone the filter for the same reason in read_filtered
timvisee
approved these changes
Sep 17, 2025
This was referenced Sep 18, 2025
timvisee
pushed a commit
that referenced
this pull request
Sep 29, 2025
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow up on #7265
When the Actix runtime runs on a single thread, it can be starved by blocking the running thread on a sync lock.
This happens when calling the cluster info API while:
I was able to reproduce the issue by adapting the existing deadlock test by interleaving calls to the cluster info API.
The fix is to make the underlying
estimate_cardinalityused by the cluster info non-blocking by offloading it to a dedicated blocking thread.There is a bit of refactoring:
estimate_cardinalityasyncHwMeasurementAccinstead ofHardwareCounterCellFilterto be able to spawn a task 🙈