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

Database is locked #30

Open
chust4 opened this issue Sep 15, 2023 · 1 comment
Open

Database is locked #30

chust4 opened this issue Sep 15, 2023 · 1 comment

Comments

@chust4
Copy link

chust4 commented Sep 15, 2023

At seemingly random times I get this error.
The script generally works, adds torrents to qbittorent, but most entries often do not appear in the seedcross list

Internal Server Error: /crseed/processlog

Traceback (most recent call last):

  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute

    return self.cursor.execute(sql, params)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/django/db/backends/sqlite3/base.py", line 423, in execute

    return Database.Cursor.execute(self, query, params)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

sqlite3.OperationalError: database is locked

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "/usr/local/lib/python3.11/site-packages/django/core/handlers/exception.py", line 47, in inner

    response = get_response(request)

               ^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/django/core/handlers/base.py", line 181, in _get_response

    response = wrapped_callback(request, *callback_args, **callback_kwargs)

               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view

    return view_func(request, *args, **kwargs)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/code/seedcross/crseed/views.py", line 333, in ajaxRefreshProcessLog

    log.save()

  File "/usr/local/lib/python3.11/site-packages/django/db/models/base.py", line 739, in save

    self.save_base(using=using, force_insert=force_insert,

  File "/usr/local/lib/python3.11/site-packages/django/db/models/base.py", line 776, in save_base

    updated = self._save_table(

              ^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/django/db/models/base.py", line 858, in _save_table

    updated = self._do_update(base_qs, using, pk_val, values, update_fields,

              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/django/db/models/base.py", line 912, in _do_update

    return filtered._update(values) > 0

           ^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 802, in _update

    return query.get_compiler(self.db).execute_sql(CURSOR)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1559, in execute_sql

    cursor = super().execute_sql(result_type)

             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql

    cursor.execute(sql, params)

  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 98, in execute

    return super().execute(sql, params)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 66, in execute

    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers

    return executor(sql, params, many, context)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in _execute

    with self.db.wrap_database_errors:

  File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 90, in __exit__

    raise dj_exc_value.with_traceback(traceback) from exc_value

  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute

    return self.cursor.execute(sql, params)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.11/site-packages/django/db/backends/sqlite3/base.py", line 423, in execute

    return Database.Cursor.execute(self, query, params)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

django.db.utils.OperationalError: database is locked

"GET /crseed/processlog HTTP/1.1" 500 149378
@ccf-2012
Copy link
Owner

It's SQLite issue, when you have too many torrents, the 'locked' issue may occur.
if you run with source code, set the sqlite db mode to 'wal' may change a bit.

sqlite3 db.sqlite3 'PRAGMA journal_mode=wal;'
cd ..````

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