Skip to content
New issue

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

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

Already on GitHub? # to your account

Remove persistent store when closing document #5

Merged
merged 2 commits into from
Jun 2, 2019

Conversation

evanmiller
Copy link

If the persistent store is not manually removed, the file will be unlinked while the SQLite file descriptor is still open, resulting in errors described in evanmiller#2

Note that this PR may result in crashes if client code attempts to access managed objects after document close (e.g. in dealloc methods that access @sythesized relationships to other managed objects or key-value observers that look at managed objects). This client code will need to be fixed.

If the persistent store is not manually removed, the file will be
unlinked while the SQLite file descriptor is still open, resulting
in these errors:

    BUG IN CLIENT OF libsqlite3.dylib: database integrity compromised by
    API violation: vnode unlinked while in use

Note that this change may result in crashes if client code attempts to
modify managed objects after document close (e.g. in dealloc methods
that access @sythesized relationships to other managed objects). This
client code will need to be fixed.
@evanmiller
Copy link
Author

This PR also needs work - the error returned inside performBlockAndWait: needs to be properly retained so it can be accessed elsewhere.

@evanmiller evanmiller changed the title Remove persistent store when closing document WIP Remove persistent store when closing document May 18, 2019
@evanmiller
Copy link
Author

I think this PR is ready for review now.

@evanmiller evanmiller changed the title WIP Remove persistent store when closing document Remove persistent store when closing document May 20, 2019
@jerrykrinock jerrykrinock merged commit 7a22dc5 into jerrykrinock:v0.3.x Jun 2, 2019
@evanmiller evanmiller deleted the remove-before-close branch March 6, 2020 18:55
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants