Skip to content

Commit

Permalink
ticdc/processor: don't close error channel in receiver (pingcap#3414)
Browse files Browse the repository at this point in the history
  • Loading branch information
amyangfei authored Nov 12, 2021
1 parent 9691f5f commit c5f2713
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cdc/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ func (p *processor) lazyInitImpl(ctx cdcContext.Context) error {
ctx, cancel := cdcContext.WithCancel(ctx)
p.cancel = cancel

// We don't close this error channel, since it is only safe to close channel
// in sender, and this channel will be used in many modules including sink,
// redo log manager, etc. Let runtime GC to recycle it.
errCh := make(chan error, 16)
p.wg.Add(1)
go func() {
Expand All @@ -236,7 +239,6 @@ func (p *processor) lazyInitImpl(ctx cdcContext.Context) error {
for {
select {
case <-ctx.Done():
close(errCh)
return
case err := <-errCh:
if err == nil {
Expand Down

0 comments on commit c5f2713

Please sign in to comment.