Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Race condition in HTTP API for submit/modify #907

@virtuald

Description

@virtuald

Assuming you support multiple HTTP clients (I didn't see anything saying you don't), there's a race condition in the HTTP API.

If a client tries to submit a unit using /units/NAME, and someone else does it before they do, then they will not receive any notification that the submission failed. This is because the same endpoint is used for modify and submit, so a modify operation happens instead. However, I don't believe the client is currently told which one happened.

One could try to work around this by checking to see if the unit exists before submitting it, but obviously the race condition is even larger then. Another workaround is inspecting the state of the unit after you submit it to make sure it matches what you think it should be -- but it seems like that shouldn't be necessary.

Ideally, the API should either use different endpoints for modify/submit, or return a status indicating which of the two actions happened.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions