-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
RTCImageLoader crash when no connexion #10145
Comments
1a62b66 does not fix it for me |
experiencing the exact same bug. EXC_BAD_ACCESS at cancelLoad. very critical to us. And i don't actually have to reload the app. I just need a bad network and some re-rendering that change some images (e.g. on a searching list). I think you probably can reproduce the bug easily by loading random images and having an intensive rerendering loop. |
will do |
@pfeiffer i'm afraid that didn't fixed it to me. |
Allright. I've done some further research and I'm pretty sure the issue is in the - (void)dequeueTasks
{
dispatch_async(_URLRequestQueue, ^{
// Remove completed tasks
for (RCTNetworkTask *task in self->_pendingTasks.reverseObjectEnumerator) {
switch (task.status) {
case RCTNetworkTaskFinished:
[self->_pendingTasks removeObject:task];
self->_activeTasks--;
break;
... My objective-c is fairly limited - but I'm pretty sure that ARC can deallocate The commit that introduced these changes seem to be an automated commit (bcf4bb6) What do you think? |
@pfeiffer If you reference self in a block, ARC will actually correctly retain self from the block object until the block is released. The automated commit made the usage of self explicit, since we were previously just using the instance variable directly (which the compiler translates to a self reference under the hood). |
Got it. It might be something else, then. The crash I'm seeing in relation to
|
I managed to consistently reproduce the error on a test device. As @machard mentions, the fix in 1a62b66 doesn't (completely) solve the problem. There is an additional place where we need to check that the request hasn't already been cancelled: react-native/Libraries/Image/RCTImageLoader.m Line 508 in 1a62b66
I haven't been able to reproduce the crash after changing the condition to include if (cancelLoad && !cancelled) {
cancelLoad();
cancelLoad = nil;
}
OSAtomicOr32Barrier(1, &cancelled); Could it be a possible race condition issue, where we call |
I can confirm that this is still happening in "the wild" with 0.34 even with the patches mentioned above. |
I also have this bug. |
Experiencing same bug. |
anyone have tried if #10280 fixes this? |
@gre The crash I described in this issue does not seem to happen anymore to me :) |
What is the recommended fix until this fix is released? I have an app in production where this crash is affecting roughly 10% of users. I tried cherry-picking 26be005 into RN 0.34, but I am still getting crashes on some calls to RCTImageLoader dequeueTasks. |
@alexpolzien have you tried cherry-picking b2dac83 as well ? |
Even after cherry picking the commit @alexpolzien mentions, we were still experiencing crashes using the This might not be 100% related, but mentioning this here for future reference and perhaps more insight by others: in our case, removing the It appears that as the YMMV of course, but worth a try if you are using |
@hilkeheremans Thanks but I am not using defaultSource at all. I am, however, making pretty aggressive use of Image.prefetch, and I suspect that may be the issue - or just trying to load a lot of images over HTTP at a time in general. |
The original bug reporter has reported this issue as fixed, so I am going to close this issue. It does sound like other people might have similar problems still though. If that is the case I encourage people to open a new issue to report these new problems. Thanks! |
Issue Description
When no connexion, RTCImage loader crash on cancelling a previous load request
Steps to Reproduce / Code Snippets
I have a scrollview with network images. I disable wifi (on my real device) and relaunch the app, scroll a little (until one of the image becomes out of screen) and it crashes. it seems to come from request cancellation
Expected Results
no crash :)
Additional Information
The text was updated successfully, but these errors were encountered: