software-mansion / react-native-screens

Native navigation primitives for your React Native app.
https://docs.swmansion.com/react-native-screens/
MIT License
3.1k stars 521 forks source link

Native C++ crashes on Android 9 on React Native 0.59 #105

Closed joshjhargreaves closed 4 years ago

joshjhargreaves commented 5 years ago

We recently upgraded our app from React Native 0.56to 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)
iagormoraes commented 5 years ago

I was about to integrate this to react-navigation, but it seems we will have to wait.

joshjhargreaves commented 5 years ago

@iagorm, perhaps you could do some testing? There may be some other factors at play here

iagormoraes commented 5 years ago

I will give a try so.

iagormoraes commented 5 years ago

@joshjhargreaves, this issue here shows that RN 59.5+ deprecates ReactFragmentActivity, and this library depends on that to work properly.

palexs commented 5 years ago

@iagorm any update on the issue?

palexs commented 5 years ago

@iagorm @kmagiera Using ReactActivity instead of ReactFragmentActivity, as suggested in https://github.com/kmagiera/react-native-screens/issues/7#issuecomment-421980845 does not help - the crash still occurs.

iagormoraes commented 5 years ago

@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+

casieber commented 5 years ago

I'm seeing the same issue in a fair number of crash reports within the Google Play dashboard. All seem to be isolated to Android 9.0 as well.

bomanimc commented 5 years ago

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:

09-25 22:49:01.461 25438 25438 E crash_dump64: unknown process state: t
09-25 22:49:01.503 25438 25438 I crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
09-25 22:49:01.504  1202  1202 I /system/bin/tombstoned: received crash request for pid 24821
09-25 22:49:01.504 25438 25438 I crash_dump64: performing dump of process 24748 (target tid = 24821)
09-25 22:49:01.514 25438 25438 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
09-25 22:49:01.514 25438 25438 F DEBUG   : Build fingerprint: 'samsung/cruiserlteuc/cruiserlteatt:9/PPR1.180610.011/G892AUCS5CSH1:user/release-keys'
09-25 22:49:01.514 25438 25438 F DEBUG   : Revision: '7'
09-25 22:49:01.514 25438 25438 F DEBUG   : ABI: 'arm64'
09-25 22:49:01.514 25438 25438 F DEBUG   : pid: 24748, tid: 24821, name: RenderThread  >>> host.exp.exponent <<<
09-25 22:49:01.514 25438 25438 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20
09-25 22:49:01.514 25438 25438 F DEBUG   : Cause: null pointer dereference
09-25 22:49:01.514 25438 25438 F DEBUG   :     x0  0000000000000000  x1  00000071099a8f3c  x2  0000000000000002  x3  000000706c329e38
09-25 22:49:01.514 25438 25438 F DEBUG   :     x4  0000000000000000  x5  0000000000000001  x6  0000000000000001  x7  00000000000005a7
09-25 22:49:01.514 25438 25438 F DEBUG   :     x8  0000000000000000  x9  000000705b75bc48  x10 0000007109f13518  x11 000000705b75ac70
09-25 22:49:01.514 25438 25438 F DEBUG   :     x12 000000705b75bc48  x13 0000007109d89100  x14 5228723b342bdaed  x15 0000000000000000
09-25 22:49:01.514 25438 25438 F DEBUG   :     x16 0000007109f3b268  x17 0000007109baac4c  x18 5228723b342bdaed  x19 0000000000000000
09-25 22:49:01.514 25438 25438 F DEBUG   :     x20 0000000000000000  x21 000000704d0167e0  x22 0000000000000000  x23 0000000000000000
09-25 22:49:01.515 25438 25438 F DEBUG   :     x24 0000084000000440  x25 000000706c33e588  x26 0000000000000000  x27 0000000000000000
09-25 22:49:01.515 25438 25438 F DEBUG   :     x28 0000000000000000  x29 000000706c329e00
09-25 22:49:01.515 25438 25438 F DEBUG   :     sp  000000706c329df0  lr  00000071099b1dc4  pc  0000007109baac5c
09-25 22:49:01.537 25438 25438 F DEBUG   :
09-25 22:49:01.537 25438 25438 F DEBUG   : backtrace:
09-25 22:49:01.537 25438 25438 F DEBUG   :     #00 pc 000000000054bc5c  /system/lib64/libhwui.so (SkSurface::getCanvas()+16)
09-25 22:49:02.104  1202  1202 E /system/bin/tombstoned: Tombstone written to: /data/tombstones/tombstone_06
09-25 22:49:02.126  1610 25441 W ActivityManager: crash : host.exp.exponent,0

