Skip to content

deadlock during /api/1.0/work-request/get-next-for-worker/

I have two reports dating back to August 24th of a deadlock during /api/1.0/work-request/get-next-for-worker/:

DETAIL:  Process 1461077 waits for AccessShareLock on tuple (2326,10) of relation 16560 of database 16385; blocked by process 1461058.
Process 1461058 waits for ShareLock on transaction 9403513; blocked by process 1461030.
Process 1461030 waits for ShareLock on transaction 9403528; blocked by process 1461077.

and

DETAIL:  Process 1461060 waits for AccessShareLock on tuple (2326,10) of relation 16560 of database 16385; blocked by process 1461058.
Process 1461058 waits for ShareLock on transaction 9403513; blocked by process 1461030.
Process 1461030 waits for ShareLock on transaction 9403518; blocked by process 1461060.

Including a traceback for the former

CONTEXT:  SQL statement "SELECT 1 FROM ONLY "public"."db_workrequest" x WHERE "id" OPERATOR(pg_catalog.=) $1 FOR KEY SHARE OF x"
) was the direct cause of the following exception:
  File "/usr/lib/python3/dist-packages/asgiref/sync.py", line 486, in thread_handler
    raise exc_info[1]
    ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py", line 42, in inner
    response = await get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/asgiref/sync.py", line 486, in thread_handler
    raise exc_info[1]
    ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/django/core/handlers/base.py", line 253, in _get_response_async
    response = await wrapped_callback(

  File "/usr/lib/python3/dist-packages/asgiref/sync.py", line 448, in __call__
    ret = await asyncio.wait_for(future, timeout=None)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/tasks.py", line 442, in wait_for
    return await fut
           ^^^^^^^^^
  File "/usr/lib/python3/dist-packages/asgiref/current_thread_executor.py", line 22, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/asgiref/sync.py", line 490, in thread_handler
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/contextlib.py", line 80, in inner
    with self._recreate_cm():
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/django/db/transaction.py", line 263, in __exit__
    connection.commit()
    ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/django/db/backends/base/base.py", line 336, in commit
    self._commit()
    ^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/django/db/backends/base/base.py", line 311, in _commit
    with debug_transaction(self, "COMMIT"), self.wrap_database_errors:
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/django/db/backends/base/base.py", line 312, in _commit
    return self.connection.commit()
           ^^^^^^^^^^^^^^^^^^^^^^^^

This happened on debusine.freexian.com.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information