Comment 34 for bug 1677578

The next I tried was checking newer versions from [1].
There currently is the more recent combination:
- php-imagick 3.4.3~rc2-2
- php* 7.1.3+-3

It is interesting that with those the error is not triggering.

But while in the past the kill was like this:
  (mod_fastcgi.c.2543) FastCGI-stderr: PHP Fatal error: Maximum execution time of 60 seconds exceeded in /var/www/html/index.php on line 30

It now is like this:
  (mod_fastcgi.c.2424) unexpected end-of-file (perhaps the fastcgi process died): pid: 11582 socket: unix:/var/run/lighttpd/php.socket-0
  (mod_fastcgi.c.3175) response not received, request sent: 824 on socket: unix:/var/run/lighttpd/php.socket-0 for /index.php?, closing connection

=> With that the php-cgi process really dies, the pid is gone and php-cgi respawns a new one - thereby naturally the huge allocation is gone.

OTOH If I let run the process longer and let it be killed by max-execution time while back in my busy loop php code it is killed normally by a message like
  (mod_fastcgi.c.2543) FastCGI-stderr: PHP Fatal error: Maximum execution time of 60 seconds exceeded in /var/www/html/index.php on line 31

That said the newer versions seem already seem have a change in their handling that avoids the issue. When execution is in a plugin and the timeout occurs it seems that the whole process is killed.
I have no idea if that was meant for cleanup like we need it here or for something else. But it at least makes future versions not affected as soon as we jump onto these.

As discussed with my coworker who does more on php&imagick and since I'm soon out for a while I pass this over to Nish.

[1]: https://launchpad.net/~ondrej/+archive/ubuntu/php