mealie icon indicating copy to clipboard operation
mealie copied to clipboard

sqlite3.OperationalError: database is locked

Open matthewfcarlson opened this issue 1 year ago • 1 comments

First Check

  • [X] This is not a feature request
  • [X] I added a very descriptive title to this issue.
  • [X] I used the GitHub search to find a similar issue and didn't find it.
  • [X] I searched the Mealie documentation, with the integrated search.
  • [X] I already read the docs and didn't find an answer.
  • [X] I have checked for existing issues that have been resolved in v1-beta

What is the issue you are experiencing?

Basically, I've deployed mealie to Azure and used the file storage to make a volume to /app/data, but I get the database locked. Early attempts to use postgres haven't gone great. This issue is somewhat similar but I'm not sure the concept of permissions applies here like it does to local deployments. Here's the error:

Production
2022-07-19T15:24:49.606255953Z usermod: no changes
2022-07-19T15:24:49.658722980Z 
2022-07-19T15:24:49.658759280Z     User uid:    911
2022-07-19T15:24:49.658802381Z     User gid:    911
2022-07-19T15:24:49.658808381Z     
2022-07-19T15:25:06.627708122Z Traceback (most recent call last):
2022-07-19T15:25:06.627741723Z   File "/opt/pysetup/.venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1802, in _execute_context
2022-07-19T15:25:06.627750423Z     self.dialect.do_execute(
2022-07-19T15:25:06.627754923Z   File "/opt/pysetup/.venv/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
2022-07-19T15:25:06.627764623Z     cursor.execute(statement, parameters)
2022-07-19T15:25:06.627768923Z sqlite3.OperationalError: database is locked
2022-07-19T15:25:06.627773023Z 
2022-07-19T15:25:06.627777023Z The above exception was the direct cause of the following exception:
2022-07-19T15:25:06.627781123Z 
2022-07-19T15:25:06.627785023Z Traceback (most recent call last):
2022-07-19T15:25:06.627789423Z   File "/app/mealie/db/init_db.py", line 5, in <module>
2022-07-19T15:25:06.627793823Z     from mealie.db.db_setup import create_session
2022-07-19T15:25:06.627797723Z   File "/app/mealie/db/db_setup.py", line 5, in <module>
2022-07-19T15:25:06.627801923Z     SessionLocal = sql_global_init(settings.DB_URL)
2022-07-19T15:25:06.627805723Z   File "/app/mealie/db/models/db_session.py", line 17, in sql_global_init
2022-07-19T15:25:06.627809924Z     SqlAlchemyBase.metadata.create_all(engine)
2022-07-19T15:25:06.627813824Z   File "/opt/pysetup/.venv/lib/python3.9/site-packages/sqlalchemy/sql/schema.py", line 4785, in create_all
2022-07-19T15:25:06.627817924Z     bind._run_ddl_visitor(
2022-07-19T15:25:06.627821724Z   File "/opt/pysetup/.venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3117, in _run_ddl_visitor
2022-07-19T15:25:06.627825724Z     conn._run_ddl_visitor(visitorcallable, element, **kwargs)
2022-07-19T15:25:06.627829724Z   File "/opt/pysetup/.venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2113, in _run_ddl_visitor
2022-07-19T15:25:06.645367445Z     visitorcallable(self.dialect, self, **kwargs).traverse_single(element)
2022-07-19T15:25:06.645926453Z   File "/opt/pysetup/.venv/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py", line 524, in traverse_single
2022-07-19T15:25:06.646767763Z     return meth(obj, **kw)
2022-07-19T15:25:06.647536573Z   File "/opt/pysetup/.venv/lib/python3.9/site-packages/sqlalchemy/sql/ddl.py", line 849, in visit_metadata
2022-07-19T15:25:06.648042279Z     self.traverse_single(
2022-07-19T15:25:06.655854378Z   File "/opt/pysetup/.venv/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py", line 524, in traverse_single
2022-07-19T15:25:06.656968592Z     return meth(obj, **kw)
2022-07-19T15:25:06.657449898Z   File "/opt/pysetup/.venv/lib/python3.9/site-packages/sqlalchemy/sql/ddl.py", line 893, in visit_table
2022-07-19T15:25:06.658164807Z     self.connection.execute(
2022-07-19T15:25:06.668179934Z   File "/opt/pysetup/.venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1289, in execute
2022-07-19T15:25:06.668214434Z     return meth(self, multiparams, params, _EMPTY_EXECUTION_OPTS)
2022-07-19T15:25:06.668219534Z   File "/opt/pysetup/.venv/lib/python3.9/site-packages/sqlalchemy/sql/ddl.py", line 80, in _execute_on_connection
2022-07-19T15:25:06.668223634Z     return connection._execute_ddl(
2022-07-19T15:25:06.668227234Z   File "/opt/pysetup/.venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1381, in _execute_ddl
2022-07-19T15:25:06.668231234Z     ret = self._execute_context(
2022-07-19T15:25:06.668234835Z   File "/opt/pysetup/.venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1845, in _execute_context
2022-07-19T15:25:06.668238535Z     self._handle_dbapi_exception(
2022-07-19T15:25:06.668242035Z   File "/opt/pysetup/.venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2026, in _handle_dbapi_exception
2022-07-19T15:25:06.668245835Z     util.raise_(
2022-07-19T15:25:06.668249335Z   File "/opt/pysetup/.venv/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
2022-07-19T15:25:06.668253035Z     raise exception
2022-07-19T15:25:06.668256435Z   File "/opt/pysetup/.venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1802, in _execute_context
2022-07-19T15:25:06.668260135Z     self.dialect.do_execute(
2022-07-19T15:25:06.668263535Z   File "/opt/pysetup/.venv/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 732, in do_execute
2022-07-19T15:25:06.668267235Z     cursor.execute(statement, parameters)
2022-07-19T15:25:06.668270735Z sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked
2022-07-19T15:25:06.737161606Z [SQL: 
2022-07-19T15:25:06.737206006Z CREATE TABLE event_notifications (
2022-07-19T15:25:06.737211206Z 	id INTEGER NOT NULL, 
2022-07-19T15:25:06.737215206Z 	name VARCHAR, 
2022-07-19T15:25:06.737218707Z 	type VARCHAR, 
2022-07-19T15:25:06.737222407Z 	notification_url VARCHAR, 
2022-07-19T15:25:06.737225807Z 	general BOOLEAN, 
2022-07-19T15:25:06.737229207Z 	recipe BOOLEAN, 
2022-07-19T15:25:06.737232607Z 	backup BOOLEAN, 
2022-07-19T15:25:06.737236007Z 	scheduled BOOLEAN, 
2022-07-19T15:25:06.737239407Z 	migration BOOLEAN, 
2022-07-19T15:25:06.737242707Z 	"group" BOOLEAN, 
2022-07-19T15:25:06.737246207Z 	user BOOLEAN, 
2022-07-19T15:25:06.737249507Z 	PRIMARY KEY (id)
2022-07-19T15:25:06.737270207Z )
2022-07-19T15:25:06.737273707Z 
2022-07-19T15:25:06.737277007Z ]
2022-07-19T15:25:06.737280307Z (Background on this error at: https://sqlalche.me/e/14/e3q8)

Deployment

Docker (Linux)

Deployment Details

Azure webapp container

Mealie Version

0.5.0

matthewfcarlson avatar Jul 19 '22 16:07 matthewfcarlson

Other have had this same issue on Azure, but as far as I remember they couldn't come to a resolution. I don't have any experience working with azure or their infrastructure, so I'm not sure how much help I can be with this one.

hay-kot avatar Aug 10 '22 05:08 hay-kot

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 09 '22 09:10 stale[bot]