Skip to content

Job signature system is not thread safe #317

@mfendeksilverstripe

Description

@mfendeksilverstripe

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions