php / php/frankenphp

Add ability to limit worker execution time

Open
#1,216 26 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
11.3k
Forks
488
Avg merge
4d 10h
Merged PRs (30d)
11

Description

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 https://github.com/dunglas/frankenphp/issues/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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing worker-mode execution and how PHP's max_execution_time and set_time_limit are handled. Compare the requested behavior with Caddy's read_timeout, Nginx's fastcgi_read_timeout, and Apache's FcgidBusyTimeout; done means a configurable limit prevents blocked workers and is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, php
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.