react / react/react-native

Unhandled promises result in white screen of death (silent exceptions)

オープン
#31,115 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Issue: Author Provided Repro
主要言語
C++
スター
127k
フォーク
25.3k
平均マージ
1日 23時間
マージ済み PR(30日)
4

説明

Description

Exceptions that occur within an unhandled promise do not trigger React exception handling. This makes it impossible to track exceptions or use standard exception handling methods. We call this the white screen of death.

React Native version:

System:
    OS: macOS 11.2.2
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 646.73 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.5.0 - ~/.nvm/versions/node/v14.5.0/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.5 - ~/.nvm/versions/node/v14.5.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7042882
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_282 - /usr/bin/javac
    Python: 3.8.6+ - /Users/alitamoore/.pyenv/shims/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: ^16.13.1 => 16.13.1 
    react-native: ^0.63.4 => 0.63.4 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Build out an app with two buttons
  2. One button has the promised force crash, the other is not
  3. Press the promised force crash and you'll see a white screen
  4. Press the not promised force crash and you'll see the RED screen

Expected Results

Both buttons should show a RED screen or white screen should trigger exception handling

Snack, code example, screenshot, or link to a repository:

import { TouchableOpacity } from "react-native-gesture-handler";
import { Text, View } from "react-native-animatable";

export const forceCrash = () => {
    console.log("force crash");
    crash();
};

const forceCrashPromise = async () => forceCrash();
const forceCrashNotPromise = () => forceCrash();

const Button = () => (
    <View>
        <TouchableOpacity onPress={forceCrashPromise}>
            <Text>Force Crash Promise</Text>
        </TouchableOpacity>
        <TouchableOpacity onPress={forceCrashNotPromise}>
            <Text>Force Crash Not Promise</Text>
        </TouchableOpacity>
    </View>
);

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

提供された TypeScript の再現コードから始め、React Native アプリの Promise を使用するボタンハンドラーと使用しないボタンハンドラーを比較します。白い画面と赤い画面の動作を再現します。未処理の Promise からの例外が、直接のクラッシュと同じ可視の例外処理に到達すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
react-native, typescript
領域
mobile
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。