dunglas/frankenphp

Add ability to limit worker execution time

Opened this issue · 2 comments

Currently, in worker mode, the execution time limit is entirely PHP's responsibility via the max_execution_time directive. However, there are cases when PHP does not react to the execution time exceeding this directive.

One example of the problem of ignoring the max_execution_time directive was described in #1162: when connecting to an unavailable database, PHP hangs and stops following the max_execution_time directive.
This behavior leads to blocking workers until they finish. This eventually leads to "Connection timeout" errors.

Similar implementations already exist in:

Unlike the above implementations, FrankenPHP has the ability to communicate with PHP. It would be great if the execution time could also be configured from PHP code, or if FrankenPHP would react to the call to the set_time_limit function.

Is PHP in your case actually hanging during a request or while booting up the worker script? If PHP becomes unresponsive even though there's a max_execution_time, then yeah we would need to destroy and re-create the thread.

In my case, PHP hangs while processing the request (at the application level).

And yes, PHP does not respond to max_execution_time, stream_set_timeout and PDO::ATTR_TIMEOUT.