Skip to content

Commit 838f8c0

Browse files
committed
docs: address Copilot review on internals.md (round 2)
- Worker restart: clarify that exits after frankenphp_handle_request() restart immediately whether clean or due to a fatal error; exponential backoff applies only to consecutive startup failures. - Downscaling: idle Ready threads are converted to Inactive (not shut down); the full-stop path is currently disabled because of memory-leaking PECL extensions. Signed-off-by: Kévin Dunglas <kevin@dunglas.fr>
1 parent 6b09b14 commit 838f8c0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

docs/internals.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Keep a PHP script alive across multiple requests. The PHP script calls `frankenp
4646
6. `go_frankenphp_finish_worker_request()` cleans up the request context
4747
7. The PHP script loops back to step 3
4848

49-
Worker threads are restarted when the script exits (exit code 0), with exponential backoff on failure.
49+
After the script exits, the worker is restarted immediately if it had reached `frankenphp_handle_request()` at least once (whether the exit was clean or the result of a fatal error). Exponential backoff is only applied to consecutive startup failures, where the script exits before ever reaching `frankenphp_handle_request()`.
5050

5151
## Thread State Machine
5252

@@ -213,7 +213,7 @@ A single goroutine (`startUpscalingThreads`) reads from an unbuffered `scaleChan
213213

214214
### Downscaling
215215

216-
A separate goroutine (`startDownScalingThreads`) periodically checks (every 5s) for idle auto-scaled threads. Threads idle longer than `maxIdleTime` (default 5s) are shut down, up to 10 per cycle.
216+
A separate goroutine (`startDownScalingThreads`) periodically checks (every 5s) for idle auto-scaled threads. Threads in `Ready` state idle longer than `maxIdleTime` (default 5s) are converted to `Inactive` via `convertToInactiveThread()` (up to 10 per cycle). They are not fully stopped: a code path exists for that, but it is currently disabled because some PECL extensions leak memory and prevent threads from cleanly shutting down.
217217

218218
## Environment Sandboxing
219219

0 commit comments

Comments
 (0)