Close profiler thread handles when report writing fails #242
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from avatarmanz/VIctory-7900XTX. Originally posted by feanorsun on 2026-11-26T12:27:35Z.
Refs #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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.