From f379600353cb37889785453c35b1227d635d542d Mon Sep 17 00:00:00 2001 From: Haim Faraj Date: Sat, 4 Jul 2026 22:58:42 +0300 Subject: [PATCH] (fix) Fire Flowframes hang watchdog on log inactivity Flowframes can stop responding mid-interpolation after some time: the process stays alive but its session log stops growing. The 60s progress watchdog was meant to catch this but never fired: lastLogTime was refreshed on every poll tick whenever the log file simply read successfully, so a frozen-but-readable log kept resetting the timer and the job hung until it was manually paused. Only bump lastLogTime when new lines actually appear (lines.length > lastLineCount). Add a grace check so a quiet encode phase is not killed: if the newest output file is still growing, reset the timer instead of failing. On a genuine hang the job now errors out after 60s and the queue moves on. --- AniSmooth/js/utils/flowframesHandler.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/AniSmooth/js/utils/flowframesHandler.js b/AniSmooth/js/utils/flowframesHandler.js index 7c9941f..efb55b0 100644 --- a/AniSmooth/js/utils/flowframesHandler.js +++ b/AniSmooth/js/utils/flowframesHandler.js @@ -165,6 +165,7 @@ var finished = false; var aiComplete = false; var lastLogTime = Date.now(); + var watchdogSize = -1; var finalize = function (ok, message, producedPath) { if (finished) return; @@ -215,6 +216,7 @@ try { var content = fs.readFileSync(sessionLog, "utf8"); var lines = content.split(/\r?\n/); + if (lines.length > lastLineCount) { for (var j = lastLineCount; j < lines.length; j++) { var ln = lines[j]; if (!ln) continue; @@ -238,6 +240,7 @@ } lastLineCount = lines.length; lastLogTime = Date.now(); + } } catch (e) {} } @@ -268,7 +271,19 @@ } if (!finished && Date.now() - lastLogTime > 60000) { - finalize(false, "Flowframes stalled - no progress for 60 seconds."); + var wOut = findNewestOutput(); + var wGrew = false; + if (wOut) { + try { + var wSz = fs.statSync(wOut).size; + if (wSz !== watchdogSize) { watchdogSize = wSz; wGrew = true; } + } catch (e) {} + } + if (wGrew) { + lastLogTime = Date.now(); + } else { + finalize(false, "Flowframes stopped responding - no progress for 60 seconds."); + } } }, 1500);