Skip to content

Android: "FATAL EXCEPTION: mqt_js" / Error calling function: RCTDeviceEventEmitter:emit / - malformed JSON parsing in RN's android native code #10756

@GeoffreyPlitt

Description

@GeoffreyPlitt

Description

Calling fetch() and expecting JSON results (i.e. using response.json()) will crash if server sends malformed JSON. Error/logging system prints "Failed to create String from JSON:" and then does NOT print the JSON (the problem this ticket IS about).

#9117 promised to fix this, but did not.

Reproduction

Call fetch() and then response.json() with a server that returns bad JSON.

Additional Information

  • React Native version: 0.36
  • Platform: Android
  • Operating System: MacOS

Here's an example log:

11-04 13:39:46.611  3509  3509 D EPDG -- [EPDGService]: onDataActivity: direction=3
11-04 13:39:46.611  7541  7836 D NetworkController.MobileSignalController(0/2): onDataActivity: direction=3
11-04 13:39:46.781 17917 17917 V MediaPlayer-JNI: getCurrentPosition: 617 (msec)
11-04 13:39:47.031 17917 17917 V MediaPlayer-JNI: getCurrentPosition: 617 (msec)
11-04 13:39:47.281 17917 17917 V MediaPlayer-JNI: getCurrentPosition: 617 (msec)
11-04 13:39:47.541 17917 17917 V MediaPlayer-JNI: getCurrentPosition: 617 (msec)
11-04 13:39:47.641  3509  3509 D EPDG -- [EPDGService]: onDataActivity: direction=1
11-04 13:39:47.641  7541  7836 D NetworkController.MobileSignalController(0/2): onDataActivity: direction=1
11-04 13:39:47.791 17917 17917 V MediaPlayer-JNI: getCurrentPosition: 617 (msec)
11-04 13:39:47.821 17917 17976 I System.out: (HTTPLog)-Static: isSBSettingEnabled false
11-04 13:39:47.821 17917 17976 I System.out: (HTTPLog)-Static: isSBSettingEnabled false
11-04 13:39:47.821  3079  3883 D EnterpriseController: netId is 0
11-04 13:39:47.821  3079  3883 D Netd    : getNetworkForDns: using netid 507 for uid 10726
11-04 13:39:47.821 17917 17968 E AndroidRuntime: FATAL EXCEPTION: mqt_js
11-04 13:39:47.821 17917 17968 E AndroidRuntime: Process: com.stardust, PID: 17917
11-04 13:39:47.821 17917 17968 E AndroidRuntime: java.lang.RuntimeException: Error calling function: RCTDeviceEventEmitter:emit
11-04 13:39:47.821 17917 17968 E AndroidRuntime: 	at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
11-04 13:39:47.821 17917 17968 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:739)
11-04 13:39:47.821 17917 17968 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:95)
11-04 13:39:47.821 17917 17968 E AndroidRuntime: 	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
11-04 13:39:47.821 17917 17968 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:158)
11-04 13:39:47.821 17917 17968 E AndroidRuntime: 	at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
11-04 13:39:47.821 17917 17968 E AndroidRuntime: 	at java.lang.Thread.run(Thread.java:818)
11-04 13:39:47.821 17917 17968 E AndroidRuntime: Caused by: java.lang.RuntimeException: Failed to create String from JSON: 
11-04 13:39:47.821 17917 17968 E AndroidRuntime: 	... 7 more
11-04 13:39:47.841  3509  4040 W ActivityManager:   Force finishing activity com.stardust/.MainActivity
11-04 13:39:47.851  3509  4040 D FocusedStackFrame: Set to : 0
11-04 13:39:47.851  3509  4040 D InputDispatcher: Focused application set to: xxxx
11-04 13:39:47.861  3509  4040 D InputDispatcher: Focus left window: 17917
11-04 13:39:47.861  3509  3638 D PointerIcon: setMouseIconStyle1 pointerType: 1001 iconType:101 flag:0 pid:3509 uid:1000
11-04 13:39:47.861  3509  3638 D PointerIcon: setMouseCustomIcon IconType is same.101
11-04 13:39:47.931  3509 18371 E android.os.Debug: ro.product_ship = true
11-04 13:39:47.931  3509 18371 E android.os.Debug: ro.debug_level = 0x4f4c
11-04 13:39:47.931  3509 18371 E android.os.Debug: sys.mobilecare.preload = false
11-04 13:39:47.971  3509  3610 D ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{5822614 V.E...... R.....I. 0,0-0,0}
11-04 13:39:47.981  3509  3610 D ISSUE_DEBUG: InputChannelName : 1cdbcb2 Application Error: com.stardust
11-04 13:39:47.981  3509  3610 V MARsPolicyManager: handelAlertToastWindowStarted pkgName = android
11-04 13:39:47.981  3509  3610 D InputDispatcher: Focus entered window: 3509
11-04 13:39:47.981  3509  3638 D PointerIcon: setMouseIconStyle1 pointerType: 1001 iconType:101 flag:0 pid:3509 uid:1000
11-04 13:39:47.981  3509  3638 D PointerIcon: setMouseCustomIcon IconType is same.101
11-04 13:39:47.991  3067  3067 I SurfaceFlinger: id=2946 createSurf (193x193),1 flag=4, ttardust
11-04 13:39:48.001 18372 18372 E Zygote  : v2
11-04 13:39:48.001 18372 18372 I libpersona: KNOX_SDCARD checking this for 1000
11-04 13:39:48.001  3509  3609 I ActivityManager: Start proc 18372:com.samsung.android.sm/1000 for broadcast-3 com.samsung.android.sm/.common.SmartManagerReceiver
11-04 13:39:48.001 18372 18372 I libpersona: KNOX_SDCARD not a persona

Questions:

  • What do we have to do to actually include the JSON so we can get to the bottom of this?
  • Why does it say "... 7 more" ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugPlatform: AndroidAndroid applications.Ran CommandsOne of our bots successfully processed a command.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions