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

fix the panic: send on closed channel #519

Merged
merged 1 commit into from
May 17, 2023
Merged

Conversation

dxsup
Copy link
Member

@dxsup dxsup commented May 17, 2023

Description

Fix the panic: send on closed channel.

Related Issue

image

Motivation and Context

There are two solutions available:

  • Close the channel on the sender side. We have to add some checks to ensure everything functions correctly.
  • Do not close the channel and ensure it can be garbage collected when profiling is disabled, without any memory leaks or blocked goroutines. This can be achieved by listening to a "stop" channel and removing references to the old channel when disabling the profiling.

I have chosen the second solution to fix this bug. I renew the relevant channels and maps during the start and stop phases of profiling to ensure they are empty. Since starting and stopping profiling are both infrequent operations, the overhead on performance will be minimal.

Signed-off-by: Daxin Wang <idxwang@outlook.com>
@dxsup dxsup requested a review from hocktea214 May 17, 2023 07:51
@dxsup dxsup merged commit 1296d80 into main May 17, 2023
@dxsup dxsup deleted the fix-sendtrigger-closed-channel branch May 17, 2023 10:05
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