I would really love to use this library, but I'm not sure what to do now that these crashes are apparent.

cristianoccazinsp commented 4 years ago

I think I'm seeing the same crash:

This started to happen after an upgrade to react-native-screens and react-navigation stack (from 1.x to 2.x)

backtrace:

00 pc 00000000000f7748 /data/data/com.zinspector3/lib-0/libjsc.so (offset 0xbf000) (JSC::AccessCase::propagateTransitions(JSC::SlotVisitor&) const+16)

01 pc 0000000000143fe8 /data/data/com.zinspector3/lib-0/libjsc.so (offset 0xbf000) (JSC::PolymorphicAccess::propagateTransitions(JSC::SlotVisitor&) const+48)

02 pc 000000000012f0a8 /data/data/com.zinspector3/lib-0/libjsc.so (offset 0xbf000) (JSC::CodeBlock::propagateTransitions(JSC::ConcurrentJSLocker const&, JSC::SlotVisitor&)+556)

03 pc 0000000000139484 /data/data/com.zinspector3/lib-0/libjsc.so (offset 0xbf000) (JSC::ExecutableToCodeBlockEdge::runConstraint(JSC::ConcurrentJSLocker const&, JSC::VM&, JSC::SlotVisitor&)+40)

04 pc 000000000013900c /data/data/com.zinspector3/lib-0/libjsc.so (offset 0xbf000) (JSC::ExecutableToCodeBlockEdge::visitChildren(JSC::JSCell*, JSC::SlotVisitor&)+1044)

05 pc 00000000001fb9c4 /data/data/com.zinspector3/lib-0/libjsc.so (offset 0xbf000) (JSC::SlotVisitor::drain(WTF::MonotonicTime)::$_3::operator()(JSC::MarkStackArray&) const+324)

06 pc 00000000001f8e90 /data/data/com.zinspector3/lib-0/libjsc.so (offset 0xbf000) (JSC::SlotVisitor::drain(WTF::MonotonicTime)+132)

07 pc 00000000001f96bc /data/data/com.zinspector3/lib-0/libjsc.so (offset 0xbf000) (JSC::SlotVisitor::drainFromShared(JSC::SlotVisitor::SharedDrainMode, WTF::MonotonicTime)+580)

08 pc 00000000001e41a0 /data/data/com.zinspector3/lib-0/libjsc.so (offset 0xbf000) (WTF::SharedTaskFunctor<void (), JSC::Heap::runBeginPhase(JSC::GCConductor)::$_17>::run()+580)

09 pc 00000000006171ec /data/data/com.zinspector3/lib-0/libjsc.so (offset 0xbf000) (WTF::ParallelHelperClient::runTask(WTF::RefPtr<WTF::SharedTask<void ()>, WTF::DumbPtrTraits> const&)+40)

10 pc 0000000000617950 /data/data/com.zinspector3/lib-0/libjsc.so (offset 0xbf000) (WTF::ParallelHelperPool::Thread::work()+16)

11 pc 000000000060de7c /data/data/com.zinspector3/lib-0/libjsc.so (offset 0xbf000) (WTF::Function<void ()>::CallableWrapper<WTF::AutomaticThread::start(WTF::AbstractLocker const&)::$_0>::call()+376)

