test(zustand): random test reports hangs and hard crashes
public
test(zustand): random test reports hangs and hard crashes A watchdog dumps all thread stacks when no step happened for 120 s, and faulthandler is enabled so a segfault in GTK or GStreamer leaves a stack. Progress is printed every 50 steps. Two earlier parallel runs ended without a report; this makes the next such case diagnosable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| Changeset | 10b46625c4419ea4f662870dd29f50e9c59e212a |
|---|---|
| Author (claimed) | Timo Stolz <timo.stolz@nullachtvierzehn.de>, |
| Parents | 12e981706f99 |
| Children | 7ebf6fe8583f |
| Pushlog | by timo via ssh by timo via ssh |
modified tools/zustand_zufall.py +8 −0
| @@ -21,6 +21,7 @@ ohne Zufall und ohne Engines nachspielt | ||
| 21 | 21 | |
| 22 | 22 | import argparse |
| 23 | 23 | import datetime |
| 24 | +import faulthandler | |
| 24 | 25 | import os |
| 25 | 26 | import random |
| 26 | 27 | import sys |
| @@ -47,6 +48,7 @@ from gi.repository import Gdk, Gio, GLib | ||
| 47 | 48 | from schach import app as schach_app, opening, recording, savegames, training, zustand # noqa: E402 |
| 48 | 49 | |
| 49 | 50 | STEP_MS = 400 # Zeit zwischen zwei Schritten: Engines und Ton laufen dazwischen weiter |
| 51 | +WATCHDOG_S = 120 # so lange ohne Schritt: Stapel aller Threads ausgeben (hängt die Hauptschleife?) | |
| 50 | 52 | |
| 51 | 53 | # Rätsel für training.sqlite: (FEN vor dem Gegnerzug, Gegnerzug, Lösung in UCI) |
| 52 | 54 | PUZZLES = [ |
| @@ -204,7 +206,12 @@ class Fuzzer: | ||
| 204 | 206 | return steps |
| 205 | 207 | |
| 206 | 208 | def step(self): |
| 209 | + faulthandler.cancel_dump_traceback_later() | |
| 210 | + faulthandler.dump_traceback_later(WATCHDOG_S, exit=False) | |
| 211 | + if len(self.trail) % 50 == 0: | |
| 212 | + print(f"… Schritt {len(self.trail)}: " + " → ".join(n for _w, n in self.trail[-8:]), flush=True) | |
| 207 | 213 | if self.left <= 0: |
| 214 | + faulthandler.cancel_dump_traceback_later() | |
| 208 | 215 | self.app.quit() |
| 209 | 216 | return False |
| 210 | 217 | self.left -= 1 |
| @@ -230,6 +237,7 @@ class Fuzzer: | ||
| 230 | 237 | |
| 231 | 238 | |
| 232 | 239 | def main(): |
| 240 | + faulthandler.enable() # auch ein harter Absturz (Segfault in GTK/GStreamer) hinterlässt Stapel | |
| 233 | 241 | parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) |
| 234 | 242 | parser.add_argument("--schritte", type=int, default=300) |
| 235 | 243 | parser.add_argument("--seed", type=int, default=None) |