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

Vouchers can be used past their usage limit under concurrent access #544

Closed
TWarszawski opened this Issue Aug 17, 2016 · 0 comments

Comments

Projects
None yet
4 participants
@TWarszawski
Copy link

TWarszawski commented Aug 17, 2016

When two customers check out concurrently using a voucher that has a usage limit of one, the voucher can be used twice.

Steps to reproduce:

  1. Start demo site, create two customers, create/pick test product, create test voucher with usage limit of 1.
  2. Both customers add the product to their baskets. Perform a checkout concurrently, apply voucher right before placing the order. Make 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:
https://gist.github.com/TWarszawski/a0d8dd8aea9eb5b774d64c9f826de6db

Expected Result:
Only one checkout successfully completes using the voucher.

Actual Result:
Both checkouts successfully complete using the voucher.

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