android / android/performance-samples

JankStatsAggregator.issueJankReport concurrency issues

Aperta
#309 1 commento 1 reazione 1 assegnatario Rivendicata da @AjeshRPai Vedi su GitHub
Lingua principale
Kotlin
Stelle
1.4k
Fork
250
Merge medio
9m
PR unite (30g)
4

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.