-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
FAB-18291 Ch.Part.API: BlockPuller that can be stopped, improve follower Halt() responsiveness #2050
Conversation
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.
Works for me. Manually verified this resolves the issue that led me to open the JIRA item.
// A 'stopper' goroutine may signal the go-routine servicing PullBlock & HeightsByEndpoints to stop by closing this | ||
// channel. Note: all methods of the BlockPuller must be serviced by a single goroutine, it is not thread safe. | ||
// It is the responsibility of the 'stopper' not to close the channel more then once. | ||
StopChannel chan struct{} |
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.
The way of externally closing an internal channel is somewhat crude. I think that we should maintain the channel ourselves from within this struct, that is, to close it in a "Close" instance method.
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.
It is not necessarily an internal channel. It is possible to give the BlockPuller an external channel, in the case of the follower, the channel that signals the follower itself to stop. This way that channel is closed when someone calls follower.Halt() and it signals both the follower and the block puller it holds to stop retrying and exit. This is fine because in the follower we have only a single goroutine that goes in and out of the block puller.
When a follower is started with a block that has bad endpoints, it will cause the internal BlockPuller to retry a lot of times. Calling Halt() on said follower will block until the BlockPuller gives up, which can take a very long time. This causes an attempt to Remove that channel via the participation API to block for too long. This commit improves the BlockPuller by adding a channel to signal it to stop retrying and exit. It also integrates with the follower.Chain to make it more resposive to Halt(). Signed-off-by: Yoav Tock <tock@il.ibm.com> Change-Id: I49354d94a28402ce69a469689c12ea595b3e0a7e
When a follower is started with a block that has bad endpoints,
it will cause the internal BlockPuller to retry a lot of times.
Calling Halt() on said follower will block until the BlockPuller
gives up, which can take a very long time. This causes an attempt
to Remove that channel via the participation API to block for too long.
This commit improves the BlockPuller by adding a channel to signal
it to stop retrying and exit. It also integrates with the
follower.Chain to make it more responsive to Halt().
Signed-off-by: Yoav Tock tock@il.ibm.com
Change-Id: I49354d94a28402ce69a469689c12ea595b3e0a7e
Type of change
Related issues
FAB-18291