This is for sure not an important bug. I file it just for information, perhaps it may serve to further improve calibre-web a little.
Describe the bug/problem
When trying to log in into calibre-web, i run into the error below. I run Calibre-server and Calibre-web simultaneously, because I need Calibre-server for adding new books automatically via crontab, while I need Calibre-web to synchronize everything with my kobo.
Due to an error in an automated script that I wrote, there are 394 books, mostly with the same title and and the same author, in the library.
The error disappears, when I delete the duplicate e-books.
To Reproduce
Steps to reproduce the behavior:
- set up calibre-server
- set up calibre-web
- load 400 books with the same title and author into the library
- try to open the web interface of calibre-web ( 192.168.xx.xx:8083 )
- See error:
Calibre-Web 500 Internal Server Error The server encountered an internal error and was unable to complete your request. There is an error in the application. Traceback (most recent call last): File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context self.dialect.do_execute( File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute cursor.execute(statement, parameters) sqlite3.OperationalError: database is locked The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/calibre/calibreweb/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app response = self.full_dispatch_request() File "/home/calibre/calibreweb/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/calibre/calibreweb/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request rv = self.dispatch_request() File "/home/calibre/calibreweb/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) File "/home/calibre/calibreweb/lib/python3.9/site-packages/calibreweb/cps/usermanagement.py", line 35, in decorated_view return login_required(func)(*args, **kwargs) File "/home/calibre/calibreweb/lib/python3.9/site-packages/flask_login/utils.py", line 303, in decorated_view return current_app.ensure_sync(func)(*args, **kwargs) File "/home/calibre/calibreweb/lib/python3.9/site-packages/calibreweb/cps/web.py", line 781, in index return render_books_list("newest", sort_param, 1, page) File "/home/calibre/calibreweb/lib/python3.9/site-packages/calibreweb/cps/web.py", line 399, in render_books_list entries, random, pagination = calibre_db.fill_indexpage(page, 0, db.Books, True, order[0], File "/home/calibre/calibreweb/lib/python3.9/site-packages/calibreweb/cps/db.py", line 730, in fill_indexpage return self.fill_indexpage_with_archived_books(page, database, pagesize, db_filter, order, False, File "/home/calibre/calibreweb/lib/python3.9/site-packages/calibreweb/cps/db.py", line 775, in fill_indexpage_with_archived_books entries = self.order_authors(entries, True, join_archive_read) File "/home/calibre/calibreweb/lib/python3.9/site-packages/calibreweb/cps/db.py", line 785, in order_authors ids = [a.id for a in entry.Books.authors] File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/orm/attributes.py", line 482, in __get__ return self.impl.get(state, dict_) File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/orm/attributes.py", line 942, in get value = self._fire_loader_callables(state, key, passive) File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/orm/attributes.py", line 978, in _fire_loader_callables return self.callable_(state, passive) File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/orm/strategies.py", line 912, in _load_for_state return self._emit_lazyload( File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/orm/strategies.py", line 1046, in _emit_lazyload result = session.execute( File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1714, in execute result = conn._execute_20(statement, params or {}, execution_options) File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1705, in _execute_20 return meth(self, args_10style, kwargs_10style, execution_options) File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 334, in _execute_on_connection return connection._execute_clauseelement( File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1572, in _execute_clauseelement ret = self._execute_context( File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1943, in _execute_context self._handle_dbapi_exception( File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2124, in _handle_dbapi_exception util.raise_( File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 211, in raise_ raise exception File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context self.dialect.do_execute( File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked [SQL: SELECT authors.id AS authors_id, authors.name AS authors_name, authors.sort AS authors_sort, authors.link AS authors_link FROM authors, books_authors_link WHERE ? = books_authors_link.book AND authors.id = books_authors_link.author] [parameters: (481,)] (Background on this error at: https://sqlalche.me/e/14/e3q8) Please report this issue with all related information: [Issue erzeugen](https://github.com/janeczku/calibre-web/issues/new?assignees=&labels=&template=bug_report.md&title=)
Logfile
Calibre-Web 500 Internal Server Error The server encountered an internal error and was unable to complete your request. There is an error in the application. Traceback (most recent call last): File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context self.dialect.do_execute( File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute cursor.execute(statement, parameters) sqlite3.OperationalError: database is locked The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/calibre/calibreweb/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app response = self.full_dispatch_request() File "/home/calibre/calibreweb/lib/python3.9/site-packages/flask/app.py", line 1518, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/calibre/calibreweb/lib/python3.9/site-packages/flask/app.py", line 1516, in full_dispatch_request rv = self.dispatch_request() File "/home/calibre/calibreweb/lib/python3.9/site-packages/flask/app.py", line 1502, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) File "/home/calibre/calibreweb/lib/python3.9/site-packages/calibreweb/cps/usermanagement.py", line 35, in decorated_view return login_required(func)(*args, **kwargs) File "/home/calibre/calibreweb/lib/python3.9/site-packages/flask_login/utils.py", line 303, in decorated_view return current_app.ensure_sync(func)(*args, **kwargs) File "/home/calibre/calibreweb/lib/python3.9/site-packages/calibreweb/cps/web.py", line 781, in index return render_books_list("newest", sort_param, 1, page) File "/home/calibre/calibreweb/lib/python3.9/site-packages/calibreweb/cps/web.py", line 399, in render_books_list entries, random, pagination = calibre_db.fill_indexpage(page, 0, db.Books, True, order[0], File "/home/calibre/calibreweb/lib/python3.9/site-packages/calibreweb/cps/db.py", line 730, in fill_indexpage return self.fill_indexpage_with_archived_books(page, database, pagesize, db_filter, order, False, File "/home/calibre/calibreweb/lib/python3.9/site-packages/calibreweb/cps/db.py", line 775, in fill_indexpage_with_archived_books entries = self.order_authors(entries, True, join_archive_read) File "/home/calibre/calibreweb/lib/python3.9/site-packages/calibreweb/cps/db.py", line 785, in order_authors ids = [a.id for a in entry.Books.authors] File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/orm/attributes.py", line 482, in __get__ return self.impl.get(state, dict_) File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/orm/attributes.py", line 942, in get value = self._fire_loader_callables(state, key, passive) File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/orm/attributes.py", line 978, in _fire_loader_callables return self.callable_(state, passive) File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/orm/strategies.py", line 912, in _load_for_state return self._emit_lazyload( File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/orm/strategies.py", line 1046, in _emit_lazyload result = session.execute( File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1714, in execute result = conn._execute_20(statement, params or {}, execution_options) File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1705, in _execute_20 return meth(self, args_10style, kwargs_10style, execution_options) File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 334, in _execute_on_connection return connection._execute_clauseelement( File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1572, in _execute_clauseelement ret = self._execute_context( File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1943, in _execute_context self._handle_dbapi_exception( File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2124, in _handle_dbapi_exception util.raise_( File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 211, in raise_ raise exception File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context self.dialect.do_execute( File "/home/calibre/calibreweb/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked [SQL: SELECT authors.id AS authors_id, authors.name AS authors_name, authors.sort AS authors_sort, authors.link AS authors_link FROM authors, books_authors_link WHERE ? = books_authors_link.book AND authors.id = books_authors_link.author] [parameters: (481,)] (Background on this error at: https://sqlalche.me/e/14/e3q8) Please report this issue with all related information: [Issue erzeugen](https://github.com/janeczku/calibre-web/issues/new?assignees=&labels=&template=bug_report.md&title=)
Expected behavior
I would expect4 calibre to start normally, with a lot of same e-books.
Environment (please complete the following information):
- OS: Debian 11
- Python version: python 2.7.18
- Calibre-Web version: 0.6.19 -- unknown git clone
- Docker container: None, the install is in a virtual environment
- Browser: Mozilla Firefox
Additional context
The access is in a local network. I