Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
Watchdog: a file tier busy within the last 10 s keeps the I/O allowance (a thrashing host has silent seconds), and Windows measures it too (bytes read + page faults); before, a 46 GB box's 20K prompt was stopped after ~90 s of page-ins (#1407 #1984 #1971)
Niko122138032f546e0c
diff --git a/src/program/generate.cpp b/src/program/generate.cppindex 9af7f9bcf..994898935 100644--- a/src/program/generate.cpp+++ b/src/program/generate.cpp@@ -1154,6 +1154,15 @@ static uint64_t file_tier_activity() {std::fclose(f);}return total;+#elif defined(_WIN32)+ // #1984 #1971: Windows had no measure here, so a prompt waiting on mapped-file page-ins never got the I/O allowance.+ // Bytes read (MiB) plus page faults / 64 (Windows counts soft faults too; a stuck engine makes almost none).+ uint64_t total = 0;+ IO_COUNTERS io{};+ if (GetProcessIoCounters(GetCurrentProcess(), &io)) total += io.ReadTransferCount >> 20;+ PROCESS_MEMORY_COUNTERS pmc{};+ if (K32GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof pmc)) total += pmc.PageFaultCount >> 6;+ return total;#elsereturn 0;#endif@@ -9055,17 +9064,23 @@ int main(int argc, char** argv) {auto since = std::chrono::steady_clock::now();auto io_since = since;uint64_t io_last = file_tier_activity();+ auto io_active_at = since; // the last second the file tier was busybool io_noted = false;for (;;) {std::this_thread::sleep_for(std::chrono::seconds(1));const auto now = std::chrono::steady_clock::now();const uint64_t b = p.beats.load();- if (!p.busy.load() || b != last) { last = b; ticks_at = p.ticks.load(); since = now; io_since = now; io_noted = false; io_last = file_tier_activity(); continue; }+ if (!p.busy.load() || b != last) { last = b; ticks_at = p.ticks.load(); since = now; io_since = now; io_active_at = now; io_noted = false; io_last = file_tier_activity(); continue; }+ { // sampled every second, also during the first `limit` seconds, so a busy file tier is seen+ const uint64_t a = file_tier_activity();+ if (a >= io_last + 16) io_active_at = now; // 16 = faults + MiB read in a second: busy+ io_last = a;+ }if (now - since < std::chrono::seconds(limit)) continue;if (io_limit > limit && now - io_since < std::chrono::seconds(io_limit)) {- const uint64_t a = file_tier_activity();- if (a >= io_last + 16) { // 16 = faults + MiB read in the last second: the file tier is busy- io_last = a;+ // a thrashing host has seconds with almost no reads (one thread waiting on one page while+ // swap is written): busy within the last 10 s still counts as slow, not stuck (P2003, 46 GB)+ if (now - io_active_at < std::chrono::seconds(10)) {if (!io_noted) {io_noted = true;std::fprintf(stderr, "strata serve: no step finished for %d s, but the file tier is still being read "@@ -9074,7 +9089,6 @@ int main(int argc, char** argv) {}continue;}- io_last = a;}// a blocking step's explicit allowance (session files): still within it, not yet stuckif (strata::core::progress_now_ms() < p.allow_until_ms.load()) continue;