[Crash] Access violation in guest thread OptimizeChangeBanc (read guest 0x4) while playing, RTX 2060 6 GB #287
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot#287
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
hookshot_log.txt
Build:
less-stutterrelease (HookshotBuilder.zip sha25603f23d9f…0296), built from the command line over an earliersmall-vrambuild with the same .nup. Game:0400486024DEC000, v131072, builde0f3ccfa(--checkOK).PC: Ryzen 5 3600, RTX 2060 6 GB (Turing), driver 621.14, 32 GB RAM, Windows 11 Pro (build 26300).
Settings:
hookshot_env.txt:RX_VK_ROBUST=1,RX_VK_VRAM_MB=2560. In-game menu: frame generation 2x, resolution 67%, game speed real time, FPS counter on.What happened: About 13,700 frames into the session, while walking from Kakariko Village toward the castle (Hyrule Field to Castle Town), the game closed. The GPU did not reset this time: there is no "device lost" in the log and no
nvlddmkmevent at that time. The crash is in a guest thread:x0is null and the read is at guest0x4, so it looks like a field read through a null pointer.lr(x30) is0x809051ec. Fullhookshot_log.txtattached. I have a Windows minidump too, but I'm not attaching it because it contains game memory. I can run something against it if that helps.Possibly useful for 6 GB Turing cards (#132): before the texture limit,
small-vramandless-stutterboth lost the device after a zone change, with VRAM at about 4.7 of 5.1 GB allowed (checkpoints in compute dispatches,nvlddmkmevent 153 each time). Driver 621.14 andRX_VK_ROBUST=1alone did not stop it. WithRX_VK_VRAM_MB=2560, the session above ran with no GPU reset, although VRAM still went over the driver's allowance at times (e.g. 5681 MB used of 5138 MB allowed, 1951 MB of it free in the blocks).Thanks for the detailed report. #284 (RX 9060 XT) crashes in the same thread,
OptimizeChangeBanc, reading guest address 0x4, so this is one bug on both vendors; I'm tracking it here.Found it from your log and #284's: both crash inside Hookshot's NVN code,
nvnTextureBuilderGetStorageSize(or its alignment twin) called with no texture builder. Its format is read at +4 of nothing, which is the guest-0x4 crash. The next release answers 0 there instead of crashing, and logs the caller once (nvn: storage size of no texture builder (lr ...)), so if you can send the log from that build we'll see why the game asks.Still crashes here, same thread and same guest 0x4 read, with a build that already has the
no_builderguard (source8f67b23, built from the command line with llvm-mingw; Ryzen 7 5800X, RTX 3070 8 GB, 32 GB RAM). It happened while loading into Castle Town from Hyrule Field:llvm-symbolizer --obj=hookshot.exe 0x159ba31cdnames the faulting host functionn_nvnMemoryPoolGetFlags, not a texture builder getter. The lifted caller agrees: inf_80905130the last indirect call (proc table +2080, returning to 0x809051ec) getsx0 = *(x3), the pool pointer the caller passed in, and its result is used as flags (>> 1 & 2). The same*(x3)goes as x1 to the call at +2064 just before (most likelynvnTextureBuilderSetStorage). So while the scene loads, the game sets up a texture with no pool and then asks that pool for its flags.Local workaround in
host/nvn_native.c, in the same style asno_builder:nvnTextureInitializealready copes with a nullb->pool. I haven't tested this in game yet; I'll report back whether it gets past Castle Town. Why the game has no pool at that point is still open.The new release is out: https://github.com/NotRexed/Hookshot/releases/tag/no-visual-studio. Please rebuild with it and tell me here whether it's fixed for you (attach hookshot_log.txt if not).
Still happening on device-lost-fix (caaaf2b7). Same guest 0x4 read and backtrace, but in
BaseProcCreateAndDeleteThread, and nonvn: storage size of no texture builderline in the log. Right after a scene change near Kakariko. One RomFS mod loaded (DualSense icons, includes a ResourceSizeTable).Log: https://gist.github.com/hallygtree/601826c494c613dd7da742f10fa042cd
The Kakariko Village day-to-night occurrence is now reported with its full log in #509. #510 is the fix: it adds a
o_pool\ guard to the memory-pool accessors (the same class as
o_builder, but for
vnMemoryPoolGetFlags/\GetSize/\GetBufferAddress/\Map\ rather than the texture-builder queries) and a game-free regression test.
PR #510 is merged into
main(7d852f3):nvnMemoryPoolGetFlagsand the other pool accessors now answer 0 for a null pool instead of reading guest0x4, and the first few occurrences lognvn: ... of no memory pool (lr ...). The crash in your 00:12 comment was on8f67b23, which predates that guard.I also extended the game-free test to every guarded accessor (
GetFlags,GetSize,Map,GetBufferAddress,InvalidateMappedRange) in PR #541. Please retest on a build that contains7d852f3(currentmainor the next release); if it still happens, attachhookshot_log.txtand thenvn: ... of no memory poolline. Keeping this open until the retest.Retested on
53af338(contains7d852f3), same PC (Ryzen 7 5800X, RTX 3070 8 GB). The guard fires, but the game crashes a few instructions later in the same thread, on a scene change:hookshot.exe+0x868f92is inf_8575cdc0(the sdk's memcpy), called fromf_800ac5d0with a null destination and 0x3d0 bytes. In the lifted code:Earlier in the same function,
f_800ac6e0->f_814f28c0->f_80905130is the texture setup that asked for the flags of the null pool. So the same object has no pool for its texture and no CPU mapping for the buffer that gets filled right after. Answering 0 moves the crash from the read of guest 0x4 to the write of guest 0.Only one
no memory poolline was logged (flags), and nomapline. So the call at +2096 is notnvnMemoryPoolMap; my guess isnvnBufferMapon a buffer whose pool is null, which returns 0 without a log line.The real question looks like why the game ends up with a null pool for this resource during a banc change. One guess is that an allocation on the game's side fails under Hookshot. For example, the pool's memory budget could fill up if the HLE storage sizes or alignments are larger than the real driver's. I haven't verified that yet. I'm happy to trace further or run a build with extra logging if that helps.
Confirming the post-guard crash on the
low-vramrelease (source618e37c6), with a different GPU and place: RTX 2080 Super (8 GB), driver 621.14, Windows 11. It happened leaving Hyrule Castle into Hyrule Field, on the scene change. Identical to the comment above: the guard fires, then the write to guest 0:Same
x2 = 0x3d0size, so it looks like the same memcpy into the null pool's buffer address. Earlier today, oncompile-retry(before the guard), the same thread crashed in Hyrule Field with the oldread guest 0x4signature and the same guest backtrace from0x80456fb4on.Settings: Quality preset Low (6GB), Handheld profile On, frame generation 2x,
RX_VK_WAIT_GPU=0. I can attach the fullhookshot_log.txtif it helps.Closing as fixed in v2.0.0: a buffer the game maps without memory now gets scratch memory instead of address 0, and the same OptimizeChangeBanc crash was confirmed gone after 2 hours in Hyrule Field (#648) and in Kakariko (#595). If it still happens on v2.0.5, please open a new issue with hookshot_log.txt.