Couldn't register with the bootstrap Server - xcode

I just changed some code in my program and got this error:
Couldn't register com.yourcompany.XXX with the bootstrap server.
Error: unknown error code.
This generally means that another instance of this process was already
running or is hung in the debugger.Program received signal:
“SIGABRT”.
I tried restoring my program to a version that worked, rebooted, restarted, empty caches and rebuild on versions that even worked before.
Any help would be appreciated.

I was able to recover from this by unplugging the iPad, powering it down and back up, clearing all XCode caches and targets, and doing a clean build.
I'm running XCode 3.5.4 and iOS 4.2.1
UPDATE: Same problem running Xcode 4.3 and iOS5 - just power-cycle the device.

You might wish to kill all Simulator processes, that can cause this error as well.
Here's a one-liner to kill 'em all:
kill -9 `ps ax | grep Simulator | grep -v grep | awk '{print $1}'`
Or more concise, like #brianegge mentions as a comment:
killall -9 Simulator

My solution was to restart the ipad, wait a while and try again.

If you get the hang when using the simulator, look at this thread: Strange Error When Testing Simulator
You may find this test of interest, as it will tell you ASAP if the only solution is to reboot now or not:
Open Terminal and run this command: ps -Ael | grep Z. If you get two entries, one "(clang)" and the other your app or company name, you're hosed - reboot.
If you are a developer, enter a short bug and tell Apple how absolutely annoying having to reboot is, and mention they can dup this bug to "rdar://10401934" .

I received the same problem, running an app on an iPhone from Xcode. The message that I was getting was the same as above:
Couldn't register xxx.com.company.appname with
the bootstrap server. This generally
means that another instance of this
process was already running or is hung
in the debugger.
I tried many things to fix the problem, in this order, all which failed:
force quitting the app on the iPhone
force quitting and then deleting the app the iPhone
opening and closing the project
cleaning the project
restarting XCode
Eventually, I rebooted the iPhone and the problem went away, which leads me to think that the source of the problem is a hung process that Xcode cannot or will not kill. If I am able to reproduce exactly what I was doing during my debugging session to get this strange state I'll add another note here.

I opened a bug report with Apple: https://bugreport.apple.com/cgi-bin/WebObjects/RadarWeb.woa/19/wo/WBbbbyopNFW8FFUuNSbk0w/10.66
Please let me know if you can't access it.
Summary: XCode debugger is not releasing bootstrap server port
Steps to Reproduce:
While debugging an iPhone iOS5 app in the simulator in Xcode 4.2 Build 4D5163b on Lion 10.7.2, a crash can sometimes result in being unable to start the bugger. Instead, Xcode produces this error:
Couldn't register com.MyApp.MyApp with the bootstrap server.
Error: unknown error code. This generally means that another instance
of this process was already running or is hung in the debugger.Program
received signal: “SIGABRT”.
Expected Results:
Should be able to start debugger after a crash.
Actual Results:
Cannot start debugger. The only way I've discovered to make the simulator work again is to restart Mac OS.
Regression:
Notes:
Lots of people are having this problem:
iPhone - strange error when testing on simulator
Couldn't register with the bootstrap Server
Bootstrap Server Error in Xcode IPHONE
https://discussions.apple.com/message/10416765?messageID=10416765
Quitting XCode and the Simulator (& ensuring ps -Al | egrep "Xcode|Simulator" returns nothing) does not help the problem.
Running "launchtl bslist | grep MyApp" reveals that com.MyApp is still registered with the bootstrap server:
$ launchctl bslist | grep MyApp
A com.MyApp.MyApp.UIKit.migserver
A com.MyApp.MyApp
I wrote some code to find the port and invalidate it, but this too fails:
NSMachBootstrapServer *bsserver = [NSMachBootstrapServer sharedInstance];
NSMachPort *port = (NSMachPort *)[bsserver portForName:#"com.MyApp.MyApp"];
[port removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:<#(NSString *)#>
NSLog(#"port = %#",port);
NSLog(#"port.isValid=%d",[port isValid]);
[port invalidate];
NSLog(#"port.isValid=%d",[port isValid]);

I got the same issue with Xcode 4. The solution was to change the scheme.
Run set to Debug,
Test set to Debug,
Profile set to Release,
Analyze set to Debug,
Archive set to Release

Restarting my computer solved my problem. This error happened when I connected my new iPod Touch to my mac and ran my project in simulator at the same time.

The easiest way its to change the target name,
Remembert to change it back next day after a restart.

To sum it all up.
Sometimes kill -9 (the process id) helps.
Sometimes (as stated) launchctl list | grep UIKitApplication | grep "(your app name/identifier)" | awk '{print $3}' | xargs launchctl remove works.
But if its a "zombie" process, only a restart will solve your problem.
A temporary solution is to just change the identifier (IOS Application Target, Summary Tab) to something else (like "com.mycompany1.myapp" from "com.mycompany.myapp") but remember to change it back after the reboot and before you submit it.
(of course this will create another app on the simulator, but I guess that's the least of your problems....)
Unfortunately, there is no "easy way to greatness"... ;-)

Here is how I think I solved this 'strange' error:
Couldn't register com.yourcompany.XXX with the bootstrap server. Error: unknown error code.
This generally means that another instance of this process was already running or is hung in the debugger.Program received signal: “SIGABRT”.
(1) Clean all the caches, targets, headers on both Xcode and the simulator.
(2) Restart your iPhone when it is not connected to the computer and make sure no versions of the program that gave you problems are left on your iPhone.
(3) Restore any previous version of your program that you know absolutely worked at one point in time.
(4) Shut down your computer/laptop. (I needed to do it 4 times.) Makes no sense to me.
(5) Restart your machine and try running a different program to see if you still get the error. If you do not get the error on another program.
(6) Compile the program that gave you the error:(1) First with an earlier version that worked. And then, the version that gave you the error. Naturally, you may have to re-add code on a step-wise basis to make sure you know what code caused the error.

This happened to me because another application was eating up the computer's resources. I quit the simulator, quit the application which was hanging my computer and restarted the simulator, and it worked then. The error means that a previously killed process couldn't reach the end of the queue, and is holding up the current one.

Lot's of good answers have been provided for fixing the problem.
I have found that I can recreate this bug by creating a breakpoint in my code so that the execution pauses. Then if I press on the Stop Button the bug will now appear when I try to run the code again. Resuming the execution before pressing the Stop Button therefore avoids this issue.
Hope this helps.

closing down xcode then starting it, and restarting my iphone solved my problem

I didn't find a better solution than mentioned above: restart the iPhone. It seems that there's a daemon that connects to the Xcode debugger not properly killed.
You can avoid this behavior ALWAYS stopping the debugging session through the "Stop" button in Xcode, and waiting for the app to exit automatically on the iPhone. I always have to reboot if I click "Start" without stopping first, or exiting with the iPhone's button, or something like that. Hope it helps

I encountered this issue myself just now while evaluating AppCode. I discovered that XCode had somehow attached itself to my application while I was attempting to attach AppCode to my application. I simply stopped the XCode debug session and it worked as expected. I hope this will help somebody.

Just rebooting the device should solve the problem. See the analogous question about the simulator: iPhone - strange error when testing on simulator

This may be caused by an instance of your app running in the background. This simplified process worked for me without even having to close xCode or shutdown my computer.
Close simulator
Stop the app from running in xCode.
Open activity monitor and search for a process running with your App NAME.
Kill this process in Activity Monitor
Rebuild your project and you should be all set
In theory Pål's command line solution should work as well. The issue definitely seems to be caused by an extra instance of the app running in the background. The app does not always seem to be getting killed properly after each test in simulator or on the device. I first noticed this when jumping between simulator and a device frequently.
As a preventive measure it is good practice to always hit the stop button in xCode after each test.

Very interesting results when trying to restart my computer. It said, and this is no joke, that 103 users where "sharing" the system. When I restarted, it back down to the usual four (I have Time Machine stuff for all of my computers going through this computer). I stopped the problem by simply setting up an app that monitors that activity, and does not allow additional users to "share" my computer without my permission. What it does is create a window every time someone wants access, and I have to press "Approve" before they can get in. This didn't work properly until I made the changes below.
I made sure it would tell me when somebody stopped sharing. Whenever Xcode has this problem, I know long before it returns the errors.
This is now useful for almost everything, but annoying during gaming of any kind.
I then wrote a script that fixed the problem by, basically, clearing the Simulator processes that might possible cause problems.
This app will be very useful to developers, so I am "polishing" it up a bit, then it is off to the App Store. When it gets to that point, I will post a link to it here (it will be free).

Okay, I've got a workaround for the hardware issue that doesn't involve rebooting the phone. I assume this will also work on the simulator but I haven't tried it.
Force Springboard to relaunch by changing the language. Settings -> General -> International -> Language.
I just changed it to Spanish, waited for Springboard to relaunch, changed it back to English, and was good to go.

This evening I got the same issue saying
"Couldn't register com.xxx.yyy with the bootstrap server. Error:
unknown error code.
This generally means that another instance of this process was already
running or is hung in the debugger.(lldb)"
and I got solved
1.Just disconnect my Device (for me its iPhone) from Xcode/ Mac machine
2.Reboot the Device (my iPhone)
3.Removed previously installed/corrupted app
4.Again connect device and started exception
It works well
Hope this will help someone there.

Related

High CPU load of diagnosticd process while running React Native app on iOS simulator

I have been developing with React Native for some years now but the following behaviour only started recently. After running any React Native app on the iOS simulator (either directly from Xcode or via react-native run-ios) the diagnosticd process slowly increases CPU usage to 150% after a couple of minutes. My laptop becomes unusable because the process is also eating up all file handles of the OS. Googling around only points to excessive logging, but either I'm not looking in the right location or no huge amounts of logging is taking place.
Closing the app by pressing the Home button in the simulator immediately stops the high cpu load.
Is anybody also experiencing this? How can I find out what is causing this?
MacOS Catalina version 10.15.3, Xcode version 11.4, React version 16.9.0, React Native version 0.61.5, Simulator iPhone 11 (iOS 13.4)
I think I found the solution. Xcode was logging a lot of lines containing: xcode nw_connection_get_connected_socket Client called nw_connection_get_connected_socket on unconnected nw_connection. This started after some update of Xcode a couple of months ago. Disabling the logging has stopped the diagnosticd process from eating up all OS resources. I followed these instructions: Hide strange unwanted Xcode logs
Basically comes down to adding an environment variable OS_ACTIVITY_MODE with value disable to the Scheme (Run).
What the real reason for the logging is I still don't know. It looks like some sort of polling from React Native.
It's more of a workaround than a solution, but it seems that resetting the simulator to factory default temporary fix this problem (at least on my case).
It looks like diagnosticd is processing some files which may be located on the simulator internal memory, so it may takes more and more cpu as the files are growing over time ?
Anyway try to go to the simulator menu : Hardware -> Erase All Content and Settings
Then close the simulator and start it again from XCode in order to copy your app on it.
workaround from Xcode 9.3 Playground - diagnosticd,
kill $(ps -ef | grep Xcode.app | egrep "diagnosticd|homed" | awk '{ print $2 }')
I found this to be useful
Finally found the solution! I was always wondering why the default url in AppDelegate.m did not work. So I started focusing on that. It turns out that my huge adblocking hosts file was the cause of this. Restoring the original /etc/hosts file solved both problems! 🎉
One more thing you can try, this is a very drastic measure and only do this at your own risk,
first try this,
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.diagnosticd.plist
and if you get a message about system protection (SIP),
you can try turning off SIP, then running that command again,
That will pretty much guarantee diagnosticd never run's again... no idea about the implications of that though...
read more about those two things here,
https://makandracards.com/dev/16439-disable-daemons-services-in-mac-os-x
https://www.imore.com/how-turn-system-integrity-protection-macos
*disclaimer, this is probably not the safest solution messing with SIP, but I did it on my old 2015 i5 macbook because I was getting desperate, and literally couldn't do any work on simulator with the diagnosticd bug.
So far everything seems happy...

Xcode 8.2.1 keeps shutting down on startup

Every time I open the IDE it starts loading then shuts down before I get a chance to change anything. Remember this happening before on previous Versions of Xcode but I haven't had to deal with this in a rally long time. Any ideas?
PS. I think its Xcode 8.2.1 ,really hard to check when it closes down immediately.
Found that deleting Derived Data enabled X-code to start responding again.
Was difficult to find it though as most people were explaining how to find it from within Xcode :P If future me or any other super-devs would like to know the default directory then you can find it under the hidden folder Library on your user directory IE. /Library/Developer/Xcode/DerivedData/

What does com.apple.CoreSimulator.CoreSimulatorService do?

Our iOS automation tests on simulator have gone through disaster since upgrading to Xcode6.
We can observe view switching slowing down, UIAutomation felt it too and often returned an empty or not fully updated app main window, you can imagine the stability.
Part of the reason is that we have slow VMs, but still we need to find ways to workaround it.
Then I notice there's the CoreSimulatorService process staying alive between the launches and shutdowns of simulator. So I killed it to see what change would it make:
killall -9 com.apple.CoreSimulator.CoreSimulatorService
After it was killed and relaunched, the performance of simulator seem to get much better, at least I don't see random fails anymore (hopefully). I guess this is kind of cleaning up.
So I hope to get a better idea about what function does CoreSimulatorService perform exactly?
Also, I am confused about where to find the documents when Apple releases new things (forgive my ignorance). For example, I didn't find any documents in iOS developer library mentioning simctl except Xcode Release Note.
Thanks!
I just faced a unexpected CPU spike due to this process (Xcode 12 & macOS 12).
A quick look on the web showed that most of the time your look for com.apple.CoreSimulator.CoreSimulatorService you will find people afraid of "something" and that are resetting everything. Ultimately this will "resolve" (as a workaround) the problem that isn't really one.
I opened ActivityMonitor (and not just looking at iStat Menu CPU widget), I found that the process update_dyld_sim_shared_cache was responsible for this CPU high usage.
Just reading the name show that the process is probably doing something expected after all (I got this issue after an OS update).
I just waited a around half a hour and the CPU went back to normal.

How to have breakpoints in XCode4 work not once, but always - without restarting

I am using XCode4 to write a simple Mac app and my breakpoint only works once until i restart XCode.
After a fresh start of XCode4 build and run triggers the breakpoint again as expected.
But if i then stop the app and build and run again it doesnt stop at the very same breakpoint. It continues execution just as if there was no breakpoint. After restarting XCode it works again. But only one time.
So the question is: What can be done to make it work without restarting XCode4.
I found the (simple) solution:
Even though the "Breakpoints"-Button in the toolbar was already active - deactivating and activating it again did the trick. After doing this i tested it about 4-5 times and it now works without restarting. Even after restarting XCode4 without re-activating Breakpoints it again.
Also: I am using XCode 4.0 at the moment. Maybe this is just a rare problem and perhaps it was fixed in 4.0.1 / 4.0.2 and does not happen anymore.
Anyway, should have tried this before writing the question ;)

Mac OS X 10.5 App "not supported on this architecture" cured by copying?

I have an app that updates itself over the internet, and the updated copy won't run on PowerPC machines (G5) running Leopard (10.5.8). Double-clicking the app produces a message saying "You can't open the application "appname" because it is not supported on this architecture." But here's the weird part: if I duplicate the app using the Finder or using a cp -R command, then the duplicate runs fine! And yet, if I do ls -laeR on both apps, the results are identical. I restarted the machine, and the difference between the two copies was still there.
Sometimes, renaming the app made it run. After a few tries, I managed to rename it back to the original name and still have it run.
If this was just on one machine, I'd dismiss it as disk corruption, cosmic rays, or a voodoo hex, but it was reported by a customer and then I reproduced it on my own machine.
Any ideas what could cause this behavior?
It turns out that the Launch Services database had somehow flagged the app as unsupported, which I verified by using the semi-secret lsregister command line tool to dump the database. Anything that would change the mod date of the app, such as touch, sufficed to make Launch Services wake up and smell the coffee.
Sounds to me like an extended attribute or some other aspect that isn't being carried over to the duplicate of the program files.
Maybe try looking into running the xattr command on the output of ls -laeR on the app bundle?

Resources