About three weeks ago, we bundled our internal memory-leak hunting scripts into an open-source lib called Leakless (built for FrankenPHP, RoadRunner, etc).
Earlier this week, we threw a legacy app onto FrankenPHP worker mode with ZTS enabled and immediately hit a wall. When a single thread leaks in ZTS, killing the entire OS process takes down healthy requests running on neighboring threads. To make things worse, the leak was happening at the native C layer, so PHP reported everything was completely fine right until the container's OOM killer wiped it out.
Our tooling couldn't handle that edge case yet, so we shipped v0.9.0 to solve it:
- Tracks memory drift per thread under ZTS (no more killing innocent workers)
- Catches native C leaks by comparing system RSS against thread heaps
- Rewrote the linter to use pure AST (php-parser), ditching PHPStan subprocesses
- Removed strict pcntl/posix requirements so it runs smoothly in slim containers
Link to the docs and the repo:
Github: https://github.com/themattosdev/leakless
Doc: https://leakless.themattos.dev/guide/why-leakless
[link] [留言]
