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

Improper use of 'await' can trigger full app crash #15624

Closed
ChrisHughes opened this issue Aug 23, 2017 · 4 comments
Closed

Improper use of 'await' can trigger full app crash #15624

ChrisHughes opened this issue Aug 23, 2017 · 4 comments
Labels
Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Resolution: Locked This issue was locked by the bot.

Comments

@ChrisHughes
Copy link

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

  1. react-native -v: (0.47.2)
    react-native-cli: 1.0.0
    react-native: 1000.0.0

  2. node -v:
    v6.3.1

  3. npm -v:
    4.6.1

  4. yarn --version:

Then, specify:

  • Target Platform: iOS 10.3.1 (14E8301)
  • Development Operating System: OSX 10.12.6
  • Build tools: XCode 8.3.3 (8E3004b), com.apple.pkg.CLTools_Executables 8.3.2.0.1.1492020469

Steps to Reproduce

  1. Create any new boilerplate react-native project using react-native init and run the iOS simulator app with react-native run-ios.
  2. Create an error by prefixing a command with await outside of an async function in javascript app code.
  3. In resulting 'redbox' error message, Press 'Reload JS' or Command + R once or twice and the app will crash.

In the XCode log.

F0823 13:53:30.202721 125604800 JSCExecutor.cpp:158] Check failed: *m_isDestroyed JSCExecutor::destroy() must be called before its destructor!

XCode backtrace:

Thread 1Queue : com.apple.main-thread (serial)
#0	0x000000010778cd42 in __pthread_kill ()
#1	0x00000001077c4457 in pthread_kill ()
#2	0x000000010751e88f in abort ()
#3	0x0000000101b7ffc9 in google::logging_fail() at ~/Desktop/test/AwesomeProject/node_modules/react-native/third-party/glog-0.3.4/src/logging.cc:1464
#4	0x0000000101b7ffba in google::LogMessage::Fail() at ~/Desktop/test/AwesomeProject/node_modules/react-native/third-party/glog-0.3.4/src/logging.cc:1478
#5	0x0000000101b7daba in google::LogMessage::SendToLog() at ~/Desktop/test/AwesomeProject/node_modules/react-native/third-party/glog-0.3.4/src/logging.cc:1432
#6	0x0000000101b7ea0f in google::LogMessage::Flush() at ~/Desktop/test/AwesomeProject/node_modules/react-native/third-party/glog-0.3.4/src/logging.cc:1301
#7	0x0000000101b879c8 in google::LogMessageFatal::~LogMessageFatal() at ~/Desktop/test/AwesomeProject/node_modules/react-native/third-party/glog-0.3.4/src/logging.cc:2013
#8	0x0000000101b80505 in google::LogMessageFatal::~LogMessageFatal() at ~/Desktop/test/AwesomeProject/node_modules/react-native/third-party/glog-0.3.4/src/logging.cc:2012
#9	0x0000000101bcade6 in facebook::react::JSCExecutor::~JSCExecutor() at ~/Desktop/test/AwesomeProject/node_modules/react-native/ReactCommon/cxxreact/JSCExecutor.cpp:158
#10	0x0000000101bcb195 in facebook::react::JSCExecutor::~JSCExecutor() at ~/Desktop/test/AwesomeProject/node_modules/react-native/ReactCommon/cxxreact/JSCExecutor.cpp:157
#11	0x0000000101bcb1b9 in facebook::react::JSCExecutor::~JSCExecutor() at ~/Desktop/test/AwesomeProject/node_modules/react-native/ReactCommon/cxxreact/JSCExecutor.cpp:157
#12	0x0000000101be11bd in std::__1::default_delete<facebook::react::JSExecutor>::operator()(facebook::react::JSExecutor*) const [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2537
#13	0x0000000101be1195 in std::__1::unique_ptr<facebook::react::JSExecutor, std::__1::default_delete<facebook::react::JSExecutor> >::reset(facebook::react::JSExecutor*) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2736
#14	0x0000000101be110e in std::__1::unique_ptr<facebook::react::JSExecutor, std::__1::default_delete<facebook::react::JSExecutor> >::~unique_ptr() [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2704
#15	0x0000000101be10f5 in std::__1::unique_ptr<facebook::react::JSExecutor, std::__1::default_delete<facebook::react::JSExecutor> >::~unique_ptr() [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2704
#16	0x0000000101be10e7 in facebook::react::NativeToJsBridge::~NativeToJsBridge() at ~/Desktop/test/AwesomeProject/node_modules/react-native/ReactCommon/cxxreact/NativeToJsBridge.cpp:91
#17	0x0000000101be1315 in facebook::react::NativeToJsBridge::~NativeToJsBridge() at ~/Desktop/test/AwesomeProject/node_modules/react-native/ReactCommon/cxxreact/NativeToJsBridge.cpp:88
#18	0x0000000101be1339 in facebook::react::NativeToJsBridge::~NativeToJsBridge() at ~/Desktop/test/AwesomeProject/node_modules/react-native/ReactCommon/cxxreact/NativeToJsBridge.cpp:88
#19	0x0000000101bd99de in std::__1::default_delete<facebook::react::NativeToJsBridge>::operator()(facebook::react::NativeToJsBridge*) const [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2537
#20	0x0000000101bd99b9 in std::__1::unique_ptr<facebook::react::NativeToJsBridge, std::__1::default_delete<facebook::react::NativeToJsBridge> >::reset(facebook::react::NativeToJsBridge*) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2736
#21	0x0000000101bd9956 in std::__1::unique_ptr<facebook::react::NativeToJsBridge, std::__1::default_delete<facebook::react::NativeToJsBridge> >::~unique_ptr() [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2704
#22	0x0000000101bd9946 in std::__1::unique_ptr<facebook::react::NativeToJsBridge, std::__1::default_delete<facebook::react::NativeToJsBridge> >::~unique_ptr() [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2704
#23	0x0000000101bd993e in facebook::react::Instance::~Instance() at ~/Desktop/test/AwesomeProject/node_modules/react-native/ReactCommon/cxxreact/Instance.cpp:31
#24	0x0000000101bd9a25 in facebook::react::Instance::~Instance() at ~/Desktop/test/AwesomeProject/node_modules/react-native/ReactCommon/cxxreact/Instance.cpp:27
#25	0x0000000101a2ee71 in std::__1::default_delete<facebook::react::Instance>::operator()(facebook::react::Instance*) const [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2537
#26	0x0000000101a2ee4c in std::__1::__shared_ptr_pointer<facebook::react::Instance*, std::__1::default_delete<facebook::react::Instance>, std::__1::allocator<facebook::react::Instance> >::__on_zero_shared() at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3780
#27	0x00000001020c643e in std::__1::__shared_weak_count::__release_shared() ()
#28	0x0000000101a367bc in std::__1::shared_ptr<facebook::react::Instance>::~shared_ptr() at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4605
#29	0x0000000101a27285 in std::__1::shared_ptr<facebook::react::Instance>::~shared_ptr() at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4603
#30	0x0000000101a271ca in ::-[RCTCxxBridge .cxx_destruct]() at ~/Desktop/test/AwesomeProject/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:131

Expected Behavior

App should handle the error in RedBox without crash displaying "await is a reserved message".

Actual Behavior

App crashes in Xcode with an unhandled exception due to a component not being dealloced properly.

Reproducible Demo

Cannot create a demo on Snack / Expo to replicate an iOS crash.

Additional Note

I also am getting this crash in a non-boilerplate production app when Reload JS is clicked twice with any javascript or JSX error, not just await. (just in case there isn't a connection here to async functions).

@skevy skevy added the Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. label Sep 1, 2017
@skevy
Copy link
Contributor

skevy commented Sep 1, 2017

cc @mhorowitz

@skevy
Copy link
Contributor

skevy commented Sep 7, 2017

FYI to anyone following this issue -- @javache and @mhorowitz are working on fixing this issue internally at FB. I'll update this issue when the fix lands.

@skevy
Copy link
Contributor

skevy commented Sep 11, 2017

This is fixed on master here: 7b77055

@skevy skevy closed this as completed Sep 11, 2017
@hellogerard
Copy link

hellogerard commented Nov 30, 2017

Looks same as #9308.

@facebook facebook locked as resolved and limited conversation to collaborators Sep 11, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Sep 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants