What is LLDB RPC Server ? When does it crash in Xcode? Why it crashes?

XcodeCrashLldb

Xcode Problem Overview


I am getting a message in my debugger:

>The LLDB RPC server has crashed. The crash log is located in ~/Library/Logs/DiagnosticReports and has a prefix 'lldb-rpc-server'. Please file a bug and attach the most recent crash log.

enter image description here

Xcode Solutions


Solution 1 - Xcode

In my case the LLDB RPC server consistently crashed every time I ran my app, even after cleaning the build folder and removing and reinstalling Xcode (Version 8.3.3 (8E3004b)) completely.

It turned out that apparently LLDB took objection to a breakpoint I had set, just moving this breakpoint by a line resolved the issue.

Solution 2 - Xcode

In my case: I update to Xcode Version 9.3 (9E145) recently and Xcode execute to the line with breakpoint then I type "po XXX" commend it will show the same message. I try to delete following files

~/Library/Preferences/com.apple.dt.Xcode.plist
~/Library/Caches/com.apple.dt.Xcode

and it solved. not knowing exactly why but worth to try.

remember to backup those files in order to recovered in case any unexpected situation occur.

Solution 3 - Xcode

Make sure you are not running the app in release mode, if it is in release mode then change it to debug.

Solution 4 - Xcode

I had the same problem and fixed it after I deleted some of the breakpoints. Not sure why this happen at all, but at least you can remove breakpoints and use some NSLog() or print() if you are in Swift and debug with the help of those. Good luck!

Solution 5 - Xcode

Clearly a lot of different causes for this, but for me I was using a DispatchGroup to keep track of multiple async tasks.

I had forgotten to call dispatchGroup.enter() before one of the async tasks (but still calling dispatchGroup.leave() when it finished).

Adding this in fixed the crash for me.

Solution 6 - Xcode

If workspace has lots of breakpoint then it will happen, So try to remove all the break point and see the magic.

Solution 7 - Xcode

For me just restarting the simulator worked.

Solution 8 - Xcode

I found the solution to this issue. I don't know is this correct or not, but this solution is work for me. what I did is Actually I connected two devices to my mac mini, in one device I run the app and get the above error in my console. Then I removed one device and tried, this time I didn't get any error in my console its worked fine. I think you guys won't believe this, I tried Almost 3 time with two devices and one device its only work for one device

Solution 9 - Xcode

This error occurs for different reasons and the main one is when you add a watch app later to your project where Xcode adds an extra build target to scheme. click on scheme section in right side of "run/stop buttons" then hit on edit scheme, hit on Build section which is the first one, There you see 2 targets one has 2 sub targets which includes watch app and watch extension in it and the other one has no sub targets and it is a watch app target.

Solution is simple delete the watch app target which has no sub targets and run the app again.

Solution 10 - Xcode

For me, I had an expression in my watch list that it was barfing on. When looking at the crash logs in Console, there was something like this on the reported crashed thread which gave it away:

lldb_private::EvaluateExpressionOptions const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, lldb_private::ValueObject*) + 619
17  com.apple.LLDB.framework      	0x0000000102855f18 lldb::SBFrame::**EvaluateExpression**(char const*, lldb::SBExpressionOptions const&) + 696
18  lldb-rpc-server               	0x00000001025e72e9 rpc_server::_ZN4lldb7SBFrame18EvaluateExpressionEPKcRKNS_19SBExpressionOptionsE::HandleRPCCall(rpc_common::Connection&, rpc_common::RPCStream&, rpc_common::RPCStream&) + 169
19  lldb-rpc-server               	0x00000001025f8ce1 rpc_common::Connection::PrivateHandleRPCPacket(rpc_common::RPCPacket&, rpc_common::RPCPacket&, bool&) + 1553
20  lldb-rpc-server               	0x00000001025fc36d Packets::ProcessPackets() + 1005
21  lldb-rpc-server               	0x00000001025fbe96 Packets::ReadThread() + 214
22  lldb-rpc-server               	0x00000001025fbdb9 Packets::RunReadThread(void*) + 9
23  libsystem_pthread.dylib       	0x00007fff6a586109 _pthread_start + 148
24  libsystem_pthread.dylib       	0x00007fff6a581b8b thread_start + 15

Solution 11 - Xcode

I ran across this same error with zero idea of what to do next. I tried the accepted answer and my project didn't have any breakpoints at all.

Turns out I had an observer that I didn't remove and every few times I would push off/on the vc that contained it it would eventually crash with the op's error. I had to enable zombies to figure out which vc was causing the error. I had to manually go through the code line by line to realize I didn't remove the observer. Once I removed it everything worked fine.

// not removing this caused the error
playerItem?.addObserver(self, forKeyPath: #keyPath(AVPlayerItem.status),
                                options: [.old, .new],
                                context: &playerItemContext)

Solution 12 - Xcode

I have found a solution for this, this may not be the perfect but kind a fix my problem.

  1. Go to target Build Settings -> Other Swift Flags -> check Debug Values added Remove everything except $(inherited) and -DDEBUG

  2. Remove Derived Data

  3. Clean and Run

Solution 13 - Xcode

I am having this issue in Xcode 12.1.1 (12A7605b) in January 2021 on macOS Catalina with a Swift project.

I tried Clean, delete Derived data, restarting mac, running on different simulators and real devices - no luck.

Others suggest removing the breakpoint, but for me this breakpoint is needed for debugging (I guess I can figure out how to debug in a different way, with a differently placed breakpoint or with print statements, but that's frustrating).

I filed a bug report with Apple as the error message suggest - I urge others to do the same to increase the chance of a fix by Apple.

In the meanwhile I use this workaround - wrap the code where you want the breakpoint in a DispatchQueue.main.async:

DispatchQueue.main.async { [self] in   
    print("Put the breakpoint on this line")
}

(Note we use [self] here because it's just debug code, but in most cases these async calls need [weak self] to avoid retain cycles and memory leaks)

Solution 14 - Xcode

In my case. I'm also using SQLite.swift to create database. The crashing happened when I tried to change a column data type of an existing table in code(which was not in the right way to do it), then inserted a tuple with new data type, then tried to print all the tuple out.

Solution: Delete the .sqlite3 database file you have or delete the table with conflict data type and recreate them all.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKumar UtsavView Question on Stackoverflow
Solution 1 - XcodeStefanView Answer on Stackoverflow
Solution 2 - Xcodeandrew54068View Answer on Stackoverflow
Solution 3 - XcodeiHulkView Answer on Stackoverflow
Solution 4 - XcodeBoris NikolicView Answer on Stackoverflow
Solution 5 - XcodeJamesView Answer on Stackoverflow
Solution 6 - XcodeNagarView Answer on Stackoverflow
Solution 7 - XcodeNikita Sharma SahuView Answer on Stackoverflow
Solution 8 - XcodesureshView Answer on Stackoverflow
Solution 9 - XcodeDevelopersianView Answer on Stackoverflow
Solution 10 - XcodeJames LittleView Answer on Stackoverflow
Solution 11 - XcodeLance SamariaView Answer on Stackoverflow
Solution 12 - XcodeRocky PereraView Answer on Stackoverflow
Solution 13 - XcodeNikolay SuvandzhievView Answer on Stackoverflow
Solution 14 - XcodeuoopView Answer on Stackoverflow