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
EXC_BAD_ACCESS on mutex SQLITE_THREADSAFE sqlite3.c #192
Comments
|
Hm, is this the |
The error occurs when I try to query a table that isn't there. This may be related to #187. The issue, similar to #186, is the need for better error handling. Any idea why FTS4 is not working? |
I'm not sure FTS4 is always available depending on the system library version. Could you provide the following?
|
let _barcode = Expression<String>("barcode")
let _name = Expression<String>("name")
let _level = Expression<String>("level")
let _lastUpdated = Expression<NSDate>("lastUpdated")
if db.create(table: tickets, { t in
t.column(_barcode, primaryKey: true)
t.column(_name)
t.column(_level)
t.column(_lastUpdated)
}).failed == false {
db.create(index: tickets, on: _lastUpdated, unique: false)
db.execute("\n".join([
"CREATE VIRTUAL TABLE ticketSearch USING fts4(content='tickets', name);",
"CREATE TRIGGER tickets_bu BEFORE UPDATE ON tickets BEGIN",
"DELETE FROM ticketSearch WHERE docid=old.rowid;",
"END;",
"CREATE TRIGGER tickets_bd BEFORE DELETE ON tickets BEGIN",
"DELETE FROM ticketSearch WHERE docid=old.rowid;",
"END;",
"CREATE TRIGGER tickets_au AFTER UPDATE ON tickets BEGIN",
"INSERT INTO ticketSearch(docid, name) VALUES(new.rowid, name);",
"END;",
"CREATE TRIGGER tickets_ai AFTER INSERT ON tickets BEGIN",
"INSERT INTO ticketSearch(docid, name) VALUES(new.rowid, new.name);",
"END;"
]))
} (Need to find a better way to detect that I need to create the table - ifNotExists makes failed always false) Devices:
This worked at some point on the same devices (last week). I haven't updated iOS. The only thing that changed was SQLite branch and Carthage version. But even then - I would have that same EXC_BAD_ACCESS sometimes, but not all the time. -- This has also worked with FMDB on the same app without error. |
If you have access to Is this behavior only occurring with Carthage? What's your Cartfile look like? Regardless,
I generally track the schema for migrations in |
Not building it myself. It's referencing it in sqlcipher. But Carthage builds that as a separate framework and I'm not including that... I don't need sqlcipher. How is that happening? Could the SQLite.framework file be getting replaced when Carthage builds sqlcipher? If that's the case, that's another issue in itself - Carthage is building both. |
Ah, that's the issue! SQLite.swift currently bundles SQLCipher support in the same repo. Because of this, SQLite.swift on the I need to extract SQLCipher support out into its own repo. It's causing too many problems when bundled. |
Yeah, that was it. It was a pain to get only SQLite to build. Xcode's caching is agressive. Even after I manually removed SQLiteCipher target from Carthage/Checkouts I had to clear derived data / build folder from both my project and the SQLite project. Separating it makes sense. Although I wish you could select a scheme in Carthage:
|
One possible quick fix is to mark the SQLiteCipher scheme as not shared. That way Carthage will ignore it. That way you can keep SQLiteCipher where it is for now. |
Tracking "Separate out SQLiteCipher" at #311. Closing this unless there are objections. |
I'm getting this crash when doing a select query (sqlite.c):
What'd odd about this is it doesn't happen all the time. If I reinstall the app it sometimes doesn't happen. But once it starts happening, I usually can't get it to go away.
Any idea what could be causing this?
The text was updated successfully, but these errors were encountered: