Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application crash on NSManagedObject model.export() take 2 #590

Open
ghost opened this issue Mar 4, 2021 · 4 comments
Open

Application crash on NSManagedObject model.export() take 2 #590

ghost opened this issue Mar 4, 2021 · 4 comments

Comments

@ghost
Copy link

ghost commented Mar 4, 2021

I'm running into the same issue as was reported in August of last year.

When I export the model, the application crashes.
error is ;
Thread 1: EXC_BAD_ACCESS (code=2, address= 0x16bc8bf90)

(NSString *)remotePrefixUsingInflectionType:(SyncPropertyMapperInflectionType)inflectionType {
switch (inflectionType) {
case SyncPropertyMapperInflectionTypeSnakeCase:
return [NSString stringWithFormat:@"%@", [self.entity.name hyp_snakeCase]];
break;
case SyncPropertyMapperInflectionTypeCamelCase:
return [self.entity.name hyp_camelCase];
break;
}
}
it dies in the line return [NSString stringWithFormat:@"%@
", [self.entity.name hyp_snakeCase]];

from what I can see the code is caught in an infinite loop. see attached thread crawl.

bus error thread trace.txt

I've tried changing around my data model in various ways, to no avail. any clue as to what I can try next?

Richard Hood
[email protected]

@3lvis
Copy link
Owner

3lvis commented Mar 4, 2021

Hi Richard, unless we find a way to reproduce it's gonna be hard to find the root cause. Pretty sure the error is inside hyp_snakeCase but hard to pinpoint exactly what's causing it.

Maybe you can isolate the crash to the model that's causing it?

@ghost
Copy link
Author

ghost commented Mar 5, 2021

from what I can see the issue comes up when the inverse relationship is set to many. if a relationship is one to one or the relationship is one to many sync seems to handle it. however, if a relationship is set many and the inverse is set many, sync gets lost in a recursive infinite loop when trying to export it.

I can work around this issue by marking the inverse relationships in my core data model as nonExportable. however, I'm not sure I get all my data exported when I do that.

@3lvis
Copy link
Owner

3lvis commented Mar 7, 2021

Ahhhhh, I believe I understand the problem. Yes, when exporting Sync will iterate forever without finding the end of the loop.

One way to fix this is in the code to make it stop after a certain amount of iterations but not sure if that's a good solution.

@3lvis
Copy link
Owner

3lvis commented Mar 7, 2021

If you have any suggestions I'm happy to hear them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant