diff --git a/cdc/processor/processor.go b/cdc/processor/processor.go index 8ab353b7997..1c060d790d6 100644 --- a/cdc/processor/processor.go +++ b/cdc/processor/processor.go @@ -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() { @@ -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 {