Repository navigation
perf(os): run the system commands without a shell and with time limits - #1244
Open
karlitschek wants to merge 1 commit into
Open
karlitschek wants to merge 1 commit into
karlitschek wants to merge 1 commit into
Conversation
karlitschek
force-pushed
the
feat/os-status-collector
branch
from
October 25, 2026 19:19
6d327c2 to
34014ec
Compare
karlitschek
force-pushed
the
perf/command-timeouts
branch
from
October 25, 2026 19:25
dfe6727 to
8806f53
Compare
The Linux and FreeBSD backends ran df, free, nproc, sysctl, swapinfo, netstat, ifconfig, date and a cat of /proc/self/stat through shell_exec with no time limit, and the gateway through the pipeline `ip route | awk`. A stale NFS or CIFS mount makes df hang, so every Status page load or diskdata call then held a PHP worker until FPM killed it. On FreeBSD each poll also forked date(1) and sysctl twice for values PHP already knows. All commands now go through the OS status CommandRunner via IHost, in a small CommandOutput helper: argument vectors, no shell, a fixed PATH, the runner's output cap, 2 s per command and 5 s for df. Output of a command that exits with an error is still used, as before, since df does so when one mount point is unreadable. When df is stopped at its limit, the complete lines it printed are still reported and one warning is logged; other failures are logged at debug level. - Linux: `ip route show default` is parsed in PHP; several default gateways are joined with ", " as on FreeBSD, and the value is always a string (shell_exec returned null without output). - FreeBSD: the time is formatted in PHP in the zone /etc/localtime links to or /var/db/zoneinfo names; the boot time moves to sampleUptime(), so Os caches it as it does on Linux; hw.model and kern.smp.cpus come from one sysctl; ifconfig gets the interface as an argument and only names that are valid interface names; the load average comes from sys_getloadavg(). The tests run the backends against FakeHost instead of mocking executeCommand, and cover timeouts, failed commands and the route parser. Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Frank Karlitschek <[email protected]>
karlitschek
force-pushed
the
perf/command-timeouts
branch
from
October 25, 2026 19:45
8806f53 to
9802b97
Compare
karlitschek
marked this pull request as ready for review
October 25, 2026 20:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on
feat/os-status-collector(#1214).AI disclosure: this change was written with Claude Code (claude-opus-5-5) and is to be reviewed by the author before it leaves draft; every commit carries an
Assisted-bytrailer.馃 Generated with Claude Code