question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

iOS crash, only release from testflight or archive build

See original GitHub issue

šŸ› Bug Report

Crash on launch. Here is the relevant log:

Thread 6 Crashed:
0   libsystem_kernel.dylib        	0x00000002388a5104 __pthread_kill + 8
1   libsystem_pthread.dylib       	0x0000000238924a00 pthread_kill$VARIANT$armv81 + 296
2   libsystem_c.dylib             	0x00000002387fcd78 abort + 140
3   libsystem_malloc.dylib        	0x00000002388f9768 _malloc_put + 0
4   libsystem_malloc.dylib        	0x00000002388f9924 malloc_report + 64
5   libsystem_malloc.dylib        	0x00000002388ec2d0 free + 376
6   libc++.1.dylib                	0x0000000237ea7120 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string+ 258336 () + 32
7   ExampleApp                 	0x00000001053cd494 std::__1::__vector_base<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >::~__vector_base() + 5264532 (vector:451)
8   ExampleApp                 	0x00000001059c8f04 facebook::react::ModuleRegistry::getConfig+ 11538180 (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 100
9   ExampleApp                 	0x00000001059d7e58 facebook::react::JSCNativeModules::createModule+ 11599448 (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, OpaqueJSContext const*) + 292
10  ExampleApp                 	0x00000001059d79b8 facebook::react::JSCNativeModules::getModule+ 11598264 (OpaqueJSContext const*, OpaqueJSString*) + 188
11  ExampleApp                 	0x00000001059d254c OpaqueJSValue const* (*facebook::react::(anonymous namespace)::exceptionWrapMethod<&(facebook::react::JSCExecutor::getNativeModule(OpaqueJSValue*, OpaqueJSString*))>())(OpaqueJSContext const*, OpaqueJSValue*, OpaqueJSString*, OpaqueJSValue const**)::funcWrapper::call+ 11576652 (OpaqueJSContext const*, OpaqueJSValue*, OpaqueJSString*, OpaqueJSValue const**) + 104
12  JavaScriptCore                	0x0000000240038404 JSC::JSCallbackObject<JSC::JSDestructibleObject>::getOwnPropertySlot+ 574468 (JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&) + 340
13  JavaScriptCore                	0x000000024071d4f0 llint_slow_path_get_by_id + 2008
14  JavaScriptCore                	0x0000000240010928 llint_entry + 11528
15  JavaScriptCore                	0x0000000240015134 llint_entry + 29972
16  JavaScriptCore                	0x0000000240015134 llint_entry + 29972
17  JavaScriptCore                	0x0000000240015134 llint_entry + 29972
18  JavaScriptCore                	0x0000000240015134 llint_entry + 29972
19  JavaScriptCore                	0x0000000240015134 llint_entry + 29972
20  JavaScriptCore                	0x000000024000da1c vmEntryToJavaScript + 300
21  JavaScriptCore                	0x0000000240683fe4 JSC::Interpreter::executeProgram+ 7176164 (JSC::SourceCode const&, JSC::ExecState*, JSC::JSObject*) + 9620
22  JavaScriptCore                	0x000000024085f218 JSC::evaluate+ 9122328 (JSC::ExecState*, JSC::SourceCode const&, JSC::JSValue, WTF::NakedPtr<JSC::Exception>&) + 316
23  JavaScriptCore                	0x0000000240036634 JSEvaluateScript + 472
24  ExampleApp                 	0x00000001059b17c0 facebook::react::evaluateScript+ 11442112 (OpaqueJSContext const*, OpaqueJSString*, OpaqueJSString*) + 80
25  ExampleApp                 	0x00000001059d0608 facebook::react::JSCExecutor::loadApplicationScript+ 11568648 (std::__1::unique_ptr<facebook::react::JSBigString const, std::__1::default_delete<facebook::react::JSBigString const> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) + 528
26  ExampleApp                 	0x00000001059d6894 std::__1::__function::__func<facebook::react::NativeToJsBridge::loadApplication(std::__1::unique_ptr<facebook::react::RAMBundleRegistry, std::__1::default_delete<facebook::react::RAMBundleRegistry> >, std::__1::unique_ptr<facebook::react::JSBigString const, std::__1::default_delete<facebook::react::JSBigString const> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)::$_0, std::__1::allocator<facebook::react::NativeToJsBridge::loadApplication(std::__1::unique_ptr<facebook::react::RAMBundleRegistry, std::__1::default_delete<facebook::react::RAMBundleRegistry> >, std::__1::unique_ptr<facebook::react::JSBigString const, std::__1::default_delete<facebook::react::JSBigString const> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)::$_0>, void (facebook::react::JSExecutor*)>::operator()+ 11593876 (facebook::react::JSExecutor*&&) + 144
27  ExampleApp                 	0x00000001059d7898 std::__1::function<void (facebook::react::JSExecutor*)>::operator()+ 11597976 (facebook::react::JSExecutor*) const + 40
28  ExampleApp                 	0x000000010594b5a8 facebook::react::tryAndReturnError(std::__1::function<void + 11023784 ()> const&) + 24
29  ExampleApp                 	0x0000000105941104 facebook::react::RCTMessageThread::tryFunc(std::__1::function<void + 10981636 ()> const&) + 24
30  CoreFoundation                	0x0000000238c9e408 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20
31  CoreFoundation                	0x0000000238c9dd08 __CFRunLoopDoBlocks + 272
32  CoreFoundation                	0x0000000238c99220 __CFRunLoopRun + 2376
33  CoreFoundation                	0x0000000238c985b8 CFRunLoopRunSpecific + 436
34  ExampleApp                 	0x0000000105922280 +[RCTCxxBridge runRunLoop] + 264
35  Foundation                    	0x00000002397bf3b0 __NSThread__start__ + 1040
36  libsystem_pthread.dylib       	0x00000002389292fc _pthread_body + 128
37  libsystem_pthread.dylib       	0x000000023892925c _pthread_start + 48
38  libsystem_pthread.dylib       	0x000000023892cd08 thread_start + 4

I have been able to narrow it down to this function: ModuleRegistry::moduleNames When the vector<string> that is returned from this function goes out of scope and the memory is freed, the app inexplicably crashes. I have been able to work around this by adding a field to ModuleRegistry.h that stores the value returned from moduleNames, and in doing so the memory is not freed and the app continues to run as normal. I find it odd that moduleNames() returns a vector<string> that is not stored anywhere, was this intended?

To Reproduce

Iā€™m using React Native 0.57.3, but the latest version does not have any changes in the ModuleRegistry class where the issue seems to be happening. I am using a third party library that includes a custom RCTBridgeModule. It behaves normally until we do a beta on testflight or a local archive.

Expected Behavior

I would not expect the app to crash on launch.

Environment

React Native Environment Info: System: OS: macOS High Sierra 10.13.6 CPU: (8) x64 IntelĀ® Coreā„¢ i7-4980HQ CPU @ 2.80GHz Memory: 50.11 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.14.1 - ~/.nvm/versions/node/v10.14.1/bin/node npm: 6.4.1 - ~/.nvm/versions/node/v10.14.1/bin/npm Watchman: 4.6.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0 Android SDK: API Levels: 23, 25, 26, 27, 28 Build Tools: 23.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.1, 27.0.3, 28.0.3 System Images: android-27 | Google Play Intel x86 Atom IDEs: Android Studio: 3.2 AI-181.5540.7.32.5056338 Xcode: 10.0/10A255 - /usr/bin/xcodebuild npmPackages: react: 16.6.0-alpha.8af6728 => 16.6.0-alpha.8af6728 react-native: 0.57.3 => 0.57.3 npmGlobalPackages: react-native-ar: 2.0.0-test19 react-native-cli: 2.0.1 react-native-unity-view: 1.3.2 solidarity-react-native: 2.0.2

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:19 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
amirhosein5858commented, Apr 14, 2022

@amirhosein5858 i have same issue, did you find any solution?

hi, in build setting / swift copiler - code generation / change optimization level for release to ā€˜No Optimizationā€™ it fix my problem when i try to build with my system but using fastlane and github action for build make app crash as before

1reaction
JanOwiesniakcommented, May 20, 2019

@lklepner the fix @mtostenson mentioned above is captured in the first screenshot in this comment. Hope this helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Testflight app crashes only on celā€¦ | Apple Developer Forums
The app works perfectly in debug. However in testflight, when cellular network is enabled, the app randomly crashes just after receiving an api...
Read more >
App Crashes Only On Testflight Build - ios - Stack Overflow
Go to Xcode->widows->organiser then select crashes tab then select your app. If you have added your apple account in Xcode->preferences->Ā ...
Read more >
Is your app crashing on TestFlight? Issues and potential ...
If the app crashes on TestFlight or the App Store, the first thing to try is building the project under RELEASE mode with...
Read more >
App distributed via TestFlight crashes on launch - Using Swift
The app runs fine in the simulator and on a device when launched directly from Xcode. The workaround is to add libswift_Concurrency.
Read more >
Is your iOS app crashing only when you upload it to TestFlight?
Test using release mode by clicking Product > Scheme > Edit Scheme > Run > Choose Release and make sure to check the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found