Problem/Motivation

The revision_manager module has a race condition in QueueGenerator::enqueueIfUnique()
method. Multiple processes (cron runs, batch operations, manual triggers) can
simultaneously attempt to queue the same entity for revision cleanup, causing:

  • Process A checks if key exists → FALSE
  • Process B checks if key exists → FALSE
  • Both processes attempt to INSERT the same primary key → Database constraint violation

Proposed resolution

Add exception handling to gracefully handle the duplicate key scenario:

  • Catch Duplicate entry database exceptions
  • Return FALSE to indicate item was already queued by another process
  • Maintain existing error handling for other exception types
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

j-barnes created an issue. See original summary.

j-barnes’s picture

Status: Active » Needs review

Added exception handling to QueueGenerator::enqueueIfUnique() to gracefully handle when multiple processes attempt to queue the same entity for revision cleanup simultaneously.

sunny-lee’s picture

Status: Needs review » Reviewed & tested by the community

Tested general functionality of revisions and still working as expected. Added taxonomy terms, nodes, media in queue for revisions and did not see any errors so looks good here.

  • j-barnes committed c4227777 on 1.0.x
    Issue #3542945 by j-barnes, sunny-lee: Revision Manager Duplicate Entry
    
j-barnes’s picture

Thanks for testing!

j-barnes’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.