andreknieriem / photobooth

A photobooth Web-Application for raspberry pi with gphoto2
https://photobooth.andrerinas.de/
MIT License
300 stars 163 forks source link

Stuck in 'Processing' when backend API fails #173

Closed rawbertp closed 5 years ago

rawbertp commented 5 years ago

Describe the bug This will apply to several use cases but this is the one that I encountered. When e.g. using a filter that takes long (e.g. 'selective-blur') and using PHP's default/a too restrictive max_execution_timeout (30s) the PHP script will be terminated in the mid of running the filter logic:

Fatal error: Maximum execution time of 30+2 seconds exceeded (terminated) in /var/www/html/lib/filter.php on line 133

However, the frontend JS logic doesn't take any notice and keeps waiting for ages.

To Reproduce Steps to reproduce the behavior:

  1. Decrease the max_wait_timeout e.g. to 10 (in my case this is done in /etc/php/7.3/apache2/php.ini) - depending on the host machine you might have to further decrease this timeout; I'm on a Raspberry Pi 4+ and the selective blur filter takes more than 30s on my setup.
  2. Restart Apache
  3. Select the 'SELECTIVE BLUR' image filter and take a photo
  4. After 10 (whatever) seconds the above mentioned error will be thrown in Apache's error.log
  5. The 'Processing' spinner will keep spinning forever

Expected behavior

The UI gets noticed of any errors and reports them to the user or - at least - terminates after a certain (configurable) timeout.

I'm not very familiar with PHP unfortunately, but might it be an option to execute set_time_limit() with a configurable amount of time and apply the same timeout to the JS frontend logic?

Screenshots

n/a

Environment (please complete the following information):

Photobooth

Additional context

sualko commented 5 years ago

However, the frontend JS logic doesn't take any notice and keeps waiting for ages.

I can confirm this issue. There is no error handling at all places.