Repository navigation
Conversation
Copying to the clipboard marks the user's previous StagedContent rows EXPIRED and enqueued `delete_expired_clipboards` from inside the request's transaction. An idle CMS worker could start the task at once and delete the expired row, which cascades to the user's UserClipboard row, while the request went on to `update_or_create` that same row. The two took the locks in opposite orders, MySQL killed the request with a deadlock (1213), and the copy answered 500. Enqueue the cleanup with `transaction.on_commit`, and make both clipboard save functions atomic so the clipboard row is repointed at the new content before the cleanup can run, even when the caller has no transaction open. Closes #39118 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mypy rejected `list[int]` for the ids passed to the clipboard cleanup helper: they are `StagedContent.ID`s, as `delete_expired_clipboards` declares. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bmtcril
force-pushed
the
bmtcril/fix-plat-010
branch
from
October 16, 2026 21:46
b95ecf8 to
6c88f50
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Copying to the clipboard marks the user's previous
StagedContentrowsEXPIREDand enqueueddelete_expired_clipboardsfrom inside the request's transaction. An idle CMS worker could start the task at once and delete the expired row, which cascades to the user'sUserClipboardrow, while the request went on toupdate_or_createthat same row. The two took the locks in opposite orders, MySQL killed the request with a deadlock (1213), and the copy answered 500.Enqueue the cleanup with
transaction.on_commit, and make both clipboard save functions atomic so the clipboard row is repointed at the new content before the cleanup can run, even when the caller has no transaction open.Closes #39118