12 pc 000000000061b084 /data/data/com.zinspector3/lib-0/libjsc.so (offset 0xbf000) (WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*)+212)

13 pc 0000000000646dc8 /data/data/com.zinspector3/lib-0/libjsc.so (offset 0xbf000) (WTF::wtfThreadEntryPoint(void*)+4)

14 pc 0000000000083840 /system/lib64/libc.so (__pthread_start(void*)+36)

15 pc 0000000000023d80 /system/lib64/libc.so (__start_thread+68)

phyng commented 4 years ago

Same crash on Android 9:

03-27 21:26:34.466 19636 19636 I crash_dump32: performing dump of process 19435 (target tid = 19494)
03-27 21:26:34.504 19636 19636 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-27 21:26:34.504 19636 19636 F DEBUG   : Build fingerprint: 'Xiaomi/olivelite/olivelite:9/PKQ1.190319.001/V11.0.7.0.PCPCNXM:user/release-keys'
03-27 21:26:34.505 19636 19636 F DEBUG   : Revision: '0'
03-27 21:26:34.505 19636 19636 F DEBUG   : ABI: 'arm'
03-27 21:26:34.505 19636 19636 F DEBUG   : pid: 19435, tid: 19494, name: RenderThread  >>> com.demlution.dwapp <<<
03-27 21:26:34.505 19636 19636 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x1c
03-27 21:26:34.505 19636 19636 F DEBUG   : Cause: null pointer dereference
03-27 21:26:34.505 19636 19636 F DEBUG   :     r0  00000000  r1  9c4f3640  r2  aa2b6465  r3  00000000
03-27 21:26:34.505 19636 19636 F DEBUG   :     r4  00000000  r5  00000000  r6  61d097e0  r7  00000002
03-27 21:26:34.505 19636 19636 F DEBUG   :     r8  00000000  r9  00000300  r10 aa7f4028  r11 00000000
03-27 21:26:34.505 19636 19636 F DEBUG   :     ip  aa7f2618  sp  889f2f90  lr  aa411243  pc  aa5bfa34
03-27 21:26:34.591 19636 19636 F DEBUG   : 
03-27 21:26:34.591 19636 19636 F DEBUG   : backtrace:
03-27 21:26:34.591 19636 19636 F DEBUG   :     #00 pc 003d1a34  /system/lib/libhwui.so (SkSurface::getCanvas()+4)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #01 pc 0022323f  /system/lib/libhwui.so (android::uirenderer::skiapipeline::GLFunctorDrawable::onDraw(SkCanvas*)+1070)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #02 pc 0020612b  /system/lib/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+214)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #03 pc 00206a01  /system/lib/libhwui.so (SkLiteDL::draw(SkCanvas*) const+152)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #04 pc 001f49f1  /system/lib/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+1084)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #05 pc 0008744f  /system/lib/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+266)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #06 pc 002060b9  /system/lib/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+100)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #07 pc 00206a01  /system/lib/libhwui.so (SkLiteDL::draw(SkCanvas*) const+152)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #08 pc 001f49f1  /system/lib/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+1084)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #09 pc 0008744f  /system/lib/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+266)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #10 pc 002060b9  /system/lib/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+100)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #11 pc 00206a01  /system/lib/libhwui.so (SkLiteDL::draw(SkCanvas*) const+152)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #12 pc 001f49f1  /system/lib/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+1084)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #13 pc 0008744f  /system/lib/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+266)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #14 pc 002060b9  /system/lib/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+100)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #15 pc 00206a01  /system/lib/libhwui.so (SkLiteDL::draw(SkCanvas*) const+152)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #16 pc 001f49f1  /system/lib/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+1084)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #17 pc 0008744f  /system/lib/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+266)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #18 pc 002060b9  /system/lib/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+100)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #19 pc 00206a01  /system/lib/libhwui.so (SkLiteDL::draw(SkCanvas*) const+152)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #20 pc 001f49f1  /system/lib/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+1084)
03-27 21:26:34.591 19636 19636 F DEBUG   :     #21 pc 0008744f  /system/lib/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+266)
03-27 21:26:34.592 19636 19636 F DEBUG   :     #22 pc 002060b9  /system/lib/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+100)
03-27 21:26:34.592 19636 19636 F DEBUG   :     #23 pc 00206a01  /system/lib/libhwui.so (SkLiteDL::draw(SkCanvas*) const+152)
03-27 21:26:34.592 19636 19636 F DEBUG   :     #24 pc 001f49f1  /system/lib/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+1084)
03-27 21:26:34.592 19636 19636 F DEBUG   :     #25 pc 0008744f  /system/lib/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+266)
03-27 21:26:34.592 19636 19636 F DEBUG   :     #26 pc 002060b9  /system/lib/libhwui.so (SkDrawable::draw(SkCanvas*, SkMatrix const*)+100)
03-27 21:26:34.592 19636 19636 F DEBUG   :     #27 pc 00206a01  /system/lib/libhwui.so (SkLiteDL::draw(SkCanvas*) const+152)
03-27 21:26:34.592 19636 19636 F DEBUG   :     #28 pc 001f49f1  /system/lib/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::drawContent(SkCanvas*) const+1084)
03-27 21:26:34.592 19636 19636 F DEBUG   :     #29 pc 0008744f  /system/lib/libhwui.so (android::uirenderer::skiapipeline::RenderNodeDrawable::forceDraw(SkCanvas*)+266)
03-27 21:26:34.592 19636 19636 F DEBUG   :     #30 pc 0022aa85  /system/lib/libhwui.so (android::uirenderer::skiapipeline::SkiaPipeline::renderLayersImpl(android::uirenderer::LayerUpdateQueue const&, bool, bool)+252)
03-27 21:26:34.592 19636 19636 F DEBUG   :     #31 pc 0022b7db  /system/lib/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>)+42)
03-27 21:26:34.592 19636 19636 F DEBUG   :     #32 pc 001f5363  /system/lib/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::RenderNode>>
03-27 21:26:34.592 19636 19636 F DEBUG   :     #33 pc 00231edd  /system/lib/libhwui.so (android::uirenderer::renderthread::CanvasContext::draw()+780)
03-27 21:26:34.592 19636 19636 F DEBUG   :     #34 pc 001f6e3d  /system/lib/libhwui.so (_ZNSt3__110__function6__funcIZN7android10uirenderer12renderthread13DrawFrameTask11postAndWaitEvE3$_0NS_9allocatorIS6_EEFvvEEclEv$c303f2d2360db58ed70a2d0ac7ed911b+636)
03-27 21:26:34.592 19636 19636 F DEBUG   :     #35 pc 0021a553  /system/lib/libhwui.so
03-27 21:26:34.592 19636 19636 F DEBUG   :     #36 pc 002390d9  /system/lib/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+312)
03-27 21:26:34.592 19636 19636 F DEBUG   :     #37 pc 0000c6af  /system/lib/libutils.so (android::Thread::_threadLoop(void*)+202)
03-27 21:26:34.592 19636 19636 F DEBUG   :     #38 pc 00071501  /system/lib/libc.so (__pthread_start(void*)+22)
03-27 21:26:34.592 19636 19636 F DEBUG   :     #39 pc 0001de85  /system/lib/libc.so (__start_thread+24)
"dependencies": {
    "@expo/vector-icons": "~10.0.0",
    "@react-native-community/masked-view": "0.1.5",
    "@react-navigation/bottom-tabs": "^5.0.0",
    "@react-navigation/native": "^5.0.0",
    "@react-navigation/stack": "^5.0.0",
    "@react-navigation/web": "~1.0.0-alpha.9",
    "expo": "~36.0.0",
    "expo-asset": "~8.0.0",
    "expo-constants": "~8.0.0",
    "expo-font": "~8.0.0",
    "expo-web-browser": "~8.0.0",
    "react": "~16.9.0",
    "react-dom": "~16.9.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
    "react-native-gesture-handler": "~1.5.0",
    "react-native-safe-area-context": "0.6.0",
    "react-native-screens": "2.0.0-alpha.12",
    "react-native-web": "~0.11.7",
    "react-native-webview": "7.4.3"
},

