Skip to content

telemetryhook gets stuck during shutdown#888

Merged
tsachiherman merged 2 commits intoalgorand:masterfrom
algonautshant:shant/telemetryStop
Mar 19, 2020
Merged

telemetryhook gets stuck during shutdown#888
tsachiherman merged 2 commits intoalgorand:masterfrom
algonautshant:shant/telemetryStop

Conversation

@algonautshant
Copy link
Copy Markdown
Contributor

Summary

When the elasticHook returns an error, asyncTelemetryHook will not change to ready state.
Consequently, the elements will get stuck in the channel and the buffer.
The waitGroup associated with these elements, will prevent the telemetry from quitting.
This PR stops waiting for these elements.

When the elasticHook returns an error, asyncTelemetryHook will not change to ready state.
Consequently, the elements will get stuck in the channel and the buffer.
The waitGroup associated with these elements, will prevent the telemetry from quitting.
This PR stops waiting for these elements.
Comment thread logging/telemetryhook.go
func (hook *asyncTelemetryHook) Fire(entry *logrus.Entry) error {
hook.wg.Add(1)
select {
case <-hook.quit:
Copy link
Copy Markdown
Contributor

@algobolson algobolson Mar 4, 2020

Choose a reason for hiding this comment

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

this case should have a hook.wg.Done() ? otherwise where is the .Add(1) consumed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. thanks for catching this.

Copy link
Copy Markdown
Contributor

@pzbitskiy pzbitskiy left a comment

Choose a reason for hiding this comment

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

It looks OK fix but the question is why is there so many wg.Add and quite a little goroutines? Can't it be simplified and rely only on channels ?

Comment thread logging/telemetryhook.go
for moreEntries {
select {
case entry := <-hook.entries:
hook.appendEntry(entry)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think you need to call appendEntry, call hook.wg.Done() and skip the range below

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

At this point, there may or may not be elements in hook.pending.
For every element in hook.entries and hook.pending, there should be a hook.wg.Done()
So, there needs to be two range loops to achieve this.

Copy link
Copy Markdown
Contributor

@tsachiherman tsachiherman left a comment

Choose a reason for hiding this comment

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

looks good.

@tsachiherman tsachiherman merged commit 5651048 into algorand:master Mar 19, 2020
@algonautshant algonautshant deleted the shant/telemetryStop branch March 20, 2020 00:52
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.

5 participants