Job signature system is not thread safe
Running multiple instances of dev tasks which create the same jobs may result in multiple copies of the same job instance with the same signature.
Running multiple dev tasks at the same time is not intentional but this may happen in some situations. For example:
- running a dev task with long execution time via browser may result in the browser thinking that the page is unresponsive and firing a redundant request
- running a dev task with long execution time as a job may result in the queue runner thinking the task job is stale and resuming it
Suggested solution
Inside QueuedJobService::queueJob() wrap the job creation inside transaction (use withTransaction) and change the check for existing job to use the SELECT ... FOR UPDATE approach (similar to job locking).
PR
Job signature system is not thread safe
Running multiple instances of dev tasks which create the same jobs may result in multiple copies of the same job instance with the same signature.
Running multiple dev tasks at the same time is not intentional but this may happen in some situations. For example:
Suggested solution
Inside
QueuedJobService::queueJob()wrap the job creation inside transaction (usewithTransaction) and change the check for existing job to use theSELECT ... FOR UPDATEapproach (similar to job locking).PR