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

sqlite3.ProgrammingError sometimes occurs with parallelization #108

Open
timcallow opened this issue Dec 9, 2021 · 0 comments
Open

sqlite3.ProgrammingError sometimes occurs with parallelization #108

timcallow opened this issue Dec 9, 2021 · 0 comments
Assignees
Labels
bug Something isn't working not critical

Comments

@timcallow
Copy link
Contributor

When using multiple cores with joblib, sometimes the following error is raised:

Exception during reset or similar
Traceback (most recent call last):
  File "/home/callow46/.local/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 697, in _finalize_fairy
    fairy._reset(pool)
  File "/home/callow46/.local/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 893, in _reset
    pool._dialect.do_rollback(self)
  File "/home/callow46/.local/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 543, in do_rollback
    dbapi_connection.rollback()
sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 139675633149760 and this is thread id 139675095406336.
Exception closing connection <sqlite3.Connection object at 0x7f08a8e3e030>

The code continues to run after the error is raised and it does not affect the results. However it's annoying since it doesn't look good (and I'm not sure but maybe is capable of causing something critical). It seems random as to whether this error appears or not.

It seems the sqlalchemy library is called indirectly through the mendeleev library imported into atoMEC. This only performs some initialization of the Atom object and joblib is supposed to work in a self-contained way, i.e. multiple threads should only be used during the diagonalization and then the code should return to single threading. So I'm not sure why joblib is interfering with sqalchemy. Either way it would be good to prevent this error from happening, or at the very least tell atoMEC just to ignore this error (I'm not sure how to do this since I don't know when exactly the error is induced).

@DanielKotik any ideas?

@timcallow timcallow added bug Something isn't working not critical labels Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working not critical
Projects
None yet
Development

No branches or pull requests

2 participants