mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
ListMonitor throws EXC_BAD_ACCESS on deinit #47
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jamesbebbington on GitHub (Mar 29, 2016).
After having upgraded from CoreStore v1.4.4 to v1.6.1 I'm getting a repeatable crash when my
ListMonitoris deinitialized when the controller it is a property of is deallocated:My
ListMonitoris instantiated like so:Explicitly removing the observer when the controller is deallocated doesn't help.
I'm not sure how to go about debugging this one, could you give me some pointers please.
Thanks.
@JohnEstropia commented on GitHub (Mar 29, 2016):
@fractious Are you using a
Tweakclause?@JohnEstropia commented on GitHub (Mar 29, 2016):
btw, is that stacktrace the stopping point of an Exception Breakpoint?
@jamesbebbington commented on GitHub (Mar 29, 2016):
Nope, no
tweaking.It might be also worth noting that this affected me both before and after the upgrade to swift 2.2.
@jamesbebbington commented on GitHub (Mar 29, 2016):
I'll double-check but if I recall correctly, the All Exceptions breakpoint made no difference either way. I also tried Enabling Zombies and the Address Sanitizer but couldn't get anything helpful in the console.
@JohnEstropia commented on GitHub (Mar 29, 2016):
Can you try to add this to
ListMonitor'sdeinitand see if there are any improvements?The stack trace comes from deallocation of a
NotificationObserver, which leads me to believe that it's a release timing problem.@jamesbebbington commented on GitHub (Mar 29, 2016):
No improvement I'm afraid:
@JohnEstropia commented on GitHub (Mar 29, 2016):
can you show me the
7 __lldb_unnamed_function6...part of the stack trace?@jamesbebbington commented on GitHub (Mar 29, 2016):
Here you go:
And the previous frame if that's of any help:
@JohnEstropia commented on GitHub (Mar 29, 2016):
@fractious Looks like a bug happening when the NSFetchRequest captured by a swift closure gets deallocated. Can you try this commit?
48a8694720@jamesbebbington commented on GitHub (Mar 29, 2016):
My dinner is frantically beeping at me now so I'll give it a whirl in a bit. Thanks for taking the time to investigate this, much appreciated. I'll let you know how I get on with it later.
@JohnEstropia commented on GitHub (Mar 29, 2016):
Sure, no problem! Thanks for the report! Weird though, we've never seen this bug before..
@jamesbebbington commented on GitHub (Mar 29, 2016):
No change I'm afraid:
@JohnEstropia commented on GitHub (Mar 30, 2016):
Aww... Can you try running with NSZombies on and see if we find something?
@jamesbebbington commented on GitHub (Mar 30, 2016):
Does this help?
@JohnEstropia commented on GitHub (Mar 30, 2016):
Thanks!
message sent to deallocated instancemeans there's definitely a leak somewhere. I'll try to dig through possible locations.@JohnEstropia commented on GitHub (Mar 30, 2016):
I'm guessing you are importing CoreStore's source files directly in your project? (without using frameworks)
One thing I noticed in your stack trace
CoreStoreFetchedResultsController is being marked as
@objc, which normally wouldn't happen if built as a framework. That in itself is not a problem, but the deallocation behavior probably is different so that's why I can't reproduce it on my side.Anyway try out the commit here:
633ab0a249If it works for you I'll update the master branch.
@jamesbebbington commented on GitHub (Mar 30, 2016):
Actually I'm using cocoapods, my
Podfilebegins:I'll get back to you about that latest commit in about 30 mins.
Cheers.
@jamesbebbington commented on GitHub (Mar 30, 2016):
So
633ab0a249crashes inCoreStoreFetchedResultsController:This is with zombies enabled, nothing is printed to the console
@JohnEstropia commented on GitHub (Mar 31, 2016):
Ookaay... if it's not the delegate that's leaking then this is most probably an ARC bug. I need to find the pattern that triggers it but I cannot reproduce this on my side, so if you have a project that you can send to me that would definitely help.
@jamesbebbington commented on GitHub (Mar 31, 2016):
Thanks John, I'll see if I can make a minimal test case from my app. Where do you want me to send it?
EDIT: An email address please, so I can create you a login to pull down some test data. Thanks.
@JohnEstropia commented on GitHub (Mar 31, 2016):
You can find my address here https://github.com/JohnEstropia/CoreStore/blob/master/CoreStore.podspec
@JohnEstropia commented on GitHub (Mar 31, 2016):
Thanks for the test app! I found the culprit and it seems to be an old Core Data bug: http://stackoverflow.com/questions/14396375/nsfetchedresultscontroller-crashes-in-ios-6-if-affectedstores-is-specified
Seems fixable with an NSFetchRequest subclass (
0b24072259). Try out the develop branch, hopefully it works fine for you.@jamesbebbington commented on GitHub (Mar 31, 2016):
That seems to have done the trick! Loving your work, cheers John.
@JohnEstropia commented on GitHub (Mar 31, 2016):
Great, I'll merge to master and push the pod update then.