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 can lead to negative stock #6363

Closed
TWarszawski opened this Issue Aug 26, 2016 · 9 comments

Comments

@TWarszawski
Copy link

TWarszawski commented Aug 26, 2016

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.
@Galillei

This comment has been minimized.

Copy link

Galillei commented Nov 10, 2016

Does any one have solution? We set one product to sale and after that we have quantity of product=-14. We use 18 instances of frontend;

@Drnutsu

This comment has been minimized.

Copy link

Drnutsu commented Apr 28, 2017

anyone have the solution for this issue? I think its critical issues.

@feronera

This comment has been minimized.

Copy link

feronera commented Jun 5, 2017

me too with CE 2.1.5 - 2.1.7

@veloraven

This comment has been minimized.

Copy link
Contributor

veloraven commented Jun 12, 2017

Internal ticket was created for this issue - MAGETWO-69701

@Galillei

This comment has been minimized.

Copy link

Galillei commented Sep 15, 2017

This solution https://belvg.com/blog/magento-2-oversell-fix.html are working for us

@magento-engcom-team

This comment has been minimized.

Copy link
Contributor

magento-engcom-team commented Oct 6, 2017

@TWarszawski, thank you for your report.
We've created internal ticket(s) MAGETWO-69701 to track progress on the issue.

@bordeo

This comment has been minimized.

Copy link
Contributor

bordeo commented Oct 18, 2017

The bug still exists in 2.1.9

@bordeo

This comment has been minimized.

Copy link
Contributor

bordeo commented Dec 28, 2017

Any update on this?

magento-team pushed a commit that referenced this issue Jan 3, 2018

Merge pull request #1897 from magento-qwerty/2.1-PR-20171221
Fixed issues:
- MAGETWO-59163: Category product count incorporating products with visibility set to search only
- MAGETWO-69701: [GitHub] Concurrent checkouts can lead to negative stock #6363 [backport 2.1]

@szreka szreka self-assigned this Mar 24, 2018

@szreka szreka moved this from TODO to Development in Progress in Community Dashboard Mar 24, 2018

@sidolov

This comment has been minimized.

Copy link
Contributor

sidolov commented Apr 14, 2018

Hi @TWarszawski , current issue was fixed in 2.2-develop branch (commit: f726dac)

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