open-formulieren / open-forms

Smart and dynamic forms
https://open-forms.readthedocs.io
Other
36 stars 26 forks source link

Possible race condition between image resizing and submission registration. #507

Open sergei-maertens opened 3 years ago

sergei-maertens commented 3 years ago

Images can be uploaded as part of a form, and resizing options are available.

Image resizing is done in a Celery task since they don't need to hold up the request-response cycle, however, resizing must be completed before backend registration is attempted (which also runs in Celery).

So, there's a theoretical chance that resizing is still running while the submission is being sent to a registration backend (or confirmation e-mail). We should track the resizing state & check this in the task for backend registration - if it's still running, it should just be rescheduled at a later time (or use the celery chaining functionality if possible).

Since this is an edge case, we can tackle it later.

joeribekker commented 1 year ago

This got reported via Taiga Horst 56 which upped the priority of this one. Please check the original report if this is the same issue.

sergei-maertens commented 1 year ago

This might very well be the case, the execution time to process a 5MB upload might consistently take longer than the email generation step, causing this race condition to hit consistently.

I will investigate with some data from the affected environment tomorrow.