-
-
Notifications
You must be signed in to change notification settings - Fork 493
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
IOOB exception when using DiffUtil on separate thread #984
Comments
Thank you so much for writing up the separate ticket @boguszpawlowski This problem is a very interesting one in it's base as it results due to inconsistencies in different threads, which the RV absolutely does not like. Any help to debug this or open a PR with a solution is apprecaited |
Hello there So we've been facing this crash also with DIffUtil and looks like the issue in the @mikepenz happy to open a PR with that approach but that will change the exposed methods in the FastAdapterDIffUtil class as the set methods doesn't have the new list of items |
@AhmedGamal92 that sounds indeed like a good point. RV's don't appreciate it if changes are done while other changes get posted. Is it a possibility to only do changes via the Based on your proposal, have you experimented doing the change to move the |
Yes that was the idea, the place that does these extra changes is the
Yes I did that and I see the exception is no longer happening, also tried in the activity mentioned in the issue and can't reproduce after. |
Hello! Any updates on this issue? |
About this issue
When using FastAdapterDiffUtil.calculateDiff() on any thread different from Main, there is a chance of IndexOutOfBoundsException being thrown. It is reproducible on modified
DiffUtilActivity
from FastAdapter's sample:https://github.com/boguszpawlowski/FastAdapter/blob/diffutil_bug/app/src/main/java/com/mikepenz/fastadapter/app/DiffUtilActivity.kt
Steps to reproduce:
Observations:
My conclusion: If diff calculation is happening at the same time as some changes on the screen (user interaction, change in view hierarchy), and is done concurrently, due to item list modified and read on different threads, crash can happen.
Details
Checklist
Similar/Connected issues:
#772 - potential solution
#959 - key difference is that I'm NOT using
Objects.hash
for creating id, they are 100% stable and unique.The text was updated successfully, but these errors were encountered: