test: regression tests for filehandle ref leak (GH #179)#204
Draft
Koan-Bot wants to merge 1 commit intocpanel:masterfrom
Draft
test: regression tests for filehandle ref leak (GH #179)#204Koan-Bot wants to merge 1 commit intocpanel:masterfrom
Koan-Bot wants to merge 1 commit intocpanel:masterfrom
Conversation
d10e857 to
e42db60
Compare
Tests that file check operators (-S, -f, etc.) on real filehandles do not retain references that prevent garbage collection. Includes the exact socketpair scenario from the bug report where a dup'd write handle kept alive by a leaked ref caused reads to hang. Root cause is in Overload::FileCheck's $_last_call_for variable. Ref: cpanel#179 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
e42db60 to
dd65f68
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-S,-f, etc.) on real filehandles don't retain referencesContext
The root cause is in
Overload::FileCheck— the$_last_call_forvariable stored filehandle references, preventing garbage collection. The fix is in cpanel/Overload-FileCheck#25.This PR adds regression tests on the Test::MockFile side to ensure the issue stays fixed.
Tests
$fhis GC'd after-f $fhand-S $fh-Son a dup'd socket handle, then verifies<$r>doesn't hangTest plan
Overload::FileCheckincludes the fix from fix: prevent filehandle reference leak in stat override Overload-FileCheck#25Overload::FileCheckrelease (proving the bug exists)Fixes #179
🤖 Generated with Claude Code