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

Bugfix: deadlock when domain failover #919

Merged
merged 5 commits into from
Jul 3, 2018
Merged

Bugfix: deadlock when domain failover #919

merged 5 commits into from
Jul 3, 2018

Conversation

wxing1292
Copy link
Contributor

  • fix deadlock issue in timer queue processor failover
  • fix domain cache copy without locking issue

fix domain cache copy without locking issue
@wxing1292 wxing1292 requested a review from samarabbas July 3, 2018 02:07
@@ -143,7 +143,9 @@ func (t *timerQueueProcessorImpl) FailoverDomain(domainID string) {
failoverTimerProcessor := newTimerQueueFailoverProcessor(t.shard, t.historyService, domainID,
standbyClusterName, minLevel, maxLevel, t.matchingClient, t.logger)
failoverTimerProcessor.Start()
failoverTimerProcessor.timerQueueProcessorBase.readAndFanoutTimerTasks()
// use a fake timer to trigger db scan
Copy link
Contributor

Choose a reason for hiding this comment

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

'readAndFanoutTimerTasks' is still called from other places and I thought that is the one which could block.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

readAndFanoutTimerTasks will be called by an separate go routine, so we should be fine.

c.beforeCallbacks[shard] = beforeCallback
c.afterCallbacks[shard] = afterCallback
domainNotificationVersion := c.domainNotificationVersion
c.Unlock()
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like both before and after callbacks were called within the lock before this change and now they are called outside of the lock. Do we even need 2 separate callbacks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we do not really need a 2 type of callbacks, one before one after, i thought providing 2 type of callbacks can be useful

@wxing1292 wxing1292 merged commit 2b92fd6 into master Jul 3, 2018
@wxing1292 wxing1292 deleted the deadlock branch July 3, 2018 18:15
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