Under Wine, report.json is not rewritten at a title's exit: the exe's TLS callback never gets DLL_PROCESS_DETACH #1461
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#1461
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?
@crastinator on GitHub · 2026-11-24 16:27 UTC · original
Under Wine, a title's normal exit leaves
report.jsonas it was written before the title ran.called_stubs, thed3d12/audio/dstoragecounters,vfsand the rest from that run are missing. That affects every Linux and macOS report shared in #175 and #258. The cause is on the Wine side: Wine never calls the exe's TLS callbacks withDLL_PROCESS_DETACH, and that callback is where XCL writes its final report.Where
main.rsregisters xcl.exe's TLS callback (.CRT$XLY), which callsloader::on_tls_event. OnDLL_PROCESS_DETACH(reason 0) it callsreport::write_final(None)("write the report while everything is alive",loader.rs:413).host.rsalso writes the report beforerun_main(:142) and after it returns (:145). A title that ends throughExitProcess/ CRTexitnever comes back to:145, so that one does not run either.eh::hk_nt_terminate_processruns on that exit under Wine too (it logsprocess ends (thread …)), but it only logs.Measured (main
930e8b4).CRT$XLYTLS callback that appends eachreasonto a file, under Proton Experimental 11.0-20261112's Wine and under Wine 11.22 (Arch). Whethermainreturns or callsstd::process::exit(0), the callback gets1 2 3(process attach, thread attach, thread detach) and never0. On Windows an exe's TLS callbacks getDLL_PROCESS_DETACHat process exit.crates/xcl/tests/e2e.rsunder Wine, once the test title's own checks pass (with #794, #890 and a test-title change for the cloaking check, PR to follow):report.jsonhas"called_stubs": [], although the title calledXclDefinitelyMissingFunctionandstubbed_importslists it. The test fails ate2e.rs:164(report.called_stubs: []).exit_codeis 0, because the launcher sets it afterwards.Possible fix
Under Wine (
util::under_wine()), havehk_nt_terminate_processcallreport::write_final(None)before it logs and flushes, for status 0 and a nonzero status alike. That is the last point Wine gives us before the process ends. Keeping it to Wine leaves Windows exactly as it is, with the TLS detach still writing the report there. It's a runtime change, so it needs a smoke run on a real title. I can do it once I have the game to run it with, unless you'd rather handle it differently.AI use