openedx / openedx/openedx-platform

Bug: clipboard 500 (deadlock) under parallel authoring load

Open
#39,118 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted
Dominant language
Python
Stars
8.2k
Forks
4.4k
Avg merge
6d 18h
Merged PRs (30d)
42

Description

Copying a block to the clipboard intermittently answers
500 {"error": "The Studio servers encountered an error"}. The CMS log shows:

django.db.utils.OperationalError: (1213, 'Deadlock found when trying to get
lock; try restarting transaction')

from content_staging/views.py:136api.py:189 save_xblock_to_user_clipboard
models.py:176 UserClipboard.save, on the update_or_create of the row.

Load-dependent and somewhat rare: four deadlocks across an E2E CI run. Each
concurrent copy was made by a different user, so the contention is not two writers
on one clipboard row; the surrounding transaction takes locks in an order another
concurrent CMS write can cross.

Expected: retry the deadlock, as the platform does elsewhere for 1213, or
narrow the transaction.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at content_staging/views.py:136, api.py:189, and models.py:176 to trace save_xblock_to_user_clipboard and its update_or_create transaction. Search the platform for existing handling of database error 1213 and compare whether retrying or narrowing the transaction fits this path. Done means concurrent copies no longer return a 500 from deadlocks, with coverage for the affected behavior if the existing test entry point is found.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.