Replies: 2 comments 17 replies
-
Hi. Thanks for such a warm feedback! This issue looks as usual multi-threading issue. Storage doesn't handle multi-threading for, it just passed the calls to SQLite engine. Of course there is a small responsibility area of storage itself which probably has to be covered with multi-threading primitives to handle cases like this but it will reduce performance in single-threaded apps. Quick advice: try to call |
Beta Was this translation helpful? Give feedback.
-
What you are reporting here seems really odd. Can you check the result of SQLite3 itself supports multiple concurrency modes, however it is threadsafe by default. There is a whole range of information available to give you a complete picture of multithreading and multiple access to a single database in SQLite: Especially because you are using a fresh sqlite_orm 'storage' instance on every call there should be no problem, as I understand it. Like @fnc12 I also suggest that you create the sqlite_orm 'storage' instance only once (i.e. a singleton), and use |
Beta Was this translation helpful? Give feedback.
-
First of, hi and thank you for this project. It makes working against SQLite databases a lot easier.
It seems like I've managed to run into a multi-threaded issue. I am creating the storage as per below:
When in the main thread I can simply do something like this:
and that works absolutely fine. However, If I then do the exact same thing in another thread it will simple crash as per the backtrace:
It seems that calling from a different thread causes sqlite3_mutex_enter to want to dereference a mutex that isn't set? I've looked though the issues on here that I found that talked about multi-threading and I've also tried reading up on how to do multi-threading with only SQLite3 but for the life of me I can't figure it out. I've tried both version 1.9 and version 1.8.2 from conan.
Thankful for any help!
Beta Was this translation helpful? Give feedback.
All reactions