Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JankStatsAggregator.issueJankReport concurrency issues #309

Open
tommybart opened this issue Jan 8, 2025 · 1 comment
Open

JankStatsAggregator.issueJankReport concurrency issues #309

tommybart opened this issue Jan 8, 2025 · 1 comment
Assignees

Comments

@tommybart
Copy link

tommybart commented Jan 8, 2025

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.

@keyboardsurfer
Copy link
Member

Thank you for reporting this issue. It doesn't look like an issue with this sample but the library itself.
Please add the details requested to an issue on the product issue tracker.

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

No branches or pull requests

3 participants