Skip to content

Fix infinite recursion in connectorStreamer.Close()#179

Merged
andrewwormald merged 2 commits intomainfrom
fix/connector-close-recursion
Mar 10, 2026
Merged

Fix infinite recursion in connectorStreamer.Close()#179
andrewwormald merged 2 commits intomainfrom
fix/connector-close-recursion

Conversation

@andrewwormald
Copy link
Collaborator

@andrewwormald andrewwormald commented Mar 10, 2026

Problem

connectorStreamer.Close() calls itself recursively, causing a stack overflow crash when any connector stream is closed.

Why

This is a runtime crash — any workflow using connectors will panic on shutdown or stream close.

Fix

Call c.consumer.Close() instead of c.Close().

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Fixed a resource cleanup issue when closing connections so underlying consumers are properly closed, preventing potential hangs or leaks.
  • Tests

    • Added unit tests that verify closing behaviour and error propagation to ensure the fix is reliable and prevents regressions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ea1c64e6-dfed-4fd6-bcdc-0c354cb7cab0

📥 Commits

Reviewing files that changed from the base of the PR and between 4f85c2c and 2897e5f.

📒 Files selected for processing (1)
  • connector_internal_test.go

📝 Walkthrough

Walkthrough

The pull request fixes an infinite recursion in connector.go by changing connectorStreamer.Close to call the underlying consumer's Close (c.consumer.Close()) instead of recursively calling c.Close(). It also adds connector_internal_test.go which implements a mockConnectorConsumer and two unit tests verifying that connectorStreamer.Close delegates to the consumer, marks the consumer closed, and correctly propagates consumer Close errors.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped through code with eager paws,

Found a Close that looped because—
It called itself and spun around,
Now consumer.Close brings safe ground.
A little test to show the cheer,
Clean shutdowns now are very clear. 🌿

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title accurately and concisely describes the main fix: resolving infinite recursion in the connectorStreamer.Close() method.
Description check ✅ Passed The pull request description is well-related to the changeset, clearly explaining the problem, its impact, and the solution implemented.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/connector-close-recursion

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link

@andrewwormald andrewwormald merged commit 7704dc7 into main Mar 10, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant