Stop the process-list pipeline writing broken-pipe noise to stderr

This commit is contained in:
Gmer4Lfe
2026-08-21 08:26:28 -04:00
parent 666e1ebab2
commit fe23c59e0c
+4 -1
View File
@@ -427,7 +427,10 @@ function vv_memory_breakdown(): array {
// Top processes by RSS — group same-named procs, take top 5 // Top processes by RSS — group same-named procs, take top 5
$grouped = []; $grouped = [];
$psOut = shell_exec("ps -eo comm,rss --sort=-rss 2>/dev/null | tail -n +2 | head -40") ?: ''; // stderr silenced for the pipeline, not just for ps: head -40 exits on the fortieth line and
// leaves tail writing into a closed pipe, which tail reports. Harmless, but it went to stderr
// once a minute from the cache writer on both hosts, and the repair sweep reads that log.
$psOut = shell_exec("{ ps -eo comm,rss --sort=-rss | tail -n +2 | head -40; } 2>/dev/null") ?: '';
foreach (explode("\n", trim($psOut)) as $line) { foreach (explode("\n", trim($psOut)) as $line) {
$parts = preg_split('/\s+/', trim($line), 2); $parts = preg_split('/\s+/', trim($line), 2);
if (count($parts) === 2 && is_numeric($parts[1]) && (int)$parts[1] > 0) if (count($parts) === 2 && is_numeric($parts[1]) && (int)$parts[1] > 0)