Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Attempt at lock fix - #60906

#60906
Open
taylorotwell wants to merge 1 commit into
13.xlaravel/framework:13.xfrom
lock-issuelaravel/framework:lock-issueCopy head branch name to clipboard
Open

Attempt at lock fix#60906
taylorotwell wants to merge 1 commit into
13.xlaravel/framework:13.xfrom
lock-issuelaravel/framework:lock-issueCopy head branch name to clipboard

Conversation

@taylorotwell

Copy link
Copy Markdown
Member

Fixes #60042.

ShouldBeUniqueUntilProcessing jobs need to handle two different retry scenarios:

  • If the unique lock was released before handling and the job later fails, a retry must not release a lock acquired by a newer dispatch.
  • If middleware releases the job before handling, the unique lock remains held and must be released when a later attempt is eventually processed.

Using attempts() <= 1 cannot distinguish these scenarios. It prevents retries from releasing newer locks, but also causes middleware-released jobs to retain their original lock indefinitely.

This change tracks the actual unique lock owner on Queueable jobs and uses ownership-aware lock release:

  • Records the cache lock owner when the unique lock is acquired.
  • Serializes the owner with the queued job so it survives retries.
  • Releases the lock through restoreLock(...)->release().
  • Allows later attempts to release a lock when they carry its owner.
  • Retains the first-attempt guard for legacy and ownerless payloads.
  • Propagates the owner through hidden job context so missing-model cleanup cannot release a replacement lock.
  • Supports queued listeners and custom uniqueVia() stores.

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

Successfully merging this pull request may close these issues.

Changes to ShouldBeUniqueUntilProcessing in #59567 causing lost jobs in 13.5.0

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.