Skip to content

fix: Goroutine leak#135

Merged
pglass merged 2 commits intomainfrom
pglass/goroutine-leak
Aug 15, 2025
Merged

fix: Goroutine leak#135
pglass merged 2 commits intomainfrom
pglass/goroutine-leak

Conversation

@pglass
Copy link
Contributor

@pglass pglass commented Aug 15, 2025

What was changed

Fix a goroutine leak caused by not checking the shutdown channel.

Why?

This causes a memory leak due to ever increasing number of goroutines over time.

Checklist

  1. Closes

  2. How was this tested:

Deployed to a cluster and checked metrics.

  1. Any docs updates needed?

@pglass pglass requested a review from a team as a code owner August 15, 2025 13:56
@pglass pglass requested a review from yux0 August 15, 2025 13:56
req, err := receiver.Recv()
targetStreamServerData <- ValueWithError[T]{val: req, err: err}
select {
case targetStreamServerData <- ValueWithError[T]{val: req, err: err}:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you call defer close this channel in this goroutine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I think so.

@pglass pglass merged commit 5eefff5 into main Aug 15, 2025
6 checks passed
@pglass pglass deleted the pglass/goroutine-leak branch August 15, 2025 15:27
hai719 pushed a commit to hai719/s2s-proxy that referenced this pull request Nov 24, 2025
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.

2 participants