Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging SIGABRT within NSManagedObjectContext -save:

From inside NSManagedObjectContext -save: I am getting this message:

Assertion failed: (_Unwind_SjLj_Resume() can't return), function _Unwind_SjLj_Resume, file /SourceCache/libunwind/libunwind-24.1/src/Unwind-sjlj.c, line 326.

Program received signal: “SIGABRT”.

warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib (file not found).

This happens when I delete an Experiment object with to-many with Run which has to-many with Sample which has to-one with Data. Experiment also has to-many with Page which has to-many with Display which has to-many to Run. I mention this to point out the cyclical nature of the graph. Here is a simplified graph of model:

alt text

An Experiment a top level entity with which the user interacts. An Experiment contains multiple Run objects. A Run is a collection of data starting at a particular time and ending at a later time. Since data can be collected from multiple sources simultaneously, there is a Sample for each source for each Run. An Experiment contains data and this data needs to be viewed and interacted with. So, each Experiment has some number of Page objects and each Page contains some number of Displays (e.g., graphs, meters). A Display is configured to display some subset of the Runs that belong to the Experiment. So, while an Experiment may contains dozens of Runs, one of its Pages will only display a few of those Runs at a time. The Display entity maintains this list. A Display is not a view. A view will reference a Display object and be notified of changes to the Display object.

I had been using Delete Rules but have now switched to "No Action" delete rules in combination with -prepareForDeletion methods for all of these classes. This change made no difference. In both cases, the error message is the same.

Interestingly, when I relaunch the app, all the objects that were marked for deletion have been deleted.

Also, if an Experiment has no Run objects, then deletion works without incidence. For that matter, deleting a single Run from an Experiment also works.

I am hoping that someone has seen something like this and can offer advice on what would cause this. Or, if someone has advice on how to get libXcodeDebuggerSupport.dylib for iOS 4.2.1, that might also be helpful.

Update: I followed advice found here and was able to get Xcode to find libXcodeDebuggerSupport.dylib for iOS 4.2.1. But this did not help at all in diagnosing problem - which persists.

Update 2: After reading a bit and downloading a version of unwind-sjlj.c, it seems that I am dealing with something like an uncaught exception. I am not sure how this helps me...

Update 3: Thanks to Kamchatka, I did something I probably should have done a few days ago: turned on "Stop on Objective-C Exceptions". This allowed me to see that a reference to a deleted object was still being held - and, worse, was key-value observing the deleted object. Fixing this fixed problem and I was able to revert to using delete rules rather than -prepareForDeletion methods.

like image 373
westsider Avatar asked Dec 22 '10 02:12

westsider


1 Answers

You should try to activate "Run > Stop on Objective-C exception". It allowed me to find the place where there was an access to an object turned into fault which was the root cause of the problem.

like image 92
Kamchatka Avatar answered Oct 22 '22 13:10

Kamchatka