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

EXEC BAD ACCESS. Device only #157

Closed
leandromperez opened this issue Apr 13, 2017 · 7 comments
Closed

EXEC BAD ACCESS. Device only #157

leandromperez opened this issue Apr 13, 2017 · 7 comments

Comments

@leandromperez
Copy link

Hi @ilyapuchka I am attaching the stack trace for the crashing thread.

This is the log:
Resolving type DataInitializer with arguments ()
Resolving type Database with arguments () while injecting in type DataInitializer
Resolving type CoreDataService with arguments () while injecting in type Database

AppDelegate.swift.txt
AppDependencies.swift.txt
CoreDataService copy.swift.txt

StackTrace Thread 1.txt

I am still trying to find the issue.

Thanks!

@ilyapuchka
Copy link
Collaborator

Do you have any optimisations in build settings?
If you have any IUO properties in the registered types try to turn them to Optionals and see if crash still happens.

@leandromperez
Copy link
Author

I have no optimizations.
I don't have any IUO in the objects being resolved. I do have IUO in other dependencies, but none in those 3 objects.

@ilyapuchka
Copy link
Collaborator

ilyapuchka commented Apr 13, 2017

Can you try turning your lazy properties in CoreDataService to optionals and initialise them in init and see if it helps? I think it might cause issues as we try to access those properties for the first time through Mirror.

@leandromperez
Copy link
Author

I removed all the other app dependencies and left only the CoreDataService. I removed the lazy properties and it worked again. As you thought, that is the issue.
Any ideas on why it only happens in the device?

@ilyapuchka
Copy link
Collaborator

Don't know to be honest, but there were some issues regarding mirroring types with IUO properties (and lazy is still optional, so it might be related). Maybe it is also affected by the fact that it is CoreData types... Will try to reproduce that on a weekend and probably file a bug for Swift, or I will try to come up with some fix to avoid accessing lazy properties while doing auto-injection, as we already do for IUO properties, probably simply by ignoring any property with optional type.
At least now you know what is the issue and I hope not using lazy properties, if any hotfix will not work, will not be a a big issue for you.

@ilyapuchka
Copy link
Collaborator

Btw you might also try to turn your lazy properties to IUO, that might help as we skip accessing them during auto-injection, so it might work for you without any other fixes on our side

@leandromperez
Copy link
Author

Thanks for everything @ilyapuchka. Removing the lazy properties fixed the problem. I added some code and created a pull request so you can reproduce the crash if you want to.

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

2 participants