Skip to content

Commit

Permalink
bug 1686726 - Fix lock order inversion in RLB Timing Distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
chutten committed Jan 14, 2021
1 parent 8ae896f commit 98520aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,8 @@

* Android
* A new metric `glean.validation.foreground_count` was added to the metrics ping.
* Rust
* BUGFIX: Fix lock order inversion in RLB Timing Distribution ([#1431](https://github.com/mozilla/glean/pull/1431)).

# v33.10.1 (2021-01-06)

Expand Down
16 changes: 11 additions & 5 deletions glean-core/rlb/src/private/timing_distribution.rs
Expand Up @@ -65,12 +65,18 @@ impl glean_core::traits::TimingDistribution for TimingDistributionMetric {
) -> Option<DistributionData> {
crate::block_on_dispatcher();

let inner = self.0.read().unwrap();
let queried_ping_name = ping_name
.into()
.unwrap_or_else(|| &inner.meta().send_in_pings[0]);
crate::with_glean(|glean| {
// The order of taking these locks matter. Glean must be first.
let inner = self
.0
.read()
.expect("Lock poisoned for timing distribution metric on test_get_value.");
let queried_ping_name = ping_name
.into()
.unwrap_or_else(|| &inner.meta().send_in_pings[0]);

crate::with_glean(|glean| inner.test_get_value(glean, queried_ping_name))
inner.test_get_value(glean, queried_ping_name)
})
}

fn test_get_num_recorded_errors<'a, S: Into<Option<&'a str>>>(
Expand Down

0 comments on commit 98520aa

Please sign in to comment.