janeczku / calibre-web

:books: Web app for browsing, reading and downloading eBooks stored in a Calibre database
GNU General Public License v3.0
13.02k stars 1.39k forks source link

Error when setting database configuration after new install #2942

Closed KaaR0l closed 11 months ago

KaaR0l commented 11 months ago

Hello,

Describe the bug/problem I have an existing location containing one calibre library with file "metadata.db".

To Reproduce Steps to reproduce the behavior:

  1. Install CalibreWeb on docker Synology DSM7
  2. Connection with admin/admin123
  3. Set database configuration to "/books" (because my books are in a local folder that is linked to docker folder "/books")
  4. Then Boom ! Big error screen

Logfile Here is the error on the screen :

Traceback (most recent call last):
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1910, in _execute_context
self.dialect.do_execute(
File "/lsiopy/lib/python3.10/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 "/lsiopy/lib/python3.10/site-packages/flask/app.py", line 2190, in wsgi_app
response = self.full_dispatch_request()
File "/lsiopy/lib/python3.10/site-packages/flask/app.py", line 1486, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/lsiopy/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
File "/lsiopy/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/app/calibre-web/cps/usermanagement.py", line 35, in decorated_view
return login_required(func)(*args, **kwargs)
File "/lsiopy/lib/python3.10/site-packages/flask_login/utils.py", line 290, in decorated_view
return current_app.ensure_sync(func)(*args, **kwargs)
File "/app/calibre-web/cps/web.py", line 790, in index
return render_books_list("newest", sort_param, 1, page)
File "/app/calibre-web/cps/web.py", line 408, in render_books_list
entries, random, pagination = calibre_db.fill_indexpage(page, 0, db.Books, True, order[0],
File "/app/calibre-web/cps/db.py", line 803, in fill_indexpage
return self.fill_indexpage_with_archived_books(page, database, pagesize, db_filter, order, False,
File "/app/calibre-web/cps/db.py", line 813, in fill_indexpage_with_archived_books
.limit(self.config.config_random_books).all())
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2773, in all
return self._iter().all()
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2916, in _iter
result = self.session.execute(
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1717, in execute
result = conn._execute_20(statement, params or {}, execution_options)
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1710, in _execute_20
return meth(self, args_10style, kwargs_10style, execution_options)
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 334, in _execute_on_connection
return connection._execute_clauseelement(
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1577, in _execute_clauseelement
ret = self._execute_context(
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1953, in _execute_context
self._handle_dbapi_exception(
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2134, in _handle_dbapi_exception
util.raise_(
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
raise exception
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1910, in _execute_context
self.dialect.do_execute(
File "/lsiopy/lib/python3.10/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 books.id AS books_id, books.title AS books_title, books.sort AS books_sort, books.author_sort AS books_author_sort, books.timestamp AS books_timestamp, books.pubdate AS books_pubdate, books.series_index AS books_series_index, books.last_modified AS books_last_modified, books.path AS books_path, books.has_cover AS books_has_cover, books.uuid AS books_uuid, books.isbn AS books_isbn, books.flags AS books_flags, archived_book.is_archived AS archived_book_is_archived, book_read_link.read_status AS book_read_link_read_status
FROM books LEFT OUTER JOIN book_read_link ON book_read_link.user_id = ? AND book_read_link.book_id = books.id LEFT OUTER JOIN archived_book ON books.id = archived_book.book_id AND archived_book.user_id = ?
WHERE (books.id NOT IN (SELECT 1 FROM (SELECT 1) WHERE 1!=1)) ORDER BY random()
LIMIT ? OFFSET ?]
[parameters: (1, 1, 4, 0)]
(Background on this error at: https://sqlalche.me/e/14/e3q8)

Expected behavior No bug

Environment (please complete the following information):

Thank you for your help !! :) Carole

OzzieIsaacs commented 11 months ago

The error is: sqlite3.OperationalError: database is locked This means, the database is in use by another application, or there is a permission problem accessing the database

KaaR0l commented 11 months ago

I just tried again, and it worked fine. Well, maybe the file was locked, but I don't know by what... Anyway, thanks, it's all good ! :)