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(probe): Use a buffered chan to reduce the chance of losing events #3627

Merged
merged 1 commit into from
Jun 5, 2019

Conversation

bboreham
Copy link
Collaborator

@bboreham bboreham commented Jun 4, 2019

Fixes #3576 (I know, we've been here before...)

Event notifications from Docker have been seen to get dropped; using a buffered chan seems to reduce the chance of this happening.

@@ -176,7 +176,8 @@ func (r *registry) listenForEvents() bool {
// Next, start listening for events. We do this before fetching
// the list of containers so we don't miss containers created
// after listing but before listening for events.
events := make(chan *docker_client.APIEvents)
// Use a buffered chan to reduce the chance of losing events
events := make(chan *docker_client.APIEvents, 32)
Copy link
Member

Choose a reason for hiding this comment

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

Where do the events get dropped? Is the sender using a non-blocking send?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unclear. Not in fsouza/go-dockerclient.
Maybe the other side of the socket.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also // Each listener has 100 milliseconds to receive the event or it will be skipped.

Copy link
Member

Choose a reason for hiding this comment

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

Is there any downside to making the buffer a lot larger (but not as large as to become a memory hog)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Like 1024? I don't see any issue.
Really we need to do a full sync periodically, so I see this change as an improvement but not a final fix.

Copy link
Member

Choose a reason for hiding this comment

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

1024 sounds reasonable.

Pls file an issue for the periodic sync.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Filed #3629

Event notifications from Docker will be dropped if not collected
quickly enough; using a buffered chan reduces the chance of this
happening.
@bboreham bboreham force-pushed the buffered-docker-events branch from 4862fb6 to 380dd83 Compare June 5, 2019 10:37
@bboreham bboreham merged commit 954e86e into master Jun 5, 2019
@bboreham bboreham mentioned this pull request Jun 6, 2019
@bboreham bboreham deleted the buffered-docker-events branch September 13, 2019 15:32
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.

Report sizes seem to increase over days after a restart
2 participants