- Minor
Hi,
I upgraded to 7.0.0 and then 7.0.1 and noticed that since then pretty much regularily the list of my devices in the "Array Devices" section on Main page was not showing up. There are quite few similar reports for this issue here and on Reddit but the solution made no direct sense in my case and I believe that issue (while same result) was already fixed (nchan memory increase in Nginx). There was no console error in any browser (Brave, Edge, Safari) and Nginx also was not showing any suspicious output.
However, `/var/log/phplog` was flooded with:
[15-Mar-2025 20:02:21 America/Los_Angeles] PHP Fatal error: Uncaught ValueError: SplFileObject::seek(): Argument #1 ($line) must be greater than or equal to 0 in /usr/local/emhttp/plugins/dynamix/include/Helpers.php:207 Stack trace: #0 /usr/local/emhttp/plugins/dynamix/include/Helpers.php(207): SplFileObject->seek(-1) #1 /usr/local/emhttp/plugins/dynamix/include/Helpers.php(221): tail(Object(SplFileObject)) #2 /usr/local/emhttp/plugins/dynamix/nchan/update_2(377): last_parity_log() #3 {main} thrown in /usr/local/emhttp/plugins/dynamix/include/Helpers.php on line 207
ls -al /boot/config/parity-checks.log -rw------- 1 root root 0 Jan 5 17:10 /boot/config/parity-checks.log
It's been a while since I did a parity check and usually when it starts I abort the process (I assume that's why it is 0 bytes?)
Anyway when running:
echo "" > /boot/config/parity-checks.log ls -al /boot/config/parity-checks.log -rw------- 1 root root 1 Mar 15 23:12 /boot/config/parity-checks.log
We add a one byte which fulfills the above `seek(-1)` and when I then refresh the Main page, all devices are back. I did not have this issue in < 7 versions.
Perhaps a possible patch?
function tail($file, $rows=1) { if (!file_exists($file) || !is_readable($file)) { return ''; } if (filesize($file) === 0) { return ''; } $file = new SplFileObject($file); $file->seek(PHP_INT_MAX); $totalLines = $file->key(); if ($totalLines <= 0) { return ''; } $position = max(0, $totalLines - $rows); $file->seek($position); $echo = []; while (!$file->eof()) { $line = $file->current(); if ($line !== false) { $echo[] = $line; } $file->next(); } return implode($echo); }