Skip to content

v3.0.2

Latest

Choose a tag to compare

@sylvesterdamgaard sylvesterdamgaard released this 24 Sep 17:18

Fixed

macOS file descriptor counts were wrong, and expensive. The macOS source ran lsof -p PID -n -P and counted the lines after the header. That is not a descriptor count: lsof's default output is every open file, including the working directory, the executable, each loaded shared library (cwd, txt) and every memory-mapped region. A plain PHP process with 5 descriptors reported 59, and the number tracked how many dylibs were loaded rather than how many files were open.

The Linux source counts entries in /proc/{pid}/fd, so the same field meant two different things depending on the platform.

lsof -F f is now used instead — one record per actual descriptor, which agrees with /dev/fd and with Linux.

openFileDescriptors will drop sharply on macOS. It was inflated before, not now. Anything charting or alerting on that field will step down.

The call was also the expensive part of a snapshot: 24 ms of 29 ms. For the calling process, /dev/fd is its own descriptor table and answers the same question in 0.05 ms, so a self-sample skips the process spawn entirely. ProcessMetrics::start() for the current pid goes from 29 ms to 4.6 ms — which matters because a per-request profiler samples its own process on every request.

Linux is unaffected: it reads /proc and never spawned anything.

PHPStan on the composite network and storage readers. Result::failure() widened the match to Result<mixed>, which no longer satisfied the interface under a newer PHPStan. Unrelated, and failing on main since a version bump the workflow had not run against.

Docs

The release history was repaired: v3.0.1 had no entry at all, a stale [Unreleased] heading had been sitting mid-history for ten months holding the FreeBSD detail that shipped in v1.5.0, v2.0.0 appeared twice, and v0.1.0 used a different heading style. Every tag now has exactly one entry.

Full Changelog: v3.0.1...v3.0.2