After remove this in App.js, crash stop:

import { enableScreens } from 'react-native-screens'
enableScreens()
WoLewicki commented 4 years ago

Does the issue still exist in the newest versions of library? And if so, can you provide a repo with minimal configuration needed to reproduce the issue?

cristianoccazinsp commented 4 years ago

I'm definitely still seeing crashes, but much less often than before.

SMJ93 commented 4 years ago

We recently added:

import {enableScreens} from 'react-native-screens';
enableScreens();

And noticed some users were getting this issue. We were able to replicate this using the following stack:

AppStack:

Reproducable flow:

Relevant library versions:

"@react-navigation/bottom-tabs": "5.6.1",
"@react-navigation/native": "5.6.1",
"@react-navigation/stack": "5.6.2",
"react-native": "0.62.2",
"react-native-screens": "2.9.0",

Full Crashlytics issue:

We detected a new fatal issue in libhwui.so: unknown

Crashed: Thread: SIGSEGV  0x0000000000000020
       at (Missing)()
       at (Missing)()
       at (Missing)()
       at (Missing)()
       at (Missing)()
       at (Missing)()
       at (Missing)()
       at (Missing)()
       at (Missing)()
       at (Missing)()
       at (Missing)()
       at (Missing)()
       at (Missing)()
       at (Missing)()
WoLewicki commented 4 years ago

@SMJ93 can you provide a repo/snack with minimal configuration needed to reproduce the issue? It would be very useful for solving the issue.

WoLewicki commented 4 years ago

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 of react-native-webview.

thanakij commented 4 years ago

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.

WoLewicki commented 4 years ago

@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 having LAYER_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 the LAYER_TYPE_HARDWARE, and then it changes to LAYER_TYPE_NONE again. It would like probably something like this on native-stack:

  const [hardware, setHardware] = React.useState(false);

  React.useEffect(() => {
    const unsubscribe = navigation.addListener('transitionStart', ({data}) => {
      if (data.closing) {
        setHardware(true);
      }
    });

    return unsubscribe;
  }, [navigation]);

  React.useEffect(() => {
    const unsubscribe = navigation.addListener('transitionEnd', ({data}) => {
      if (!data.closing) {
        setHardware(false);
      }
    });

    return unsubscribe;
  }, [navigation]);

    ...
   <WebView renderToHardwareTextureAndroid={hardware} ...

I am not sure if it is enough though.

thanakij commented 4 years ago

I could not agree more. Your solution is much cleaner. Do you have a chance to test this in production with Crashlytics?

@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 having LAYER_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 the LAYER_TYPE_HARDWARE, and then it changes to LAYER_TYPE_NONE again. It would like probably something like this on native-stack:

  const [hardware, setHardware] = React.useState(false);

  React.useEffect(() => {
    const unsubscribe = navigation.addListener('transitionStart', ({data}) => {
      if (data.closing) {
        setHardware(true);
      }
    });

    return unsubscribe;
  }, [navigation]);

  React.useEffect(() => {
    const unsubscribe = navigation.addListener('transitionEnd', ({data}) => {
      if (!data.closing) {
        setHardware(false);
      }
    });

    return unsubscribe;
  }, [navigation]);

  ...
   <WebView renderToHardwareTextureAndroid={hardware} ...

I am not sure if it is enough though.

