Skip to content

Race Condition Causes Specimen Container Locations to Be Overwritten by Newly Created Specimens #275

@HenriRabalais

Description

@HenriRabalais

Description

A race condition is occurring during the assignment of specimens to containers. When multiple specimens are being assigned to the same container concurrently—such as during batch creation—the location data for previously assigned specimens is being overwritten. This results in:
• Previously assigned specimens appearing as if they were never assigned to the container.
• The newly created specimens occupying container locations that were already taken.

This behaviour suggests that there is no mechanism in place to lock or validate container slots during concurrent assignments, allowing the latest write to override previous data silently.

Steps to Reproduce

1.	Assign specimen A to container X at location Y.
2.	In a separate session, assign specimen B to the same container X at the same or overlapping location.
3.	Observe that specimen A’s location assignment is lost or overwritten by specimen B.

Expected Behavior

Each container slot should be exclusively assigned to one specimen. Assignments should be rejected or deferred if the intended slot is already occupied at the time of the operation.

Suggested Fix

Introduce transactional locking or server-side validation during specimen-container assignment to prevent overwriting existing assignments due to concurrent operations.

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