Skip to content

Write the PHP-FPM timeout message on a single line - #2193

Merged
mnapoli merged 2 commits into
masterfrom
fpm-timeout-single-line
Sep 27, 2026
Merged

mnapoli merged 2 commits into
masterfrom
fpm-timeout-single-line

Conversation

@mnapoli

@mnapoli mnapoli commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

When a PHP-FPM request times out, Bref writes a message made of 3 lines. Lambda turns each line written to stdout into a separate log event, so it became 3 CloudWatch events with the same timestamp, and only the first one started with the request ID:

092cf7a5-0989-4e24-9d83-5044cb3c8dda The PHP script timed out. Bref will now restart PHP-FPM to start from a clean slate and flush the PHP logs.
Timeouts can happen for example when trying to connect to a remote API or database, if this happens continuously check for those.
If you are using a RDS database, read this: https://bref.sh/docs/environment/database.html#accessing-the-internet

Searching the logs of a request (e.g. filter @requestId = '…' in CloudWatch Logs Insights, see "Logs of a single request" in the logs documentation) returned only the first line, not the two explanatory ones, and since the 3 events share a timestamp, log viewers could show them out of order.

This writes the same text on a single line. It also fixes the link: the #accessing-the-internet anchor no longer exists, the section is now "VPC databases (private network)".

Also the AWS SDK has a "recursion detection" step that adds an X-Amzn-Trace-Id header to AWS calls when _X_AMZN_TRACE_ID is set. In FPM that now happens, as it already did in the worker and console runtimes.

Lambda turns each line written to stdout into a separate log event: the message was split into 3
events with the same timestamp, and only the first one started with the request ID. Searching the
logs of a request missed the two explanatory lines, and log viewers could show them out of order.

Also fix the link, the `#accessing-the-internet` anchor no longer exists.

Claude-Session: https://claude.ai/code/session_01Awk33iZ9mDSg1xgSAPkgGK
@mnapoli
mnapoli merged commit 1e3a6cf into master Sep 27, 2026
8 checks passed
@mnapoli
mnapoli deleted the fpm-timeout-single-line branch September 27, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant