Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

goroutine泄漏 #232

Open
denmushi opened this issue Sep 25, 2024 · 0 comments
Open

goroutine泄漏 #232

denmushi opened this issue Sep 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@denmushi
Copy link

Operating System

Linux

Go Version

1.20

Package Version

github.com/bytedance/gopkg v0.0.0-20240202110943-5e26950c5e57

Affected Packages

func (c *channel) consume() {
	for {
                // ...
		c.consumer <- it.value // 当外部关闭时,此行有泄漏风险
		atomic.AddUint64(&c.consumed, 1)
	}
}

Expected Behavior

关闭channel时不泄漏

Actual Behavior

关闭channel时会泄漏

Reproduction Steps

  1. c.consumer 被塞满
  2. 消费端不从c.consumer获取数据
  3. 关闭channel
  4. 上述代码处泄漏

Other Information

No response

@denmushi denmushi added the bug Something isn't working label Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant