Tuesday, 12 February 2019

How to fix this crash in facebook::react::Value::toJSONString

Problem

I'm getting an annoying crash report in production, which I can't solve but I think it's related to this github issue.

The problem is that it looks like the crash is randomly appear, and not after a certain action.

I tracked down the source of the next line, which I think have to do something with the crash, but I'm not sure.

2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #11 pc 0005e669  /data/app/com.xyzor.timer-1/lib/arm/libjsc.so (JSValueCreateJSONString+72)

UPDATE:
By using addr2line I managed to follow down the stack which looks like this:

ReactCommon/jschelpers/Value.cpp#64

2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #11 pc 0005e669  /data/app/com.xyzor.timer-1/lib/arm/libjsc.so (JSValueCreateJSONString+72)

ReactCommon/cxxreact/MethodCall.cpp#21

2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #12 pc 0003b3b9  /data/app/com.xyzor.timer-1/lib/arm/libreactnativejni.so (_ZNK8facebook5react5Value12toJSONStringEj+20)

ReactCommon/cxxreact/Instance.cpp#69

2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #13 pc 00033c3b  /data/app/com.xyzor.timer-1/lib/arm/libreactnativejni.so (_ZN8facebook5react11JSCExecutor19flushQueueImmediateEONS0_5ValueE+26)

ReactCommon/cxxreact/Instance.cpp#125

2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #14 pc 00033d6f  /data/app/com.xyzor.timer-1/lib/arm/libreactnativejni.so (_ZN8facebook5react11JSCExecutor25nativeFlushQueueImmediateEjPKPK13OpaqueJSValue+86)

UPDATE:
I've created a snack demo to replicate the crash. I was able to get the same crash when i took 5 picture and saved it to a file through redux-persist.
Unfortunately this doesn't work all the time, so i added an another action which just saves a huge string to the file.

Snack demo

Questions:

If you have any advice how could i get more info out of adb logcat or other software, when the crash happens, please let me know.

Also if you had similar error before, please let me know how did you solve it and what was the cause of the crash.

Crash report:

2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #00 pc 003b3ac0  /data/app/com.xyzor.timer-1/lib/arm/libjsc.so
2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #01 pc 003b1601  /data/app/com.xyzor.timer-1/lib/arm/libjsc.so
2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #02 pc 00364861  /data/app/com.xyzor.timer-1/lib/arm/libjsc.so
2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #03 pc 0037134d  /data/app/com.xyzor.timer-1/lib/arm/libjsc.so
2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #04 pc 003706c1  /data/app/com.xyzor.timer-1/lib/arm/libjsc.so
2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #05 pc 00370e55  /data/app/com.xyzor.timer-1/lib/arm/libjsc.so
2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #06 pc 00290f71  /data/app/com.xyzor.timer-1/lib/arm/libjsc.so
2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #07 pc 00291fbd  /data/app/com.xyzor.timer-1/lib/arm/libjsc.so
2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #08 pc 002913ab  /data/app/com.xyzor.timer-1/lib/arm/libjsc.so
2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #09 pc 002908d9  /data/app/com.xyzor.timer-1/lib/arm/libjsc.so
2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #10 pc 0029402f  /data/app/com.xyzor.timer-1/lib/arm/libjsc.so
2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #11 pc 0005e669  /data/app/com.xyzor.timer-1/lib/arm/libjsc.so (JSValueCreateJSONString+72)
2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #12 pc 0003b3b9  /data/app/com.xyzor.timer-1/lib/arm/libreactnativejni.so (_ZNK8facebook5react5Value12toJSONStringEj+20)
2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #13 pc 00033c3b  /data/app/com.xyzor.timer-1/lib/arm/libreactnativejni.so (_ZN8facebook5react11JSCExecutor19flushQueueImmediateEONS0_5ValueE+26)
2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #14 pc 00033d6f  /data/app/com.xyzor.timer-1/lib/arm/libreactnativejni.so (_ZN8facebook5react11JSCExecutor25nativeFlushQueueImmediateEjPKPK13OpaqueJSValue+86)
2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #15 pc 00034ab1  /data/app/com.xyzor.timer-1/lib/arm/libreactnativejni.so
2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #16 pc 0004eda9  /data/app/com.xyzor.timer-1/lib/arm/libjsc.so
2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #17 pc 0012fa9b  /data/app/com.xyzor.timer-1/lib/arm/libjsc.so
2019-02-07 14:22:50.203 10137-10137/? A/DEBUG:     #18 pc 0012f60d  /data/app/com.xyzor.timer-1/lib/arm/libjsc.so
2019-02-07 14:22:52.073 1257-10138/? W/ActivityManager:   Force finishing activity com.xyzor.timer/host.exp.exponent.experience.ShellAppActivity
2019-02-07 14:22:52.140 1257-1272/? D/ViewRootImpl@2042207[timer]: ThreadedRenderer.create() translucent=true
2019-02-07 14:22:52.142 1257-1272/? D/WindowManager: openInputChannel mInputChannel: a585ad2 Application Error: com.xyzor.timer (server)
2019-02-07 14:22:52.144 1257-1272/? D/ViewRootImpl@2042207[timer]: setView = DecorView@83d521e[timer] touchMode=true
2019-02-07 14:22:52.162 7102-10144/? W/PkgUtils: p: com.xyzor.timer, u:0
2019-02-07 14:22:52.167 1257-1272/? D/ViewRootImpl@2042207[timer]: dispatchAttachedToWindow
2019-02-07 14:22:52.194 1257-1272/? D/ViewRootImpl@2042207[timer]: Relayout returned: oldFrame=[0,0][0,0] newFrame=[256,816][1280,1279] result=0x27 surface={isValid=true 547307523072} surfaceGenerationChanged=true
2019-02-07 14:22:52.194 1257-1272/? D/ViewRootImpl@2042207[timer]: mHardwareRenderer.initialize() mSurface={isValid=true 547307523072} hwInitialized=true
2019-02-07 14:22:52.197 1257-1272/? D/ViewRootImpl@2042207[timer]: MSG_WINDOW_FOCUS_CHANGED 1
2019-02-07 14:22:52.197 1257-1272/? D/ViewRootImpl@2042207[timer]: mHardwareRenderer.initializeIfNeeded()#2 mSurface={isValid=true 547307523072}
2019-02-07 14:22:52.209 7187-7204/? W/PkgUtils: p: com.xyzor.timer, u:0
2019-02-07 14:22:52.230 1257-1272/? D/WindowManager: finishDrawingWindow: Window{a585ad2d0 u0 Application Error: com.xyzor.timer} mDrawState=DRAW_PENDING
2019-02-07 14:22:52.231 1257-1272/? D/ViewRootImpl@2042207[timer]: MSG_RESIZED_REPORT: frame=Rect(256, 816 - 1280, 1279) ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
2019-02-07 14:22:52.236 1257-1272/? D/WindowManager: finishDrawingWindow: Window{a585ad2d0 u0 Application Error: com.xyzor.timer} mDrawState=HAS_DRAWN
2019-02-07 14:22:52.448 1257-1385/? I/WindowManager: WIN DEATH: Window{2a8ca6fd0 u0 com.xyzor.timer/host.exp.exponent.experience.ShellAppActivity}
2019-02-07 14:22:52.449 1257-1385/? D/WindowManager: disposeInputChannel mInputChannel: 2a8ca6f com.xyzor.timer/host.exp.exponent.experience.ShellAppActivity (server)
2019-02-07 14:22:52.449 1257-2210/? I/ActivityManager: Process com.xyzor.timer (pid 9982) has died(864,760)

General info:

  • I'm using Expo with Expo SDK 31 and react native 0.57.
  • I'm able to log the app through adb logcat.
  • I don't have much experience with native android development


from How to fix this crash in facebook::react::Value::toJSONString

No comments:

Post a Comment