Closed semjon00 closed 3 days ago
Thanks for the report. This looks good to me. If you'd like to submit a PR, we can get it merged. Otherwise, I can apply the patch.
It turns out there are more issues that could arise due to using multiple threads.
Hello! Thank you for this nice library! Here is a bug report:
Currently, the databases are accessed using a singleton cursor. Due to the way the cursor is created, the database disallows accessing it from a thread that does not match the thread in which it was created. This may cause the creation of fields to fail if they are created from different threads.
Here is a code that reproduces the issue:
A possible fix would be to substitute the
cls.conn = sqlite3.connect(cls.file)
withcls.conn = sqlite3.connect(cls.file, check_same_thread=False)
inside the constructor ofgalois._databases._interface.DatabaseInterface
. I believe that this is a safe thing to do, since there are no write operations to the database.