android / android/performance-samples

JankStatsAggregator.issueJankReport concurrency issues

Offen
#309 1 Kommentar 1 Reaktion 1 zugewiesene Person Beansprucht von @AjeshRPai Auf GitHub ansehen
Vorherrschende Sprache
Kotlin
Sterne
1.4k
Forks
250
Ø Merge
9 Min.
Gemergte PRs (30 T.)
4

Beschreibung

The example JankStatsAggregator class can produce `ConcurrentModificationException` for listeners that perform some additional operations on it. Presumably because of how FrameData objects are internally mutated.

It appears that JankStatsAggregator.issueJankReport attempts to account for that with copies, but it may not be fully thread safe.

For example:

```
private val reportListener = JankStatsAggregator.OnJankReportListener { _, _, jankFrameData ->
jankFrameData.filter(...).map { frame ->
// Do something with FrameData and/or StateInfo
}
}
```

This usage results in rare concurrency exceptions. I'm not sure if it is a misusage on my end, but as a user I would expect the listener to be thread safe.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.