Closed gmatyszczak closed 11 months ago
Thanks for reporting this @gmatyszczak Could you provide us with a sample code/app to reproduce this so we're able to investigate it further?
We are experiencing similar crashes with one of our apps. Scudo
is reporting race on chunk header at address 0x...
and the backtraces all point to some memory corruption in PixelCopy
. Even for us the crashes seem to happen when stuff is being drawn (by Lottie, to be more specific).
Version 10.4.3 is the last known version that does not cause this memory corruption, while I know that both version 10.9.0 and 10.11.0 can crash the app. Unfortunately I'm unable to reproduce the issue reliably and I have no minimal sample to share.
Looking deeper at this I noticed that in version 10.4.3 everything involving PixelCopy
(PixelCopyDelegate
) is done on the main thread, whereas the other two perform some operations from some background thread. Maybe this what makes the race conditions possible.
Also, interacting with Views from a background thread is generally not safe. If I'm not mistaken, that's what onPixelCopyFinished
is currently doing. This could explain the IndexOutOfBoundsException
that @gmatyszczak is seeing.
I have verified that onPixelCopyFinished
is calling DecorView.draw()
from a background thread. This is causing race conditions which ultimately crash the app.
Can you please fix this? This has been broken for a long time.
@MohamedHefny I'm sorry to ping you, but you are the last active Instabug member I saw on here and I feel like this issue is not getting any attention. Do you know if anyone is looking at this?
@mhashim6 Unfortunately I'm not able to provide a reliable sample to reproduce this issue. However @gmazzotta-wise did already great job with investigating the problem more deeply, so hopefully this will be enough to get that fixed!
@gmazzotta-wise @gmatyszczak Thank you for pointing that out, We'll be looking into it and get back to you as soon as possible 🙏
@kareem-waleed thanks.
If the problem is indeed the fact that you are accessing the View hierarchy from a background thread and you are going to release a fixed version, would it be possible to also have a patch release that is based on v11.6.0
?
Version v11.7.0
and newer require updating the Google Play Core Libraries and, sadly, I am unable to do that in the short term due to some transitive dependencies I cannot update, so it would be great to have the fix backported.
@gmazzotta-wise Hello,
The issue is fixed and will be released in our next official release.
Also, as per your request, we've backported the fix to v11.6.0
.
You can use the snapshot 11.6.0.5092153-SNAPSHOT
. To use a snapshot, you'll need to add our snapshots repository to your dependencies
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
Nevertheless, we totally recommend upgrading to the latest SDK version to be up-to-date with all our features and enhancements 🙏
@gmatyszczak @gmazzotta-wise I'll close the issue now, please feel free to reopen it for further inquiries 🙏
Steps to Reproduce the Problem
In our app we have a screen with custom view, in which we do quite a lot of operations on bitmaps and drawing them on canvas. Depending on user interaction, we can change the state of that custom view and replace all drawn bitmaps with different ones. It seems that Instabug can't handle this case when there's a lot of bitmaps drawn and we change the state of that view quickly.
Expected Behavior
No crashes.
Actual Behavior
This error occurs in Logcat multiple times:
Eventually it leads to a crash:
Instabug integration code
SDK Version
11.5.0
Android Version
13 (API 33)
Device Model
Google Pixel 4a