-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Thread Safe? #259
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
Comments
There's a "Note on Thread Safety" here: Do you have more information related to the crash you're seeing? |
I'm also interested in this. What exactly does "Every database" mean? Every Connection? |
@stephencelis Next time one pops up I'll forward it along, but from memory EXC_BAD_ACCESS is triggering in All crashes have come from operations submitted to an NSOperationQueue where there's a bunch of simultaneous reading and write transactions. This is part of an overall sync between the local DB and a sizable remote data source that triggers ~hourly, so it's fairly intensive on the DB and I wouldn't be surprised if I'm tripping some edge cases here. |
Yep, I'll update the docs to be clearer.
The |
Just ran into this again, but this time it was in filter:
Specifically the stack trace is pointing to this code in Expression.swift: public init<U : ExpressionType>(_ expression: U) {
self.init(expression.template, expression.bindings)
} The code on my end I'm using to make the call looks approximately like this: if let id = object.someId, dateString = object.someDate {
self.operationQueue.addOperationWithBlock {
if let row = db.pluck(table.filter(idField == id).filter(dateField == dateString)) {
// ...
}
}
} If this were Objective-C, I'd say this was probably my fault, I missed a retain somewhere, but I'm still not close to ruling out it's something I'm doing, but it does seem to be related to threading. |
@shnhrrsn Note that PR #290 adds more error trapping, though still not for the If you replace |
Apologies if I missed it, but I looked through the docs and I haven't seen anything mention whether or not SQLite.swift is thread safe.
I'm seeing some random EXC_BAD_ACCESS crashing that pops up inside of SQLite.swift when calling the libsqlite functions and I'm trying to determine if there's a leak or if it's related to using multiple threads to access the DB potentially concurrently.
The text was updated successfully, but these errors were encountered: