Strange kernel data crash with _Unwind_SjLj_Resume after migration

I get a weird crash from some of my beta testers that I'm having problems with. Symbolic crash reports indicate that the crash occurs when the controller is simply distributed as a single element when init is called, but according to the stack trace, it seems that the code that I have in init is not really where the crash happened is an. Here is the relevant code:

 1534| + (UA[REDACTED]PlayerController*)sharedInstance 1535| { 1536| @synchronized(self) 1537| { 1538| if (sharedInstance == nil) 1539| sharedInstance = [[UA[REDACTED]PlayerController alloc] init]; 1540| } 1541| return sharedInstance; 1542| } 

It has never crashed before, and the code has not changed lately. Here is the stack trace laid out:

 Thread 5: 0 libSystem.B.dylib 0x33bd52d4 __kill + 8 1 libSystem.B.dylib 0x33bd52c4 kill + 4 2 libSystem.B.dylib 0x33bd52b6 raise + 10 3 libSystem.B.dylib 0x33be9d26 __abort + 62 4 libSystem.B.dylib 0x33be9d7e abort + 62 5 libSystem.B.dylib 0x33bd7980 __assert_rtn + 152 6 libgcc_s.1.dylib 0x32acab4e _Unwind_SjLj_Resume + 26 7 [REDACTED] 0x00060b64 +[UA[REDACTED]PlayerController sharedInstance] (UA[REDACTED]PlayerController.m:1540) 8 [REDACTED] 0x00063e6c -[UA[REDACTED]PlayerViewController setupControlViews] (UA[REDACTED]PlayerViewController.m:224) 9 [REDACTED] 0x00062ce0 -[UA[REDACTED]PlayerViewController viewDidLoad] (UA[REDACTED]PlayerViewController.m:268) 10 UIKit 0x320a0270 -[UIViewController view] + 104 … 

Any ideas as to what this critical error is and where it might come from?





UPDATE 1
This seems to be related to basic data and migrations. I was able to duplicate it, but the main reason is still unknown. I have some automatic migrations that are in this version, and it seems that although some of NSManagedObjects can be read, others throw this exception, especially regarding NSManagedObjects. It cannot be associated with PlayerController at PlayerController . Do some Core-Data experts have some insight? Strike>




UPDATE 2
Here is the crash call column after I found a way to play it alt text

and corresponding code:
 if (resultArray && [resultArray count]) { for (MixAudio *ma in resultArray) { Audio *audio = [ma valueForKey:LOCAL_MIX_AUDIO_AUDIO_KEY]; if (audio) { [returnArray addObject:audio]; } } 

In order to explain what I did to reproduce it, I have to explain the data structure a bit. I have Mix and Audio elements. Mixes have a lot of audio, audio belongs to many mixes. This is a simple call to relate to MixAudio objects to receive audio. Now this is just a glitch here after . I am restoring a database in a new version.

Backing up the database in my setup means reinstalling the database to save the data, and then decompressing it during recovery. This failure occurs only after recovery. To complicate the situation, there are 3 versions of databases with matching models. Since this process worked for me before the version, I feel that something in my versions causes this crash.

All other data is accurate and can be accessed, even saved. One way or another, this separate sample causes problems. There are no errors or warnings when setting up a persistent storage model or managed objects. In addition, new Mix objects can be created and accessible normally, only unsuccessful retrieval attempts (which were in the database before recovery) are not performed.

If I do not catch the error, the console prints:

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

Putting a try/catch around the failure line allows me to check the root failure reason:

 Error: NSRangeException: *** -[NSMutableArray objectAtIndex:]: index 4294967295 beyond bounds [0 .. 16] 

but it makes no sense (at least for me) for a simple call to valueForKey . 4294967295 = 2 ^ 32-1, which means that the var index was probably set to -1 if that helps. I'm lost here.





[SOLVED] UPDATE 3
I was right about being in the version :) I re-read the version section in the Zarra book and had a big DOH moment. This is the first time I've ever had an application with 3 versions of a database. I use Mapping Models in my application, and I naively believed that the main data would be able to display from 1-2, using one model, then 2-3, using the following. I literally hit my head when I realized that I do not have a 1-3 display model. to test this, I added one quickly and everything was as smooth as butter. Now I just need to go back and use its Progressive Data Migration samples to make my life easier, as I continue to work with a larger version of this database.

I hope Zarra comes here and answers something ... something ... so I can give him points for it :)

+6
iphone core-data crash core-data-migration mapping-model
source share
1 answer

Although the OP was able to resolve its own issue, it is useful to have a clear understanding of migrations.

When you create a second version of your data model, you need a mapping model from version 1 to version 2.

When you create the third model, you need a matching model from one to two. And a card from one to three.

When adding the fourth model, you will need the following models:

  • 1-2
  • 1-3
  • 1-4
  • 2-3
  • 2-4

And he gets more out of there.

+2
source share

All Articles