mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-05 15:58:53 +00:00
STRATA_WATCHDOG_S and STRATA_WATCHDOG_IO_S were read with std::atoi. The #6861 logs show "no progress for -1195029860 s" and "no step finished for -1907795513 s ... waiting up to 2079576072 s": a negative or garbage limit makes the first silent second count as stuck and shortens the file-tier allowance (the engine was stopped after about 10-19 s instead of 60). watchdog_seconds() (strata/core/watchdog_limits.hpp) parses with strtol: an unparsable or out-of-range value (negative, past a week, past long) falls back to the default and the engine says so. The "no progress" line prints the seconds actually waited. watchdog_limits_test covers the values atoi turned into garbage. This does not cure a real stall: the reporter's later runs with a limit of 60 also stop at layer step 1 of the last prompt chunk. That hang was not reproduced on an RTX 5070 (sm_120, WDDM) with his flags, a control vector, --slots 2 and --adapt-async 1.
29 lines
1.6 KiB
C++
29 lines
1.6 KiB
C++
// src/core/watchdog_limits_test.cpp - the serve watchdog's limits parse (#6861: negative "elapsed" seconds from atoi of an out-of-range value).
|
|
#include "strata/core/watchdog_limits.hpp"
|
|
|
|
#include <cstdio>
|
|
|
|
static int fails = 0;
|
|
#define CHECK(c) do { if (!(c)) { std::printf("FAIL line %d: %s\n", __LINE__, #c); ++fails; } } while (0)
|
|
|
|
int main() {
|
|
using strata::core::watchdog_seconds;
|
|
bool bad = true;
|
|
CHECK(watchdog_seconds(nullptr, 60, &bad) == 60 && !bad);
|
|
CHECK(watchdog_seconds("", 60, &bad) == 60 && !bad);
|
|
CHECK(watchdog_seconds("0", 60, &bad) == 0 && !bad); // 0 = off, as documented
|
|
CHECK(watchdog_seconds("180", 60, &bad) == 180 && !bad);
|
|
CHECK(watchdog_seconds("604800", 60, &bad) == 604800 && !bad); // a week: the largest accepted
|
|
// the values atoi turned into garbage or negatives
|
|
CHECK(watchdog_seconds("3099937436", 60, &bad) == 60 && bad); // past int: atoi gave -1195029860 on the reporter's engine
|
|
CHECK(watchdog_seconds("2387171783", 60, &bad) == 60 && bad); // -1907795513
|
|
CHECK(watchdog_seconds("99999999999999999999", 60, &bad) == 60 && bad);
|
|
CHECK(watchdog_seconds("-5", 60, &bad) == 60 && bad);
|
|
CHECK(watchdog_seconds("604801", 60, &bad) == 60 && bad);
|
|
CHECK(watchdog_seconds("12s", 60, &bad) == 60 && bad);
|
|
CHECK(watchdog_seconds("abc", 600, &bad) == 600 && bad);
|
|
CHECK(watchdog_seconds(" 5", 60, &bad) == 5 && !bad); // strtol skips leading blanks, as atoi did
|
|
if (fails == 0) std::printf("watchdog_limits_test: ok\n");
|
|
return fails == 0 ? 0 : 1;
|
|
}
|