Skip to content

Concurrent checkouts can lead to negative stock #6363

Closed
@TWarszawski

Description

@TWarszawski

Description:

When two customers check out concurrently for the same product and the total quantity being ordered is greater than the quantity available, the stock can become negative.

Preconditions

  1. Ubuntu 14.04
  2. Xampp 5.6.19
  3. Magento CE 2.1.0 with sample data.

Steps to reproduce

  1. Start site, create two customers, create/pick test product and allocate some stock.
  2. Both customers add the product to their carts such that each cart individually is under (and not equal to) the available stock, but combined they exceed the available stock.
  3. Perform a checkout concurrently, making sure both customers finish checkout (click the 'Place Order’ button) as close to the same time as possible.

We have reproduced this behavior on a single machine, by performing the above steps by simulating one customer in one browser window and another customer in a second browser window.

Expected result

  1. One of the two checkouts fails to complete.

Actual result

  1. Both checkouts succeed and the quantity for the product is negative in the admin console.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: CheckoutIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releasebug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions