php-pm-httpkernel icon indicating copy to clipboard operation
php-pm-httpkernel copied to clipboard

Exceptions thrown during the terminate() event dispatching should not cause the slave to crash

Open acasademont opened this issue 4 years ago • 0 comments

During the Google outage today one function that sends some logs to Google PubSub in the Syfmony terminate() event failed, causing the whole slave to go down, even if the response had been correctly generated in the controller. The terminate event is used in Symfony to do some after-request processing, but it should not interfere with the response.

The easy fix would be to catch any exception thrown in the handling of the terminate event and log it.

The better fix would be to execute the terminate event after sending the response promise to the client, if not, a slow terminate event handler would cause the response to also be slowed down, in contrast of what happens in a normal PHP-FPM response.

acasademont avatar Dec 14 '20 15:12 acasademont