Stall watchdog's fixed 20s threshold force-exits during legitimate large-asset-tree indexing
GetStallWatchdogSeconds() (DirectExecutionBackend.cs:6412) defaults to a fixed 20 seconds, and Environment.Exit(4) fires unconditionally the moment it elapses with no import progress (DirectExecutionBackend.cs:6505). This kills the process even when the "stalled" thread is doing legitimate, progressing work that just happens to take longer than 20s.
Concrete case: Astro Bot (PPSA21564) calls sceAmprCommandBufferConstructor (a NID marked IsNoBlockLeafImport) early in boot, which synchronously falls into AmprFileRegistry.EnsureApp0Indexed when the background preload (BeginApp0IndexPreload, kicked off from SharpEmuRuntime.cs:406) hasn't finished yet — the comment at AmprFileRegistry.cs:197 already documents this as a known, deliberate fallback path. With the watchdog disabled (SHARPEMU_STALL_WATCHDOG_SECONDS=0), the walk completes and logs:
[LOADER][INFO] ampr.app0_indexed root=... files=156250 ids=624955 elapsed_ms=94864.3
~95 seconds for 156,250 files — a real, first-party title's asset tree, not a pathological case. With the default threshold, the process is killed at 20s, well before this legitimate work finishes, and execution never reaches the point where the walk would complete on its own.
This isn't Astro-Bot-specific: any title with a large enough data/ tree hits the same wall on the very first boot (subsequent boots hit the on-disk index cache instead — ampr.app0_index_cache_hit — and would be fast).
Suggested direction: rather than raising the constant (which just moves the cliff edge for the next larger title), have long-running-but-progressing HLE work like this indexing walk periodically signal into the same progress mechanism the watchdog already resets on (MarkExecutionProgress() on DirectExecutionBackend) so it isn't mistaken for a genuine stall. That mechanism currently lives in SharpEmu.Core, and the indexer lives in SharpEmu.Libs, so this needs a small public seam between them rather than a quick cross-layer call — flagging for discussion on the right shape of that seam before sending a PR.
Opened a fix: #877. Tested against the real Astro Bot repro with default settings (no env var workaround) — the full ~85s indexing walk now completes and execution reaches real game code instead of getting killed at 20s.
Could you check if with the last commit from the main branch you still have it ?