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 race condition for harvester Start / Stop in registry #4314

Merged
merged 1 commit into from May 15, 2017

Conversation

Projects
None yet
2 participants
@ruflin
Copy link
Collaborator

commented May 15, 2017

It was possible that with reloading enabled that during the shutdown of filebeat, a new harvester was started. This is now prevent by having a lock on the starting of the harvester so no new harvesters can be started when shutdown started.

This is not backported to 5.x because it can only happen on shutdown and does not have any side affects.

Closes #3779

@exekias
Copy link
Member

left a comment

Did some comments, let me know what do you think

hr.wg.Add(1)
hr.add(h)
r.wg.Add(1)
r.harvesters[h.ID()] = h

This comment has been minimized.

Copy link
@exekias

exekias May 15, 2017

Member

You are no longer using add function, I would either use it or remove it

This comment has been minimized.

Copy link
@ruflin

ruflin May 15, 2017

Author Collaborator

Removed the method.

case <-r.done:
return
default:
}

This comment has been minimized.

Copy link
@exekias

exekias May 15, 2017

Member

Having that you already have a lock in place done could be just a boolean isn't it? not against this approach though

This comment has been minimized.

Copy link
@ruflin

ruflin May 15, 2017

Author Collaborator

Agree, it could be also a bool. I would like to keep it that way as it has become quite a common pattern across our code base.

Fix race condition for harvester Start / Stop in registry
It was possible that with reloading enabled that during the shutdown of filebeat, a new harvester was started. This is now prevent by having a lock on the starting of the harvester so no new harvesters can be started when shutdown started.

This is not backported to 5.x because it can only happen on shutdown and does not have any side affects.

Closes #3779

@ruflin ruflin force-pushed the ruflin:fix-registry-race branch from 011e7e4 to 0a51a68 May 15, 2017

@exekias exekias merged commit c9dcfe1 into elastic:master May 15, 2017

3 of 4 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
CLA Commit author has signed the CLA
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
default Build finished.
Details

@ruflin ruflin deleted the ruflin:fix-registry-race branch May 15, 2017

ramon-garcia added a commit to ramon-garcia/beats that referenced this pull request Dec 5, 2017

Fix race condition for harvester Start / Stop in registry (elastic#4314)
It was possible that with reloading enabled that during the shutdown of filebeat, a new harvester was started. This is now prevent by having a lock on the starting of the harvester so no new harvesters can be started when shutdown started.

This is not backported to 5.x because it can only happen on shutdown and does not have any side affects.

Closes elastic#3779

athom added a commit to athom/beats that referenced this pull request Jan 25, 2018

Fix race condition for harvester Start / Stop in registry (elastic#4314)
It was possible that with reloading enabled that during the shutdown of filebeat, a new harvester was started. This is now prevent by having a lock on the starting of the harvester so no new harvesters can be started when shutdown started.

This is not backported to 5.x because it can only happen on shutdown and does not have any side affects.

Closes elastic#3779
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.