Problem/Motivation

The Options/Checkbox limit handler does not work when 2 submissions are being made almost simultaneously.

Steps to reproduce

- Install and enable webform, webform_ui and webform_options_limit.
- Create a webform with a radio element.
- Add an Options/Checkbox limit handler and set the limit for each of the options to "1".
- Open the webform in the frontend in 2 separate tabs to mimic 2 (almost) simultaneous visitors.
- Check the same radio value in both tabs.
- Submit the form in both tabs. Be quick enough by using CTRL+TAB to mimic 2 (almost) simultaneous visitors.

=> If you are slow enough, everything works, but if you switch tabs and submit fast enough (like 2 almost simultaneous visitors would do), both submissions are being saved to the database. The allowed remaining amount is now "-1".

See the attached webform_config.yml and screenrecording.

Expected result

The second submission should show an error message and not be saved to the database.

This has been testen on a clean D9 install, no custom modules.
Logged in with user 1. Caching has been disabled in settings.local.php.

Comments

matthiasm11 created an issue. See original summary.

jrockowitz’s picture

This sounds like a racing condition that will be very difficult to fix since submissions do not perform transaction locking.

jrockowitz’s picture

Status: Active » Closed (won't fix)

I think this is a limitation that we have to accept since we can't have transaction locking enabled for webform submissions.