Skip to content

test: regression tests for filehandle ref leak (GH #179)#204

Merged
atoomic merged 4 commits intocpanel:masterfrom
atoomic:koan.atoomic/fix-179-spooky-action
Feb 26, 2026
Merged

test: regression tests for filehandle ref leak (GH #179)#204
atoomic merged 4 commits intocpanel:masterfrom
atoomic:koan.atoomic/fix-179-spooky-action

Conversation

@Koan-Bot
Copy link
Contributor

Summary

  • Adds regression tests for the "spooky action-at-a-distance" bug (GH Spooky action-at-a-distance #179)
  • Tests that file check operators (-S, -f, etc.) on real filehandles don't retain references
  • Includes the exact socketpair reproduction scenario from the bug report

Context

The root cause is in Overload::FileCheck — the $_last_call_for variable 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

  • Weak ref test: Verifies $fh is GC'd after -f $fh and -S $fh
  • Socketpair test: Reproduces the exact hang from GH Spooky action-at-a-distance #179 — a forked child does -S on a dup'd socket handle, then verifies <$r> doesn't hang

Test plan

Fixes #179


🤖 Generated with Claude Code

@Koan-Bot Koan-Bot force-pushed the koan.atoomic/fix-179-spooky-action branch 2 times, most recently from e42db60 to dd65f68 Compare February 24, 2026 21:34
@atoomic atoomic marked this pull request as ready for review February 26, 2026 01:16
@atoomic
Copy link
Contributor

atoomic commented Feb 26, 2026

With the recent release of Overload::FileCheck with the fix for cpanel/Overload-FileCheck#25
Can you confirm here if the SKIP is still required for the regression test?
if not then let's remove the skip and resubmit the changes without it

@atoomic
Copy link
Contributor

atoomic commented Feb 26, 2026

@Koan-Bot rebase

@Koan-Bot
Copy link
Contributor Author

Rebase: test: regression tests for filehandle ref leak (GH #179)

Branch koan.atoomic/fix-179-spooky-action has been rebased onto master and force-pushed.

Actions

  • Read PR comments and review feedback
  • Rebased koan.atoomic/fix-179-spooky-action onto origin/master
  • Applied review feedback
  • Force-pushed koan.atoomic/fix-179-spooky-action to origin

Automated by Kōan

Koan-Bot added a commit to atoomic/Test-MockFile that referenced this pull request Feb 26, 2026
@Koan-Bot Koan-Bot force-pushed the koan.atoomic/fix-179-spooky-action branch from dd65f68 to 1c952dc Compare February 26, 2026 01:38
@atoomic
Copy link
Contributor

atoomic commented Feb 26, 2026

@Koan-Bot rebase

Koan-Bot added a commit to atoomic/Test-MockFile that referenced this pull request Feb 26, 2026
- Remove .claude/worktrees/ submodule entry from tracking
- Add .claude/ to .gitignore
- Remove SKIP wrapper from socketpair test — Overload::FileCheck
  fix (cpanel/Overload-FileCheck#25) is now released

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Koan-Bot
Copy link
Contributor Author

Rebase: test: regression tests for filehandle ref leak (GH #179)

Branch koan.atoomic/fix-179-spooky-action has been rebased onto master and force-pushed.

Actions

  • Read PR comments and review feedback
  • Rebased koan.atoomic/fix-179-spooky-action onto origin/master
  • Force-pushed koan.atoomic/fix-179-spooky-action to origin

Automated by Kōan

}

# Test 3: The exact scenario from GH #179 — socketpair with dup'd fd
# This would hang without the fix because the dup'd write handle stays open.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to bump the minimal version for Overload::FileCheck to be 0.014 to make sure every users got the correct fix.

@atoomic
Copy link
Contributor

atoomic commented Feb 26, 2026

@Koan-Bot rebase

Koan-Bot and others added 3 commits February 25, 2026 19:34
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>
- Remove .claude/worktrees/ submodule entry from tracking
- Add .claude/ to .gitignore
- Remove SKIP wrapper from socketpair test — Overload::FileCheck
  fix (cpanel/Overload-FileCheck#25) is now released

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Koan-Bot Koan-Bot force-pushed the koan.atoomic/fix-179-spooky-action branch from 5cb38bd to e70f53a Compare February 26, 2026 02:34
@Koan-Bot
Copy link
Contributor Author

Rebase: test: regression tests for filehandle ref leak (GH #179)

Branch koan.atoomic/fix-179-spooky-action has been rebased onto master and force-pushed.

Actions

  • Read PR comments and review feedback
  • Rebased koan.atoomic/fix-179-spooky-action onto origin/master
  • Applied review feedback
  • Force-pushed koan.atoomic/fix-179-spooky-action to origin

Automated by Kōan

@atoomic atoomic merged commit 599959b into cpanel:master Feb 26, 2026
18 checks passed
atoomic pushed a commit that referenced this pull request Feb 26, 2026
atoomic pushed a commit that referenced this pull request Feb 26, 2026
- Remove .claude/worktrees/ submodule entry from tracking
- Add .claude/ to .gitignore
- Remove SKIP wrapper from socketpair test — Overload::FileCheck
  fix (cpanel/Overload-FileCheck#25) is now released

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Spooky action-at-a-distance

2 participants