Skip to content

fix(stress): stop watchers when channels close - #2060

Open
colinaumaty wants to merge 1 commit into
xmtp:mainfrom
colinaumaty:feature_colinaumaty
Open

colinaumaty wants to merge 1 commit into
xmtp:mainfrom
colinaumaty:feature_colinaumaty

Conversation

@colinaumaty

Copy link
Copy Markdown

Return when subscription or log channels close instead of processing zero values. This prevents repeated empty events and lets the watcher goroutine terminate.

No protocol behavior changes; this fixes stress watcher lifecycle only.

Testing

Run the stress package tests with PostgreSQL available at 127.0.0.1:8765.

Signed-off-by: colinaumaty <colinaumaty@outlook.com>
@colinaumaty
colinaumaty requested a review from a team as a code owner September 1, 2026 16:04
@octane-security-app

Copy link
Copy Markdown

Summary by Octane

Adds closed-channel detection to the two goroutine loops in pkg/stress/watcher.go, so each returns instead of spinning on a closed channel.

Changes

  • pkg/stress/watcher.go (modified) - In makeSubChannel and processLogs, receives from sub.Err() and newLog now use the two-value form and return with a Debug log when the channel is closed.

🔗 Commit Hash: 7ee7c37

@octane-security-app

Copy link
Copy Markdown

Overview

Warnings found: 1                                                                                

Warnings

pkg/stress/watcher.go

  • Closed-channel returns with deferred client close in pkg/stress Watcher.Listen cause reuse failure and monitoring downtime. See more

🔗 Commit Hash: 7ee7c37
🛡️ Octane Dashboard: All vulnerabilities

@colinaumaty

Copy link
Copy Markdown
Author

@mkysel Hi, this is a small fix in pkg/stress/watcher.go to stop the watcher goroutines when the subscription or log channel is closed, instead of continuing to receive from a closed channel. Would you mind taking a look when you have a chance? Thanks!

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