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

StartDict sqlite multi thread exception #41

Closed
urna opened this issue Apr 10, 2019 · 2 comments
Closed

StartDict sqlite multi thread exception #41

urna opened this issue Apr 10, 2019 · 2 comments

Comments

@urna
Copy link

urna commented Apr 10, 2019

sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in thread xxxx

StartDict sqlite class showes above exception with multi thread.
simply I just change "self.__conn = sqlite3.connect(self.__dbname, isolation_level = "IMMEDIATE",check_same_thread = False)", to add last parameter

for lookups/query, it works ok, but for writing, there may be issue.

@skywind3000
Copy link
Owner

You can create multiple StarDict sqlite classes specific to each thread.

@urna
Copy link
Author

urna commented Apr 10, 2019

got it!
we should avoid using shared/global starDict sqlite object, as sqlite is not thread safe!

@urna urna closed this as completed Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants