Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
alita-moore opened this issue Mar 8, 2021 · 5 comments
Open
Labels
Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project.

Comments

@alita-moore
Copy link

alita-moore commented Mar 8, 2021

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>
);
@alita-moore alita-moore changed the title Unhandled promises result in white screen of death (untrackable) Unhandled promises result in white screen of death (silent) Mar 8, 2021
@chrisglein
Copy link

Any reason you're using components from react-native-gesture-handler and react-native-animatable? The ones you're using should be in core.
In your example crash is undefined. How are you generating the crash?
Can you put this into a Snack? I tried to repro here: https://snack.expo.io/ZyZ-mtelk
Is this on a specific platform (Android or iOS) or both?

@chrisglein chrisglein added Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. and removed Needs: Triage 🔍 labels Mar 9, 2021
@github-actions
Copy link

github-actions bot commented Mar 9, 2021

⚠️ Missing Reproducible Example
ℹ️ It looks like your issue is missing a reproducible example. Please provide a Snack or a repository that demonstrates the issue you are reporting in a minimal, complete, and reproducible manner.

@alita-moore
Copy link
Author

alita-moore commented Mar 9, 2021

@chrisglein crash is not defined on purpose, the app should crash when the button is pushed.

https://snack.expo.io/@alita-moore/repro31115

import * as React from 'react';
import { Text, View, StyleSheet, TouchableOpacity } from 'react-native';

export const forceCrash = () => {
    crash();
};

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

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

export default function App() {
  return (
    <Button/>
  );
}

If you click Crash Not Promise
that

If you click Crash Promise
this

Notably, on the actual device the screen goes white but the point is despite the unhandled exception, the regular exception handling is not triggered

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Mar 9, 2021
@alita-moore alita-moore changed the title Unhandled promises result in white screen of death (silent) Unhandled promises result in white screen of death (silent exceptions) Mar 9, 2021
@chrisglein chrisglein added Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. and removed Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Mar 9, 2021
@alita-moore
Copy link
Author

@chrisglein have you had a chance to look into this?

@chrisglein
Copy link

@alita-moore No expertise I can lend here. Just trying to help triage incoming issues so they have the best chance of success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project.
Projects
None yet
Development

No branches or pull requests

2 participants