Closed oskarth closed 6 years ago
Possibly related to https://github.com/status-im/status-go/issues/273
Slightly different stack trace this crash, notice the sync network request with package manager. As far as I can tell the only difference is that I selected "Wait for executable to be launched" under Edit Schema -> Run in Xcode, and that I'm connected to a hotspot hosted by my phone.
Date/Time: 2017-08-30 17:11:24.5001 +0200
Launch Time: 2017-08-30 17:11:04.4305 +0200
OS Version: iPhone OS 10.3.3 (14G60)
Report Version: 104
Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace SPRINGBOARD, Code 0x8badf00d
Triggered by Thread: 0
Filtered syslog:
None found
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x000000018be0b260 semaphore_wait_trap + 8
1 libdispatch.dylib 0x000000018bcf95e8 _os_semaphore_wait + 24
2 libdispatch.dylib 0x000000018bcf8ca0 _dispatch_semaphore_wait_slow + 140
3 CFNetwork 0x000000018d4ebcec CFURLConnectionSendSynchronousRequest + 284
4 CFNetwork 0x000000018d5182a4 +[NSURLConnection sendSynchronousRequest:returningResponse:error:] + 120
5 StatusIm 0x0000000100b30538 -[RCTBundleURLProvider isPackagerRunning:] (RCTBundleURLProvider.m:76)
6 StatusIm 0x0000000100b307e8 -[RCTBundleURLProvider guessPackagerHost] (RCTBundleURLProvider.m:92)
7 StatusIm 0x0000000100b309f8 -[RCTBundleURLProvider packagerServerHost] (RCTBundleURLProvider.m:106)
8 StatusIm 0x0000000100b30bbc -[RCTBundleURLProvider jsBundleURLForBundleRoot:fallbackResource:] (RCTBundleURLProvider.m:123)
9 StatusIm 0x000000010002cac4 -[AppDelegate application:didFinishLaunchingWithOptions:] (AppDelegate.m:29)
10 UIKit 0x0000000192fd1e48 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 380
11 UIKit 0x00000001931de37c -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3452
12 UIKit 0x00000001931e3e24 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1684
13 UIKit 0x00000001931f88b0 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke.3147 + 48
14 UIKit 0x00000001931e10b8 -[UIApplication workspaceDidEndTransaction:] + 168
15 FrontBoardServices 0x000000018e9d8884 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36
16 FrontBoardServices 0x000000018e9d86f0 -[FBSSerialQueue _performNext] + 176
17 FrontBoardServices 0x000000018e9d8aa0 -[FBSSerialQueue _performNextFromRunLoopSource] + 56
18 CoreFoundation 0x000000018cddd42c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
19 CoreFoundation 0x000000018cddcd9c __CFRunLoopDoSources0 + 540
20 CoreFoundation 0x000000018cdda9a8 __CFRunLoopRun + 744
21 CoreFoundation 0x000000018cd0ada4 CFRunLoopRunSpecific + 424
22 UIKit 0x0000000192fcafc8 -[UIApplication _run] + 652
23 UIKit 0x0000000192fc5c9c UIApplicationMain + 208
24 StatusIm 0x000000010002d38c main (main.m:16)
25 libdyld.dylib 0x000000018bd1959c start + 4
Related https://github.com/facebook/react-native/issues/10187
The app is still crashing in my case. It is the same problem as before. The app runs for ~30 seconds and then crashes. I'm using run-ios.sh script made by @rasom to actually build and run the app on the iPhone. Is there a different method I could try?
@retro Can you try the following:
You should be able to see crash logs relevant to this error under Xcode -> Window -> Devices -> Pick device crash log, refresh and sort by latest. This is where the 0x8badf00d shows up, the error you've got seems to happen before and be related to iOS tests (I've had that too FWIW, probably separate issue).
EDIT: Moving discussion about this specific PR to https://github.com/status-im/status-react/pull/1716#issuecomment-326558714
Some more findings. Using @rasom's ./run-ios.sh real
script (xcode CLI build) and multiple ios-deploy
runs on either a "stale" (apps running, been on for a while) device or a "fresh" (restarted and no apps running) gives the following logs. This is without the patch applied and running on same WiFi.
Full logs: https://gist.github.com/oskarth/9620c48fba052a91dc0f4290ddeecdd2
Notice how the stale device only gets to Requiring: bignumber.js
whereas the fresh one gets to Requiring: ./resources/images/contacts/FirstBlood.png
This might require running the last line in run-ios.sh
multiple times:
ios-deploy -i "${real_device_udid}" --justlaunch --bundle build/Build/Products/Debug-iphoneos/StatusIm.app
This slow bundling with 30s timeout would explain why it works sometimes for @rasom but not for most other people. It might be a CPU issue but also a network or memory issue. If we could figure out how to speed this part up we'd solve the issue.
Reason for multiple ios-deploy
- it seems if it takes a while for it to connect. After first one, despite sleep
, the packager kicks in and starts chewing slowly:
Bundling
index.ios.js▓▓▓▓▓▓▓░░░░░░░░░ 46.4% (427/627)
Another workaround that seems to work is to do a release build and deploy it directly onto the device:
xcodebuild -workspace ios/StatusIm.xcworkspace -scheme StatusIm -configuration Release -destination "platform=iOS,id=${real_device_udid}" -derivedDataPath 'build'
ios-deploy -i "${real_device_udid}" --justlaunch --bundle build/Build/Products/Release-iphoneos/StatusIm.app
However, this doesn't seem to give access to normal logs.
Here's something kind of interesting: before app has finished loading, between react-native
and js-dependencies
dependencies are being loaded, there's a bunch of TCP calls being made. This despite the fact that iOS installation happens over USB (--no-wifi flag to ios-deploy). Anyone got any ideas what that could be about? It'd be pretty bad if we blocked on some network call before app finished loading. @rasom?
Found another way that interestingly works:
./run-ios.sh real
This launches app fairly quickly. It seems to suppress logs though, as can be seen in logs.
Logs: https://gist.github.com/oskarth/5849f65196abe4d9fca6cc6eee1bb9fe
With https://github.com/status-im/status-go/issues/273 it seems as if debug mode works. This means the watchdog doesn't kick in and the app is allowed to keep running. I'm not sure this is the end of our problems (getting a mysterious "ReferenceError: localStorage is not defined"
error), but at least the app can start in debug mode with this and 0x8badf00d
isn't triggered. It just takes a very long time. The root cause - slow/bad bundling and a lot of sync network traffic remains. Steps:
# Build status-go for device using that branch, see status-go README
# Replace Statusframework with your local build
(cd .. && rm -r status-react/modules/react-native-status/ios/RCTStatus/Statusgo.framework && cp -R status-go/build/bin/statusgo-ios-9.3-framework/Statusgo.framework status-react/modules/react-native-status/ios/RCTStatus/)
# Build
xcodebuild -workspace ios/StatusIm.xcworkspace -scheme StatusIm -configuration Debug -destination "platform=iOS,id=${real_device_udid}" -derivedDataPath 'build'
# Deploy with debug mode (not justlaunch)
ios-deploy -i "${real_device_udid}" --debug --bundle build/Build/Products/Debug-iphoneos/StatusIm.app
If you rebuild, make sure not to call mvn -f modules/react-native-status/ios/RCTStatus dependency:unpack
as this will overwrite your local StatusFramework version.
The fix for ERC_BAD_ACCESS
is now in status-go
develop and has been built as an artifact. This means we can run in debug mode without watchdog kicking in. Because status-go
API has changed we need to use https://github.com/status-im/status-react/pull/1584 commits, which aren't yet in status-react
develop.
The previously mentioned errors disappear when using the latest synced status-react
version of status-go
branch. This will work in the meantime:
# be on latest develop
git checkout develop && git pull
# cherry pick status-go upgrade (updated commit hash: Sep 9)
git cherry-pick 1d201b47cbc0796dbb2494d4dbc44520cb3a2680
# use fixed status-go
mvn -f modules/react-native-status/ios/RCTStatus dependency:unpack
# run in xcode or via command line in debug mode, make sure not to use --justlaunch but debug
ios-deploy -i "${real_device_udid}" --debug --bundle build/Build/Products/Debug-iphoneos/StatusIm.app
We still have issues with general slowness of build but this is a separate issue as we can use debug mode for develop and not hit 0x8badf00d. Will close this issue once https://github.com/status-im/status-react/pull/1584 is merged.
Pointers, ideas and notes for speedier builds in general:
Blocked by https://github.com/status-im/status-react/pull/1584 - once that is merged this issue should be put in the merged column.
Fixed in develop.
I ran into this issue today on iOS by running
react-native run-ios --udid "id#" --configuration Debug
It created the same log as OP.
As a work-around, I dropped the original didFinishLaunchingWithOptions
into a delayed didFinishLaunchingWithOptionsAfterDelay
.
This prevents the app crash from timeout, but I am not sure that this issue is fixed (can't find the source where I got this work-around) -
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self performSelector:@selector(didFinishLaunchingWithOptionsAfterDelay:) withObject:launchOptions afterDelay:0.001];
return YES;
}
- (BOOL)didFinishLaunchingWithOptionsAfterDelay:(NSDictionary *)launchOptions
{
/* Insert original here */
}
User Story
As a developer, I want to reliably run latest develop on device to develop features that require a device, such as push notifications.
Description
Type: Bug
Summary: When running the app on device, it shows splash screen then crashes.
Expected behavior
App launches after splash screen.
Actual behavior
App builds fine. Once running it crashes after splash screen. Crash logs shows reason is 0x8badf00d, which is a form of resource limit being hit. See logs section.
Reproduction
tab 2
BUILD_IDS=ios lein repl
tab 3
tab "react-native start"
replace real_device_id with your phone ID, "instrument -s devices"
real_device_udid="87a4f458ccfad6330008d02c674cbb73d4a5f997" xcodebuild -workspace ios/StatusIm.xcworkspace -scheme StatusIm -configuration Debug -destination "platform=iOS,id=${real_device_udid}" -derivedDataPath 'build' sleep 60 ios-deploy -i "${real_device_udid}" --justlaunch --bundle build/Build/Products/Debug-iphoneos/StatusIm.app
git checkout develop && git pull rm -rf node_modules rm -rf $TMPDIR/react rm -rf $TMPDIR/npm watchman watch-del-all
Exception Type: EXC_CRASH (SIGKILL) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: Namespace SPRINGBOARD, Code 0x8badf00d Triggered by Thread: 0
Filtered syslog: None found
Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libsystem_kernel.dylib 0x0000000181ed7224 mach_msg_trap + 8 1 libsystem_kernel.dylib 0x0000000181ed709c mach_msg + 72 2 CoreFoundation 0x0000000182ea8e90 CFRunLoopServiceMachPort + 192 3 CoreFoundation 0x0000000182ea6ae4 CFRunLoopRun + 1060 4 CoreFoundation 0x0000000182dd6da4 CFRunLoopRunSpecific + 424 5 Foundation 0x00000001838f0d74 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304 6 Foundation 0x0000000183911b44 -[NSRunLoop(NSRunLoop) runUntilDate:] + 96 7 StatusIm 0x0000000100110084 +[SplashScreen show] (SplashScreen.m:19) 8 StatusIm 0x00000001000ede6c -[AppDelegate application:didFinishLaunchingWithOptions:] (AppDelegate.m:49) 9 UIKit 0x000000018909d204 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 380 10 UIKit 0x00000001892a9738 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3452 11 UIKit 0x00000001892af1e0 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1684 12 UIKit 0x00000001892c3d18 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke.3151 + 48 13 UIKit 0x00000001892ac474 -[UIApplication workspaceDidEndTransaction:] + 168 14 FrontBoardServices 0x0000000184aa3884 FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 36 15 FrontBoardServices 0x0000000184aa36f0 -[FBSSerialQueue _performNext] + 176 16 FrontBoardServices 0x0000000184aa3aa0 -[FBSSerialQueue _performNextFromRunLoopSource] + 56 17 CoreFoundation 0x0000000182ea942c CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 24 18 CoreFoundation 0x0000000182ea8d9c CFRunLoopDoSources0 + 540 19 CoreFoundation 0x0000000182ea69a8 CFRunLoopRun + 744 20 CoreFoundation 0x0000000182dd6da4 CFRunLoopRunSpecific + 424 21 UIKit 0x0000000189096384 -[UIApplication _run] + 652 22 UIKit 0x0000000189091058 UIApplicationMain + 208 23 StatusIm 0x00000001000ee03c main (main.m:16) 24 libdyld.dylib 0x0000000181de559c start + 4 ...