Skip to content

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

Draft
Koan-Bot wants to merge 1 commit intocpanel:masterfrom
atoomic:koan.atoomic/fix-179-spooky-action
Draft

test: regression tests for filehandle ref leak (GH #179)#204
Koan-Bot wants to merge 1 commit 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 from d10e857 to e42db60 Compare February 23, 2026 04:56
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>
@Koan-Bot Koan-Bot force-pushed the koan.atoomic/fix-179-spooky-action branch from e42db60 to dd65f68 Compare February 24, 2026 21:34
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

1 participant