Xcode 9 Server: Unable to boot device due to insufficient system resources - ios

I'm trying to run my unit tests on all device simulators from iOS 8.4 to 11.0 at the same time by checking the option 'Run test in parallel' when setting up the Xcode Bot. Unfortunately after trying to boot the 13th simulator it failes with the error message in the build log:
xcodebuild: error: Failed to build workspace xxxxx with scheme yyyyy.
Reason: Unable to boot device due to insufficient system resources.
Testing failed on 'iPhone 4s'
I'm running the server on a mac mini and i think it is just not capable to run so many simulators at the same time due to full memory.
Anyone experience with it?

Increase the maximum number of processes until the next restart:
sudo launchctl limit maxproc 2000 2500
Increase the maximum number of open files until the next restart:
sudo launchctl limit maxfiles 2000 unlimited
For me it was the maximum number of processes that had to be increased. You might need even bigger numbers, those are just examples. Please refer to the documentation for more details.
Source: https://help.apple.com/simulator/mac/9.0/index.html#/dev8a5f2aa4e

Related

Getting frequent Kill:9 Error in Xcode and Terminal

I have recently upgraded the Mac OS to Ventura 13.2.1 and Xcode to 14.2, now once I try to compile any application with Xcode, I am getting Kill:9 related issue for random task/framework in the project. I also get Kill:9 issue sometime on terminal as well.
Listing the errors here:
failed to read asset tags: The command `` terminated with uncaught signal 9. The command had no output.
Driver threw jobFailedWithNonzeroExitCode(9, "") without emitting errors.
Unable to execute command: Killed 9 Clang frontend command failed due to signal.
Please help me to resolve this issue/crash.
Open project in Xcode.
Build the app with Simulator (I tried with iPhone 14 Pro)
Error occurs in the build
Ideally project should have compiled without any error.
It sounds to me that the problem is with the installation of Xcode because when an unprivileged task is attempted, the OS will kill it off (with signal 9).
What I recommend is for you to re-install Xcode.
When you first run the new Xcode, it should prompt you for an administrator password in order to install system related components. Make sure you do this step. Hopefully that should then allow you to compile and run your iOS apps.

Unable to mount a developer disk image. iOS 15.4.1 - Xcode 13.3.1 (13E500a)

iOS: 15.4.1 , Xcode: 13.3.1 (13E500a), macOS: 12.3.1 (21E258)
Hi, I was originally trying to remote debug in Terminal by:
idevicedebugserverproxy -d 9999
then in a lldb session:
process connect connect://localhost:9999
but lldb returned:
error: failed to get reply to handshake packet
and idevicedebugserverproxy returned:
main: Waiting for connection on local port 9999
main: Handling new client connection...
main: Waiting for connection on local port 9999
connection_handler: client_fd = 4
Could not start debugserver on device!
Please make sure to mount a developer disk image first.
I did some research saying that build an app with Xcode would automatically mount the disk image for us, so I simply built and ran the default "hello world!" app on the phone, but still receive above errors. I also rebooted the phone many times with no luck.
So I decided to mount it manually with the latest developer disk image 15.4 by:
ideviceimagemounter /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.4/DeveloperDiskImage.dmg /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.4/DeveloperDiskImage.dmg.signature
but kept receiving this error:
done.
Mounting...
Error: ImageMountFailed
I'm assuming developer disk image have to match the phone's version, but I can't find the 15.4.1 version.
What am I missing or doing wrong?
I managed to solve this problem by uninstalling libplist, usbmuxd, libimobiledevice, ideviceinstaller from brew and manually build the latest version from GitHub.
done.
Mounting...
Done.
Status: Complete

System Restart Upon Building in Xcode 11

