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

Crash opening user profile #3309

Open
sebibasti0815 opened this issue Feb 17, 2025 · 2 comments
Open

Crash opening user profile #3309

sebibasti0815 opened this issue Feb 17, 2025 · 2 comments

Comments

@sebibasti0815
Copy link

Short Notice from the maintainer

After 6 years of more or less intensive programming on Calibre-Web, I need a break.
The last few months, maintaining Calibre-Web has felt more like work than a hobby. I felt pressured and teased by people to solve "their" problems and merge PRs for "their" Calibre-Web.
I have turned off all notifications from Github/Discord and will now concentrate undisturbed on the development of “my” Calibre-Web over the next few weeks/months.
I will look into the issues and maybe also the PRs from time to time, but don't expect a quick response from me.

Please also have a look at our Contributing Guidelines

Describe the bug/problem

A clear and concise description of what the bug is. If you are asking for support, please check our Wiki if your question is already answered there.

To Reproduce

Steps to reproduce the behavior:

  1. Do anything

Logfile

[2025-02-17 15:28:50,674] ERROR {cps:838} Exception on / [GET]
Traceback (most recent call last):
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1964, in _exec_single_context
self.dialect.do_execute(
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 942, 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 1473, in wsgi_app
response = self.full_dispatch_request()
File "/lsiopy/lib/python3.10/site-packages/flask/app.py", line 882, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/lsiopy/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
File "/lsiopy/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
File "/app/calibre-web/cps/usermanagement.py", line 97, in decorated_view
return login_required(func)(*args, **kwargs)
File "/app/calibre-web/cps/cw_login/utils.py", line 296, in decorated_view
return current_app.ensure_sync(func)(*args, **kwargs)
File "/app/calibre-web/cps/web.py", line 842, in index
return render_books_list("newest", sort_param, 1, page)
File "/app/calibre-web/cps/web.py", line 448, 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 819, 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 829, 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 2699, in all
return self._iter().all() # type: ignore
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2853, in _iter
result: Union[ScalarResult[_T], Result[_T]] = self.session.execute(
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2365, in execute
return self._execute_internal(
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2251, in _execute_internal
result: Result[Any] = compile_state_cls.orm_execute_statement(
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/orm/context.py", line 305, in orm_execute_statement
result = conn.execute(
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1416, in execute
return meth(
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 516, in _execute_on_connection
return connection._execute_clauseelement(
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1638, in _execute_clauseelement
ret = self._execute_context(
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1843, in _execute_context
return self._exec_single_context(
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1983, in _exec_single_context
self._handle_dbapi_exception(
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 2352, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1964, in _exec_single_context
self.dialect.do_execute(
File "/lsiopy/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 942, 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/20/e3q8)

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: [e.g. Windows 10/Raspberry Pi OS]
  • Python version: [e.g. python2.7]
  • Calibre-Web version: [e.g. 0.6.8 or 087c4c5 (git rev-parse --short HEAD)]:
  • Docker container: [None/LinuxServer]:
  • Special Hardware: [e.g. Rasperry Pi Zero]
  • Browser: [e.g. Chrome 83.0.4103.97, Safari 13.3.7, Firefox 68.0.1 ESR]

Additional context
Add any other context about the problem here. [e.g. access via reverse proxy, database background sync, special database location]

@sir-wilhelm
Copy link

Since it's just a stack trace and no context, based on

sqlite3.OperationalError: database is locked

it looks like the database is locked/in use. I bet if you restart your computer and make sure calibre is not running and there is only one instance of the web app running it'll start working.

@sebibasti0815
Copy link
Author

I think the deeper problem is sqlite3 in multi-user-usage. Calibre Server and Calibe Web at the same time generate a lot of problems, even including database corruption. As soon as I stopped Calibre Server the problems were gone.

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