Close profiler thread handles when report writing fails #242
No reviewers
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX!242
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-242"
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?
@feanorsun on GitHub · 2026-11-26 12:27 UTC · original
feanorsun:fix/profile-thread-handle-lifetime→main· +67 −4 · 1 files · 1 commits · openRefs #227
This addresses the Profile thread handles item reported by kekonn. Thanks to kekonn for tracing the leak to the report writer.
choosekeeps each opened thread handle in a profile record. Previously,writeclosed the handle only after writing that record's line. IfFile::createfailed, every open handle leaked. An early write error could also leave the remaining handles open.Each
Threadnow closes its non-null handle on drop. The writer only borrows the records, so returning an I/O error follows the same cleanup path as writing the full report. A failedOpenThreadleaves a null handle that the destructor skips.Windows verification
The filter listed and ran three tests. Before the fix, the existing parser test passed and both new regressions failed. A missing parent directory left the handle open after the profile was dropped. A successful write closed the handle while the profile still owned it.
After the fix, all three passed. The tests compare the recorded handle against a separate handle to the same finished thread in the test process, both after
writereturns and after the records are dropped. They also check the report text and theNotFounderror. The scheduled sampler was never started.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.