WoLewicki commented 4 years ago

If someone from the thread could apply this setup in the app to test if this solution works, it would be great. @SMJ93 could you check if subscribing to navigation events resolves the issue?

SMJ93 commented 4 years ago

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:

import React, {useState, useEffect} from 'react';
import {WebView as RNWebview} from 'react-native-webview';
import {ViewStyle, View} from 'react-native';
import {useNavigation} from '@react-navigation/native';

import {LoadingSpinner} from '@app/component-library';

import styles from './styles';

interface Props {
  uri: string;
  style?: ViewStyle;
}

export default function Webview({uri, style}: Props) {
  const navigation = useNavigation<any>();
  const [loading, setLoading] = useState(true);
  const [hardware, setHardware] = React.useState(false);

  useEffect(() => {
    const unsubscribe = navigation.addListener('transitionStart', ({data}) => {
      if (data.closing) {
        setHardware(true);
      }
    });

    return unsubscribe;
  }, [navigation]);

  useEffect(() => {
    const unsubscribe = navigation.addListener('transitionEnd', ({data}) => {
      if (!data.closing) {
        setHardware(false);
      }
    });

    return unsubscribe;
  }, [navigation]);

  const onLoad = () => setLoading(false);

  return (
    <>
      <RNWebview
        onLoad={onLoad}
        source={{uri}}
        renderToHardwareTextureAndroid={hardware}
        style={style}
      />
      {loading && (
        <View style={styles.loadingSpinnerContainer}>
          <LoadingSpinner />
        </View>
      )}
    </>
  );
}

Thanks again!

manuhook commented 4 years ago

Hey @SMJ93, thank you for your help, do you think it's possible to have a similar wrapper on react-native-navigation ?

SMJ93 commented 4 years ago

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

WoLewicki commented 4 years ago

Closing this since #607 is merged. Comment here please if the crash appears after that commit and applying workaround for native-stack.

spsaucier-bakkt commented 3 years ago

We are still getting this crash, and while androidHardwareAccelerationDisabled helped on some devices, it also crashed at least some simulators. We have ended up removing react-native-screens for now, as it has caused a panoply of hard-to-debug issues.

WoLewicki commented 3 years ago

Can you provide a test example in TestsExample project (https://github.com/software-mansion/react-native-screens/tree/master/TestsExample) with minimal configuration needed to reproduce the issue? It would be very helpful in debugging the problem.

Un3qual commented 3 years ago

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.

melbeltagy commented 3 years ago

@Un3qual There was an issue with android webview (https://www.bbc.com/news/technology-56496783) that caused different applications, gmail and facebook, to crash on Android. The issue was fixed on latest update (released Mar 22nd, 2021). I suggest updating your devices' webview and retry.

ddikodroid commented 2 years ago

Closing this since #607 is merged. Comment here please if the crash appears after that commit and applying workaround for native-stack.

still facing this error on 2022

"@react-navigation/native": "^6.0.11",
"@react-navigation/native-stack": "^6.7.0",
"react-native-screens": "^3.15.0",
"react-native-webview": "^11.22.7",
NoatToan commented 2 years ago

I found that this issues still exists. my package.json:

 "react-native-screens": "^3.4.0",
 "react-native-webview": "^11.23.1",

Solution: I made sure the scrollview was rendered by using setTimeout basically. Render webview after that to solve issue. image

marf commented 1 year ago

The issue is still present for us. Any ways to fix it? Unfortunately we have ads in our app which use the WebView and we have no direct control over them :(

andreialecu commented 1 year ago

I made a repro in https://github.com/react-native-webview/react-native-webview/pull/2771 for an identical crash that does not use react-native-screens at all. It's not even a dependency there.

I'm not sure where this problem lies but it would be great for someone with deeper experience in Android development to take a look.

I believe that adding react-native-screens does make the problem even worse though, increasing the frequency of crashes.