I'm a beginner Swift developer and this is my first question in Stack Overflow. I've been working on an iOS SpriteKit game in Swift 5, Xcode 11 (updated from Xcode 10.3 as of a week ago). Aside increasing build times over the past few months, everything has been running smoothly.
About a week ago, running my application on any device or simulator began crashing my computer, forcing a restart with a large '!' icon in the background behind text explaining "There was an issue", with a normal startup and login process following. I would receive a dialog explaining "MacBook Pro experienced an issue and had to restart" and I was offered to report the crash to Apple (which I did).
This first occurred when I tried to archive a version of my app. I did research and found that deleting the DerivedData folder from User/Library/Developer/Xcode and the xcuserdata folder from both the project file and the workspace file contents prevented the crash after cleaning the build folder.
Then the same issue arose when I attempted to run my application on my iPhone 8. This time, performing the steps above solved nothing. This time, I analyzed the program instead of running it, which worked. Then, after a day, analyzing caused the system restart. So did a ton of other methods I tried. Up until now, all of the following actions result in a system restart after about 3-5 minutes of starting:
Building and running
Archiving
Analyzing
Building for Testing
In addition, I've tried the above methods after deleting said folders and cleaning the build folder. I've also tried them on the simulators, physical devices, and the Generic iOS Device. Nothing seems to be working.
Below is the system log that occurred during the crash. It is the one that my computer offered to send to Apple. I replaced a portion of the output with [...] as Stack Overflow detected some parts as spam. Willing to provide if needed.
I'm running macOS Mojave 10.14.6 on a 2017 MacBookPro. The latest occurence of this error occurs in Xcode Version 11.0 (11A420a), yet the forced restart issue also arose in Xcode 10.3 and Xcode 11 GM Seed 2.
If additional information is needed, I'll be happy to provide it.
Anonymous UUID: 44******-****-****-****-**********92
Sat Sep 21 21:31:12 2019
*** Panic Report ***
mp_kdp_enter() timed-out on cpu 0, NMI-ing
mp_kdp_enter() NMI pending on cpus: 0 2
mp_kdp_enter() timed-out during locked wait after NMI;expected 4 acks but received 3 after 9361562 loops in 1548000000 ticks
panic(cpu 0 caller 0xffffff80009ecea8): "thread_call group 'high' reached max thread cap (500): active: 1, blocked: 499, idle: 0"#/BuildRoot/Library/Caches/com.apple.xbs/Sources/xnu/xnu-4903.271.2/osfmk/kern/thread_call.c:221
Backtrace (CPU 0), Frame : Return Address
[...]
BSD process name corresponding to current thread: kernel_task
Mac OS version:
18G95
Kernel version:
Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64
Kernel UUID: C41337A1-0EC3-3896-A954-A1F85E849D53
Kernel slide: 0x0000000000600000
Kernel text base: 0xffffff8000800000
__HIB text base: 0xffffff8000700000
System model name: MacBookPro14,2 (Mac-CAD6701F7CEA0921)
System uptime in nanoseconds: 5389100927958
last loaded kext at 4928689757019: com.apple.filesystems.msdosfs 1.10 (addr 0xffffff7f841db000, size 69632)
last unloaded kext at 305554353504: com.apple.filesystems.msdosfs 1.10 (addr 0xffffff7f841db000, size 61440)
loaded kexts:
com.Cycling74.driver.Soundflower 2
com.valvesoftware.SteamInput 3083.39.62
com.apple.filesystems.msdosfs 1.10
com.apple.fileutil 20.036.15
[...]
com.apple.kec.pthread 1
com.apple.kec.corecrypto 1.0
com.apple.kec.Libm 1
EOF
Model: MacBookPro14,2, BootROM 198.71.1.0.0, 2 processors, Intel Core i5, 3.1 GHz, 8 GB, SMC 2.44f1
Graphics: kHW_IntelIrisGraphics650Item, Intel Iris Plus Graphics 650, spdisplays_builtin
Memory Module: BANK 0/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x80CE, 0x4B3445364533303445422D45474347202020
Memory Module: BANK 1/DIMM0, 4 GB, LPDDR3, 2133 MHz, 0x80CE, 0x4B3445364533303445422D45474347202020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x171), Broadcom BCM43xx 1.0 (7.77.61.2 AirPortDriverBrcmNIC-1305.8)
Bluetooth: Version 6.0.14d3, 3 services, 18 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
USB Device: USB 3.0 Bus
USB Device: Flash Disk
USB Device: Apple T1 Controller
Thunderbolt Bus: MacBook Pro, Apple Inc., 41.1
Thunderbolt Bus: MacBook Pro, Apple Inc., 41.1
It looks like I figured it out on my own. I'm going to post the solution here in case any other Xcode developers run into the same issue.
It seems as though the problem lies in the project's directory. Because the entire Xcode project was on a USB disk drive, build times were slowing and restarts were occurring. To fix the issue, I simply created a copy of my project on my computer's drive and ran the program. Everything worked just fine. In fact, build times were much faster.

How do I get 'react-native-cli' to run my app in the specified hardware?

The React Native CLI will not run the specified simulator. When I enter
/usr/local/bin/node /usr/local/lib/node_modules/react-native-cli run-ios ‑‑simulator="iPhone X"
the simulator runs as expected, but insists on running in an iPhone 6, regardless of what simulator I specify, and if I select an additional hardware from the simulator app's menu, the one that launches does not show my project. (In fact, if I an iPhone X, it shows an app that I worked on some time ago instead.)
I've uninstalled and reinstalled the react-native-cli, and have no additional global ios-sim (though I had one once).
How do I get react-native-cli to run my app in the specified hardware?
My starting place for encountering these errors is simply (1) to install react-native-cli, (2) install WebStorm, (3) build a default React Native project there, and (4) run the project using the default iOS run configuration there. (WebStorm 2018.1.5; macOS 10.13.5; React Native CLI 2.0.1; Node 10.6.0)
The CLI goes through a few simple steps which you can step through here.
The first parameter is the output of running this from the command line:
xcrun simctl list --json devices
A few things to check first after running the xcrun command above:
Do you see multiple child nodes that start with 'iOS'? If so, you may have multiple versions of the simulators installed. The CLI will only look at the first version that it finds that starts with 'iOS'. So if there is only one simulator in that particular version, you're going to get that one all the time.
Find the iPhone 6 simulator, does it show it's state as Booted? If so, it will take priority if a simulator name is not provided
Is the iPhone X simulator availability listed as (available)?
Did you reboot the computer to kill any stale simulator processes? This should also reset the state and availability statuses of the simulators
Other than that, the cli does a pretty simple check:
If a simulator is Booted and no name is provided, start that one.
Launch the first simulator in the list if no name match was found using the name property

Getting Error Flashing Android Things with Starter Kit

I recently picked up an Android Things Kit at Google Developer Days India. I was trying to setup it up via my Mac. I downloaded the Android Things Setup Utility from the Android things console. I tried to run it and it started installing the firmware. It stopped saying "Exit Status 1". What am i doing wrong?
Android Things Setup Utility (version 1.0.16)
============================
This tool will help you install Android Things on your board and set up Wi-Fi.
What do you want to do?
1 - Install Android Things and optionally set up Wi-Fi
2 - Set up Wi-Fi on an existing Android Things device
1
What hardware are you using?
1 - Raspberry Pi 3
2 - NXP Pico i.MX7D
3 - NXP Pico i.MX6UL
2
You chose NXP Pico i.MX7D.
Looking for devices... This can take up to 3 minutes.
found device
Unzipping image...
Flashing Android Things. This will take a few minutes...
*Do not disconnect or interrupt!*
target reported max download size of 419430400 bytes
sending 'bootloader' (559 KB)...
OKAY [ 0.018s]
writing 'bootloader'...
OKAY [ 0.250s]
finished. total time: 0.268s
rebooting into bootloader...
OKAY [ 0.000s]
finished. total time: 0.000s
target reported max download size of 419430400 bytes
sending 'gpt' (33 KB)...
OKAY [ 0.004s]
writing 'gpt'...
OKAY [ 0.434s]
rebooting into bootloader...
OKAY [ 0.000s]
finished. total time: 0.439s
target reported max download size of 419430400 bytes
Error: error flashing android things: exit status 1
Stopping adb server...
Stopped adb server...
For my case, it is because MacOS does not provide mke2fs.
I found one in the unzipped image folder (android-things-setup-utility/quickstart-temp/unzipped/mke2fs).
And run mv android-things-setup-utility/quickstart-temp/unzipped/mke2fs /usr/local/bin
Hope this can help.

Resources