New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concurrent checkouts allocate more stocks to customers than the quantity available #543

TWarszawski opened this Issue Aug 17, 2016 · 0 comments


None yet
4 participants
Copy link

TWarszawski commented Aug 17, 2016

When two customers check out concurrently for the same product, both checkouts may go through when this would cause the total amount of stock allocated to be larger than the quantity in inventory.

Steps to reproduce:

  1. Start demo site, create two customers, create/pick test product.
  2. Both customers add the product to their baskets such that each basket individually is under the quantity in inventory and together they exceed this quantity. 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 with one customer in one browser window and another customer in a second browser window.

Because this bug depends on concurrent execution, it may be helpful to introduce additional delay between the server and database. If connecting to the database using unix sockets, the following script can act as a proxy that delays packets:

Expected Result:
One of the two checkouts fails (this happens when doing the checkout serially).

Actual Result:
Both checkouts succeed, and the allocated field for the item is greater than quantity in the dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment