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

removeExistingStore not removing associated .sqlite-shm and .sqlite-wal files #85

Closed
3 tasks done
deemadden opened this issue Jun 4, 2016 · 4 comments
Closed
3 tasks done
Assignees
Labels
Milestone

Comments

@deemadden
Copy link

deemadden commented Jun 4, 2016

New issue checklist

General information

  • Library version(s): 4.0.1
  • OS version(s): 9.3.1
  • Devices/Simulators affected: I've only tried it on a 6s and 6s Plus
  • Reproducible in the demo project (Yes/No): Yes
  • Related issues: Affects creating a stack from the CoreDataStackFactory using createStack()

Expected behavior

Should be able to rebuild an empty model and create a stack by calling createStack() after calling removeExistingStore on CoreDataModel

Actual behavior

Fails, throwing a bunch of model errors (see below). I was able to resolve the issue by deleting the model's associated .sqlite-shm an .sqlite-wal files (these are files auto generated at sqlite db creation time in newer versions of iOS)

I was able to determine that deleting the .sqlite-shm and .sqlite-wal files - which live in /Documents, right next to the .sqlite database - fixed the problem.

Steps to reproduce

Call removeExistingStore on your current core data model, attempt to rebuild somewhere thereafter by rebuilding your core data stack using CoreDataStackFactory's createStack()

Crash log? Screenshots? Videos? Sample project?

Error as it appears in the console:
CoreData: error: (522) I/O error for database at [path to sqlite db]. SQLite error code:522, 'not an error' 2016-06-04 15:12:58.537 Golf[6313:1458291] CoreData: error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///[path to sqlite db] options:{ NSInferMappingModelAutomaticallyOption = 1; NSMigratePersistentStoresAutomaticallyOption = 1; } ... returned error Error Domain=NSCocoaErrorDomain Code=522 "(null)" UserInfo={NSSQLiteErrorDomain=522, NSUnderlyingException=I/O error for database at [path to sqlite db]. SQLite error code:522, 'not an error'} with userInfo dictionary { NSSQLiteErrorDomain = 522; NSUnderlyingException = "I/O error for database at [path to sqlite db]. SQLite error code:522, 'not an error'"; }

@jessesquires jessesquires self-assigned this Jun 5, 2016
@jessesquires jessesquires added this to the 4.0.2 milestone Jun 5, 2016
@jessesquires
Copy link
Owner

Thanks so much @deemadden ! 👍

I'll get this fixed soon, and release 4.0.2 — unless you want to submit a PR.

@deemadden
Copy link
Author

Sure @jessesquires I pretty much have the fix written. I can find the spot to put it and submit one.

@jessesquires
Copy link
Owner

Notes on sqlite temp files:
https://www.sqlite.org/tempfiles.html

@deemadden
Copy link
Author

Thanks @jessesquires

jessesquires added a commit that referenced this issue Jun 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants