Race condition when using queue

Created on 6 March 2023, over 1 year ago
Updated 30 April 2024, about 2 months ago

Problem/Motivation

If you set up a field to use queue, there is a race condition where the field can be edited before cron runs.

Steps to reproduce

- set up a field to use queue
- create a node and set the field to refer to taxonomy term 1
- delete taxonomy term 1, which queues deletion of the node's delta 0 item
- edit the node so that the delta 0 item now refers to taxonomy term 2
- run cron
- observe that the node no longer refers to taxonomy term 2

Proposed resolution

When queueing a field item for deletion, make note of its target id. When processing the queue, check the field item's target id, to make sure it hasn't changed since the item was queued for deletion.

User interface changes

None.

API changes

The signature of entity_reference_purger_add_to_queue() changes, but only to add an optional $target_id argument, so BC is preserved.

Data model changes

The queue item structure changes, again to add an optional 'target_id' item.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States ksenzee Seattle area

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024