-
Notifications
You must be signed in to change notification settings - Fork 189
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
cmd: move unlock logic to the end of startNode to fix temporary bad block when node starts #1141
cmd: move unlock logic to the end of startNode to fix temporary bad block when node starts #1141
Conversation
@@ -120,6 +110,17 @@ func startNode(ctx *cli.Context, stack *node.Node) { | |||
} else { | |||
startKlaytnAuxiliaryService(ctx, stack) | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean that the above code should be finished earlier than other code being executed in another goroutine. So, you move the following code at the bottom of the function, right? Can you explain details about the disorder of which functions makes the bad block issue?
Your change seems that it can mitigate the issue somewhat, but cannot resolve it completely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change is okay if we need lots of engineering to resolve the issue, but we need to figure out whether other race issues can occur because of the same reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aidan-kwon It seems that the node used uninitilialized istanbul chainConfig because sync starts before istanbul chainConfig is set.
The following functions are called to set istanbul chainConfig. startKlaytnAuxiliaryService -> cn.StartMining -> go s.miner.Start() -> self.worker.start() -> istanbul.Start -> sb.SetChain(chain)
At sb.SetChain(chain), chainConfig
is set by setting chain
to sb.chain
. So, I changed the code to call startKlaytnAuxiliaryService
earlier than the unlocking process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot get the explanation. As far as I know, the moved code is not affected by chainConfig. What is the code using uninitilialized istanbul chainConfig?
Proposed changes
startNode
.closes #1103
Types of changes
Please put an x in the boxes related to your change.
Checklist
Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.
$ make test
)Related issues
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...