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 deadlock while drainer.Syncer panic (#806) #807

Merged
merged 1 commit into from
Nov 14, 2019

Conversation

sre-bot
Copy link

@sre-bot sre-bot commented Nov 14, 2019

cherry-pick #806 to release-3.0


What problem does this PR solve?

we start Syncer goroutine in drainer

s.tg.GoNoPanic("syncer", func() {
	defer func() { go s.Close() }()
	if err := s.syncer.Start(); err != nil {
		log.Error("syncer exited abnormal", zap.Error(err))
	}
})

if s.syncer panic (like kafka producer panic), s.syncer.Start() would exit directly and the logics will happen

  • drainer calls s.syncer.Close() in s.Close()
  • s.syncer.Close() would wait <- s.syncer.closed take effetcs,
  • but s.syncer.closed only can be closed in s.syncer.run()

What is changed and how it works?

add defer close(s.syncer.closed) in s.syncer.run()

Check List

Copy link
Contributor

@july2993 july2993 left a comment

Choose a reason for hiding this comment

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

LGTM

@IANTHEREAL IANTHEREAL merged commit bb0f25a into pingcap:release-3.0 Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants