Page 1 of 1

Preventing Race Conditions in SmartForms with LISE

Posted: Fri Sep 19, 2025 4:02 pm
by WDJames
Hello,

I have a booking form (using SmartForms) that, on submission, checks if an event (LISE item) has any spaces available. It does this by reading the value of the "spaces" field (UDT).

If spaces are available, the form updates the event's spaces, saves the booking (in another LISE instance), and completes the rest of the dispositions.

The issue I'm running into is race conditions - multiple submissions can overlap and allow overbooking.

Is there a way in my UDT to access a LISE item's "spaces" field and lock it while performing the check?

Thanks

James

Re: Preventing Race Conditions in SmartForms with LISE

Posted: Fri Sep 19, 2025 5:06 pm
by Jo Morg
Hi James

at this point there is no locking mechanism in LISE and the one in the works is for the editor, at least for now. But you raise a good point, and I'll look into this for a future release.

A possible solution would require some very smart PHP coding in the UDT, either by using a tmp file with a name that could be meaningful and unique that would be locked immediately on submission and only unlocked at the end of the process whether the booking succeeded or not. I don't know how your system works in detail, but that may work, although I can see some issues with the solution. There can be a few different flavors of this but this would be the gist. Using a db lock would also work but you'd need a bit more complex programing.