Kumar Utsav
Kumar Utsav

Reputation: 2841

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

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

Upvotes: 77

Views: 72835

Answers (16)

Eduardo Oliveros
Eduardo Oliveros

Reputation: 857

A solution that worked for me was to remove some breakpoints, some breakpoints cause this error, so try to move it a little, and try to not have too many breakpoints.

Upvotes: 0

zhtut
zhtut

Reputation: 1

The problem I encountered was that the main project was objC, the Swift library introduced by Cococapods, and then crashed during breakpoint debugging of the Swift library The solution

  1. Add a swift class to the main project, name it at will, and do not need to add the bridge header file
  2. Switch to project Settings, not Target Settings, and find build_setting SWIFT_ACTIVE_COMPILATION_CONDITIONS adds a DEBUG as follows:

SWIFT_ACTIVE_COMPILATION_CONDITIONS

  • Debug Debug
  • Release

Upvotes: -1

Nikita Sharma Sahu
Nikita Sharma Sahu

Reputation: 335

For me just restarting the simulator worked.

Upvotes: 1

Nikolay Suvandzhiev
Nikolay Suvandzhiev

Reputation: 9065

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)

Upvotes: 0

Nagar
Nagar

Reputation: 73

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

Upvotes: 1

Rakitha
Rakitha

Reputation: 904

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

Upvotes: 0

Lance Samaria
Lance Samaria

Reputation: 19592

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)

Upvotes: 0

James Little
James Little

Reputation: 1

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

Upvotes: 0

Developersian
Developersian

Reputation: 161

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.

Upvotes: 0

suresh
suresh

Reputation: 53

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

Upvotes: 0

iHulk
iHulk

Reputation: 4909

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

Upvotes: 8

James
James

Reputation: 81

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.

Upvotes: 4

andrew54068
andrew54068

Reputation: 1406

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.

Upvotes: 9

uoop
uoop

Reputation: 9

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.

Upvotes: -3

Boris Nikolic
Boris Nikolic

Reputation: 756

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!

Upvotes: 7

Stefan
Stefan

Reputation: 1357

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.

Upvotes: 63

Related Questions