react-native-cached-image
react-native-cached-image copied to clipboard
Random Crashes
I have presented multiple crashes in my application for many users. Currently the app has a large number of users, which makes these sporadic crashes more visible.
Following up with the help of AppSee, I realized that a large percentage of crashes are on the screens where images are loaded with this library. This affects less than 2% of the users, but they are enough to be taken into account.
I was also able to replicate them in the simulator in release mode and I was able to determine what is caused by react-native-fetch-blob
.
Main Thread Checker: UI API called on a background thread: -[UIApplication setNetworkActivityIndicatorVisible:]
PID: 7964, TID: 1935915, Thread name: (none), Queue name: NSOperationQueue 0x604000631020 (QOS: UNSPECIFIED), QoS: 0
Backtrace:
4 xxxx 0x000000010f301c43 -[RNFetchBlobNetwork URLSession:task:didCompleteWithError:] + 291
5 CFNetwork 0x0000000113e5aabf __51-[NSURLSession delegate_task:didCompleteWithError:]_block_invoke.207 + 80
6 Foundation 0x00000001127d69b7 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 7
7 Foundation 0x00000001127d681a -[NSBlockOperation main] + 68
8 Foundation 0x00000001127d4cd6 -[__NSOperationInternal _start:] + 778
9 libdispatch.dylib 0x0000000118beb43c _dispatch_client_callout + 8
10 libdispatch.dylib 0x0000000118bf0af4 _dispatch_block_invoke_direct + 592
11 libdispatch.dylib 0x0000000118beb43c _dispatch_client_callout + 8
12 libdispatch.dylib 0x0000000118bf0af4 _dispatch_block_invoke_direct + 592
13 libdispatch.dylib 0x0000000118bf0884 dispatch_block_perform + 109
14 Foundation 0x00000001127d0ce4 __NSOQSchedule_f + 342
15 libdispatch.dylib 0x0000000118beb43c _dispatch_client_callout + 8
16 libdispatch.dylib 0x0000000118bf1856 _dispatch_continuation_pop + 967
17 libdispatch.dylib 0x0000000118befc86 _dispatch_async_redirect_invoke + 780
18 libdispatch.dylib 0x0000000118bf71f9 _dispatch_root_queue_drain + 772
19 libdispatch.dylib 0x0000000118bf6e97 _dispatch_worker_thread3 + 132
20 libsystem_pthread.dylib 0x00000001190af5a2 _pthread_wqthread + 1299
21 libsystem_pthread.dylib 0x00000001190af07d start_wqthread + 13
Following this problem, I realized that the only place where react-native-fetch-blob
is as a dependency is in this library, also reviewing this module I realized that it seems that they are not maintaining it. It seems that now must be used rn-fetch-blob
https://github.com/wkh237/react-native-fetch-blob#rnfb-maintainer-gone-missing-help-wanted
I would greatly appreciate that you follow this thread, since this bookstore has been very helpful to me.
Yeah, all this stuff is fixed there, I'm using own fork which is already merged to rn-fetch-blob, but can't change react-native-fetch-blob to rn-fetch-blob cause cached-image using it so I must still use my own fork:
"react-native-fetch-blob": "github:flatfox-ag/react-native-fetch-blob#a46bf8180d76131eafe84ab44e0436322073820c",
if interested.
This way you will have native code with fixes, even cached-image dependency is for different version (and repo).
But better will be to use ready PRs repo commit:
"react-native-cached-image": "github:fungilation/react-native-cached-image#c3da553d3e5b05a0b2b2004268ce1f56fec762db",
which I will test now and probably use.
There is also yarn way:
"resolutions": {
"react-native-cached-image/react-native-fetch-blob": "github:joltup/rn-fetch-blob#2a81f32def50e7ddf98176f19d62285b77853b54"
},
but above PR also uses Promises to reject instead throwing exception in fsUtils (react-native-cached-image).
Note that to use my fork (fungilation/), change native installation in your own app to pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'
. For existing install, that involves react-native unlink
and yarn remove, and add / link again.
I'm using in my app WonderSwipe without issue.