react-native-screens: Native C++ crashes on Android 9 on React Native 0.59
We recently upgraded our app from React Native 0.56
to 0.59
and started seeing crashes when navigating between screens on a test device Pixel 3 running Android 9 - we can also reproduce on a Pixel 3 emulator.
The cashes themselves are very consistent and happen often. Disabling useScreens
on Android stops the crashes from happening. I will work on trying to create a repro project but for now all I have is the stacktrack which I apologize for in advance as I realize how unhelpful that is but thought there might be some value in opening an issue to give some visibility in case it is a general issue and not something tied to the specifics of our app setup.
The crash itself is happening in libhwui.so
2019-05-28 17:58:14.490 32395-32395/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2019-05-28 17:58:14.490 32395-32395/? A/DEBUG: Build fingerprint: 'google/crosshatch/crosshatch:9/PD1A.180720.030/4972053:user/release-keys'
2019-05-28 17:58:14.490 32395-32395/? A/DEBUG: Revision: 'MP1.0'
2019-05-28 17:58:14.490 32395-32395/? A/DEBUG: ABI: 'arm64'
2019-05-28 17:58:14.490 32395-32395/? A/DEBUG: pid: 32138, tid: 32225, name: RenderThread >>> com.bloomberg.android.plus <<<
2019-05-28 17:58:14.490 32395-32395/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20
2019-05-28 17:58:14.491 32395-32395/? A/DEBUG: Cause: null pointer dereference
2019-05-28 17:58:14.491 32395-32395/? A/DEBUG: x0 0000000000000000 x1 00000075caa43ae4 x2 0000000000000002 x3 000000751f6da518
2019-05-28 17:58:14.491 32395-32395/? A/DEBUG: x4 0000000000000110 x5 000000751f6d8f14 x6 000000751f6d8f10 x7 000000751f6d8f0c
2019-05-28 17:58:14.491 32395-32395/? A/DEBUG: x8 0000000000000000 x9 0000000000000000 x10 0000000000000000 x11 0000000000000000
2019-05-28 17:58:14.491 32395-32395/? A/DEBUG: x12 ffffffffffe961b0 x13 000000751f6ed588 x14 0000000000000000 x15 0000000000000000
2019-05-28 17:58:14.491 32395-32395/? A/DEBUG: x16 00000075cad6f1d8 x17 00000075cab140b8 x18 0000000000000001 x19 0000000000000000
2019-05-28 17:58:14.491 32395-32395/? A/DEBUG: x20 0000000000000000 x21 00000075176497e0 x22 0000000000000003 x23 0000000000000000
2019-05-28 17:58:14.491 32395-32395/? A/DEBUG: x24 0000000000000000 x25 000000751f6ed588 x26 0000000000000000 x27 0000000000000000
2019-05-28 17:58:14.491 32395-32395/? A/DEBUG: x28 0000000000000000 x29 000000751f6da4e0
2019-05-28 17:58:14.491 32395-32395/? A/DEBUG: sp 000000751f6da4d0 lr 00000075ca6d53d0 pc 00000075cab140c8
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: backtrace:
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #00 pc 00000000005320c8 /system/lib64/libhwui.so (SkSurface::getCanvas()+16)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #01 pc 00000000000f33cc /system/lib64/libhwui.so (android::uirenderer::skiapipeline::GLFunctorDrawable::onDraw(SkCanvas*)+1668)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #02 pc 000000000044e04c /system/lib64/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+352)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #03 pc 000000000044e800 /system/lib64/libhwui.so (SkLiteDL::draw(SkCanvas*) const+204)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #04 pc 000000000042f3e4 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+292)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #05 pc 000000000042f794 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+252)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #06 pc 000000000044df80 /system/lib64/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+148)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #07 pc 000000000044e800 /system/lib64/libhwui.so (SkLiteDL::draw(SkCanvas*) const+204)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #08 pc 000000000042f3e4 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+292)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #09 pc 000000000042f794 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+252)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #10 pc 000000000044df80 /system/lib64/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+148)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #11 pc 000000000044e800 /system/lib64/libhwui.so (SkLiteDL::draw(SkCanvas*) const+204)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #12 pc 000000000042f3e4 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+292)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #13 pc 000000000042f794 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+252)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #14 pc 000000000044df80 /system/lib64/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+148)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #15 pc 000000000044e800 /system/lib64/libhwui.so (SkLiteDL::draw(SkCanvas*) const+204)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #16 pc 000000000042f3e4 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+292)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #17 pc 000000000042f794 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+252)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #18 pc 000000000044df80 /system/lib64/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+148)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #19 pc 000000000044e800 /system/lib64/libhwui.so (SkLiteDL::draw(SkCanvas*) const+204)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #20 pc 000000000042f3e4 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+292)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #21 pc 000000000042f794 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+252)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #22 pc 000000000044df80 /system/lib64/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+148)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #23 pc 000000000044e800 /system/lib64/libhwui.so (SkLiteDL::draw(SkCanvas*) const+204)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #24 pc 000000000042f3e4 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+292)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #25 pc 000000000042f794 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+252)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #26 pc 000000000044df80 /system/lib64/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+148)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #27 pc 000000000044e800 /system/lib64/libhwui.so (SkLiteDL::draw(SkCanvas*) const+204)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #28 pc 000000000042f3e4 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+292)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #29 pc 000000000042f794 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+252)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #30 pc 000000000044df80 /system/lib64/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+148)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #31 pc 000000000044e800 /system/lib64/libhwui.so (SkLiteDL::draw(SkCanvas*) const+204)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #32 pc 000000000042f3e4 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+292)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #33 pc 000000000042f794 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+252)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #34 pc 000000000044df80 /system/lib64/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+148)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #35 pc 000000000044e800 /system/lib64/libhwui.so (SkLiteDL::draw(SkCanvas*) const+204)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #36 pc 000000000042f3e4 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+292)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #37 pc 000000000042f794 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+252)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #38 pc 000000000044df80 /system/lib64/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+148)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #39 pc 000000000044e800 /system/lib64/libhwui.so (SkLiteDL::draw(SkCanvas*) const+204)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #40 pc 000000000042f3e4 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+292)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #41 pc 000000000042f794 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+252)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #42 pc 000000000044df80 /system/lib64/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+148)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #43 pc 000000000044e800 /system/lib64/libhwui.so (SkLiteDL::draw(SkCanvas*) const+204)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #44 pc 000000000042f3e4 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+292)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #45 pc 000000000042f794 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+252)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #46 pc 000000000044df80 /system/lib64/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+148)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #47 pc 000000000044e800 /system/lib64/libhwui.so (SkLiteDL::draw(SkCanvas*) const+204)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #48 pc 000000000042f3e4 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+292)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #49 pc 000000000042f794 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+252)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #50 pc 000000000044df80 /system/lib64/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+148)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #51 pc 000000000044e800 /system/lib64/libhwui.so (SkLiteDL::draw(SkCanvas*) const+204)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #52 pc 000000000042f3e4 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+292)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #53 pc 000000000042f794 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+252)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #54 pc 000000000044df80 /system/lib64/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+148)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #55 pc 000000000044e800 /system/lib64/libhwui.so (SkLiteDL::draw(SkCanvas*) const+204)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #56 pc 000000000042f3e4 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+292)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #57 pc 000000000042f794 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+252)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #58 pc 000000000044df80 /system/lib64/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+148)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #59 pc 000000000044e800 /system/lib64/libhwui.so (SkLiteDL::draw(SkCanvas*) const+204)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #60 pc 000000000042f3e4 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+292)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #61 pc 000000000042f794 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+252)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #62 pc 00000000000fc17c /system/lib64/libhwui.so (android::uirenderer::skiapipeline::SkiaPipeline::renderLayersImpl(android::uirenderer::LayerUpdateQueue const&, bool, bool)+788)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #63 pc 0000000000472e04 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::SkiaPipeline::renderFrame(android::uirenderer::LayerUpdateQueue const&, SkRect const&, std::__1::vector<android::sp<android::uirenderer::RenderNode>, std::__1::allocator<android::sp<android::uirenderer::RenderNode>>> const&, bool, bool, android::uirenderer::Rect const&, sk_sp<SkSurface>)+96)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #64 pc 0000000000472050 /system/lib64/libhwui.so (android::uirenderer::skiapipeline::SkiaOpenGLPipeline::draw(android::uirenderer::renderthread::Frame const&, SkRect const&, SkRect const&, android::uirenderer::FrameBuilder::LightGeometry const&, android::uirenderer::LayerUpdateQueue*, android::uirenderer::Rect const&, bool, bool, android::uirenderer::BakedOpRenderer::LightInfo const&, std::__1::vector<android::sp<android::uirenderer::RenderNode>, std::__1::allocator<android::sp<android::uirenderer::Re
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #65 pc 00000000001072a0 /system/lib64/libhwui.so (android::uirenderer::renderthread::CanvasContext::draw()+188)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #66 pc 0000000000476ecc /system/lib64/libhwui.so (_ZNSt3__110__function6__funcIZN7android10uirenderer12renderthread13DrawFrameTask11postAndWaitEvE3$_0NS_9allocatorIS6_EEFvvEEclEv$c303f2d2360db58ed70a2d0ac7ed911b+644)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #67 pc 000000000042e380 /system/lib64/libhwui.so (android::uirenderer::WorkQueue::process()+168)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #68 pc 0000000000114620 /system/lib64/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+240)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #69 pc 000000000000f934 /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+280)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #70 pc 00000000000821e0 /system/lib64/libc.so (__pthread_start(void*)+36)
2019-05-28 17:58:14.523 32395-32395/? A/DEBUG: #71 pc 0000000000023178 /system/lib64/libc.so (__start_thread+68)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 19
- Comments: 32 (7 by maintainers)
Closing this since #607 is merged. Comment here please if the crash appears after that commit and applying workaround for
native-stack
.Same crash on Android 9:
After remove this in App.js, crash stop:
Hey @WoLewicki, thank you for taking a look and sorry for the delayed response - I’ve been very busy the last few weeks.
It looks like adding the navigation events as you suggested above has fixed the issue! I’ve tested in both debug and with a release APK and everything looks good 👍
We used a WebView wrapper so it applies to all of our WebViews:
Thanks again!
@thanakij it works, but you probably do not want to have the WebView with hardware acceleration enabled all the time. The bug happens when transitioning between screens because Android sets the screen’s layer to hardware for the duration of the transition and
WebView
havingLAYER_TYPE_NONE
at that time causes the crash to happen. So maybe subscribing to navigation events would be a way to ensure that for the time of transition, the WebView has theLAYER_TYPE_HARDWARE
, and then it changes toLAYER_TYPE_NONE
again. It would like probably something like this onnative-stack
:I am not sure if it is enough though.
Hi, can you set
renderToHardwareTextureAndroid={true}
props for WebView component to see if it resolves the crash? This is just a hypothesis but if this works, it means this is a workaround without having to wait for the settlement from react-native-webview.Btw, you may have to make sure that you didn’t set
androidHardwareAccelerationDisabled
props for WebView component.It seems that the crash is related to the
react-native-webview
and the problem with the hardware acceleration. You can see related issues here: https://github.com/react-native-community/react-native-webview/issues/1069, https://github.com/wix/react-native-navigation/issues/5702, #214. I am not sure if there exists an easy fix from the side of our library other than suggested in the #214 and it should be fixed from the side ofreact-native-webview
.We recently added:
And noticed some users were getting this issue. We were able to replicate this using the following stack:
AppStack:
Reproducable flow:
Relevant library versions:
Full Crashlytics issue:
Just to add some additional info, I don’t think it’s related to react-native-webview inherently. I’m getting similar crashes that seem to be caused by a webview created by a banner ad from @react-native-firebase/admob. This means we can’t disable hardware acceleration for the webview. Switching to a normal stack navigator from the native one fixes it as well, but adjusting the height of the banner also causes a crash, so it might be an issue with the native android webview code.
hey @manuhook, I haven’t use react-native-navigation for while, but if they have transition listeners similar to react-navigation it should be possible
I’m experiencing this issue on my Android 9.0 device as well, which is running RN 0.59.8 via Expo v34.
Crash dump:
I would really love to use this library, but I’m not sure what to do now that these crashes are apparent.
@palexs I gave up trying to use it the way it is right now, will wait for a more stable version and compatible with RN 60+
@iagorm, perhaps you could do some testing? There may be some other factors at play here