Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Concurrent checkouts allocate more stocks to customers than the quantity available #543
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:
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: