Skip to content

Concurrent deletion jobs might fail when executed simultaneously #4311

@johha

Description

@johha

Description

When two deletion jobs for the same resource are picked up simultaneously by different workers, the second delete job might fail with an error message like:

Attempt to delete object did not result in a single row modification (Rows Deleted: 0, SQL: DELETE FROM "organizations" WHERE ("id" = 4))

If the jobs are picked up sequentially (or with enough delay), the second deletion job results in a no-op, as the organization cannot be loaded.

Steps to Reproduce

Introduce a sleep in the organization_delete method within the database transaction block.
Trigger two delete requests for the same organization.
Start multiple worker processes/threads to ensure concurrent job execution.

Current Behavior

The later executed job fails with a single row modification error.

Expected Behavior

The second deletion job should result in a no-op and not fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions