react-native icon indicating copy to clipboard operation
react-native copied to clipboard

a crash in RCTImageLoader caused by nil response

Open rqwj opened this issue 10 years ago • 12 comments

the crash info is below and I find a similar issue at #1850

Thread 45 Crashed:
0   CoreFoundation                      CFRetain + 176
1   CFNetwork                           __CFCachedURLResponse::__CFCachedURLResponse(_CFURLResponse*, __CFData const*, void const*, CFURLCacheStoragePolicy) + 80
2   CFNetwork                           CFCachedURLResponseCreateWithUserInfo + 124
3   CFNetwork                           -[NSCachedURLResponse initWithResponse:data:userInfo:storagePolicy:] + 308
4   imeituan                            __93-[RCTImageLoader loadImageOrDataWithTag:size:scale:resizeMode:progressBlock:completionBlock:]_block_invoke_2178 (RCTImageLoader.m:324)

rqwj avatar Apr 13 '16 08:04 rqwj

upgrade react-native 0.20+

hufeng avatar Apr 15 '16 15:04 hufeng

Can you post the code which causes this error? Also try updating to the latest react-native version and see if it fixes the issue.

satya164 avatar Apr 16 '16 20:04 satya164

my crash is in 0.19.0 but the problem seems not fixed yet, the code below is copied from development branch `

    // Cache the response
    // TODO: move URL cache out of RCTImageLoader into its own module
    BOOL isHTTPRequest = [request.URL.scheme hasPrefix:@"http"];
    [strongSelf->_URLCache storeCachedResponse:
     [[NSCachedURLResponse alloc] initWithResponse:response
                                              data:data
                                          userInfo:nil
                                     storagePolicy:isHTTPRequest ? NSURLCacheStorageAllowed: NSURLCacheStorageAllowedInMemoryOnly]
                                    forRequest:request];
    // Process image data
    processResponse(response, data, nil);

    //clean up
    [weakSelf dequeueTasks];

`

rqwj avatar Apr 19 '16 09:04 rqwj

Hey, would you mind clarifying a bit?

my crash is in 0.19.0 & but the problem seems not fixed yet

If you could try 0.24, that'd help! (as per @hufeng suggestion)

the code below is copied from development branch

We don't have development branch in react-native, did you mean your local repo?

grabbou avatar Apr 20 '16 21:04 grabbou

sorry,the code is copied from master branch. we have upgraded to 0.23 but the app have not uploaded to appstore. I'm afraid that the issue will be occured again. so I post this issue here.

rqwj avatar Apr 21 '16 03:04 rqwj

any more response?

rqwj avatar Apr 27 '16 08:04 rqwj

crash mant times

rainer-liao avatar Jul 01 '16 12:07 rainer-liao

I've received a number of separate crash reports from this file. Could this be the issue?

RCTImageLoader.m line 458 in __100-RCTImageLoader loadImageOrDataWithURLRequest:size:scale:resizeMode:progressBlock:completionBlock:_block_invoke.242
RCTImageLoader.m line 467 in __100-RCTImageLoader loadImageOrDataWithURLRequest:size:scale:resizeMode:progressBlock:completionBlock:_block_invoke.249
RCTImageLoader.m line 426 in __100-RCTImageLoader loadImageOrDataWithURLRequest:size:scale:resizeMode:progressBlock:completionBlock:_block_invoke.214

tomauty avatar Aug 02 '16 17:08 tomauty

We are also experiencing this crash intermittently. Under what exact set of circumstances is unclear. We are on .30.

We've attempted to mitigate using this patch (mentioned higher in this issue): https://github.com/fadils/react-native/commit/de215d119da29c171a83f696eafa591689c8923d but we are still receiving crash reports.

Here is the stack trace:

Crashed: NSOperationQueue 0x175d3ce0 :: NSOperation 0x18888730 (QOS: USER_INITIATED) 0 libobjc.A.dylib 0x2375868a objc_retain + 9 1 Curse 0x45011b 100-[RCTImageLoader loadImageOrDataWithURLRequest:size:scale:resizeMode:progressBlock:completionBlock:]_block_invoke.216 + 4317467 2 Curse 0x456555 -[RCTNetworkTask URLRequest:didCompleteWithError:] + 4343125 3 Curse 0x456dbb __50-[RCTFileRequestHandler sendRequest:withDelegate:]_block_invoke + 4345275 4 Foundation 0x2479684d __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK + 8 5 Foundation 0x246f787f -[NSBlockOperation main] + 146 6 Foundation 0x246e9f8f -[__NSOperationInternal _start:] + 774 7 Foundation 0x24798b0d __NSOQSchedule_f + 192 8 libdispatch.dylib 0x23b1de7f _dispatch_queue_drain + 1762 9 libdispatch.dylib 0x23b16e17 _dispatch_queue_invoke + 282 10 libdispatch.dylib 0x23b1f20d _dispatch_root_queue_drain + 400 11 libdispatch.dylib 0x23b1f07b _dispatch_worker_thread3 + 94 12 libsystem_pthread.dylib 0x23cb2e0d _pthread_wqthread + 1024 13 libsystem_pthread.dylib 0x23cb29fc start_wqthread + 8

conover avatar Aug 08 '16 16:08 conover

same issue as @conover

we are on 27.2 looking to upgrade to 0.31 to hopefully fix this issue

basketofsoftkittens avatar Aug 16 '16 19:08 basketofsoftkittens

I'm using RN 0.32 and I get these crashes all the time. It's so annoying, and because of this bug I cannot push this app into production. This is so unreliable.

pavlelekic avatar Sep 06 '16 11:09 pavlelekic

It looks like this issue has become a bunch of related but not identical bugs, and at least some of them are fixed, ie https://github.com/facebook/react-native/pull/1852 . So I'm not sure how to make progress on this, and I think I should close this issue. If someone can reproduce this sort of crash on a small sample app then I do think we could make progress on it and in that case it would be great if people open a new issue with the information needed to reproduce.

lacker avatar Oct 25 '16 01:10 lacker