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

event listener sometimes doesn't work #101

Closed
progrium opened this issue May 25, 2014 · 12 comments
Closed

event listener sometimes doesn't work #101

progrium opened this issue May 25, 2014 · 12 comments

Comments

@progrium
Copy link

Working on logspout, I found that every other time it runs, it doesn't consume events. I couldn't figure out any other variable. Literally, every other time I'd run the program that just listens for events, it would show events, the other time it would not.

Here is the test program I made to try and reproduce:
https://github.com/progrium/logspout/blob/master/utils/docker-listener.go

Running this will work half the time. Half the time it doesn't. But it doesn't seem like a race just because of how consistently it's every other time.

However, I discovered that by adding and removing an event listener first (uncomment those two lines), it works quite consistently. I cannot figure this out.

# docker version
Client version: 0.11.1
Client API version: 1.11
Go version (client): go1.2.1
Git commit (client): fb99f99
Server version: 0.11.1
Server API version: 1.11
Git commit (server): fb99f99
Go version (server): go1.2.1
Last stable version: 0.11.1
@benmccann
Copy link
Contributor

One potential fix would be to use Flynn's events. I thought that it was decided that was going to be done originally, but I'm not quite sure what happened. For the discussion see #72

@wkharold
Copy link

I see the exact same problem with the flynn fork of go-dockerclient. What's more if you're running

$docker events

when you execute code that uses either event mechanism the docker events command flips out and starts sucking CPU.

@progrium
Copy link
Author

So maybe it's a docker issue?

@wkharold
Copy link

It looks like it's a Unix domain socket issue. If you make Docker bind to an additional TCP port: http://docs.docker.io/use/basics/#bind-docker-to-another-hostport-or-a-unix-socket, and then use that as your client endpoint everything works fine.

@progrium
Copy link
Author

You're saying you've found that it works over TCP and not over Unix domain sockets ... but you don't know what the issue is with domain sockets? It could still be an issue with how Docker is using sockets, but least that clarifies it's not a problem with the client.

@wkharold
Copy link

Correct. You can run multiple instances of docker -H tcp://x.x.x.x:yyyy events and multiple event handling clients that use an endpoint of the form http://x.x.x.x:yyyy and everything works properly. I suspect, but don't know for sure, that unix domain sockets are not "hijackable" in the way that tcp sockets are.

@progrium
Copy link
Author

Hijacking is just going from HTTP to a TCP stream, which shouldn't be different than what domain sockets are capable of. Btw, this doesn't resolve the CPU issue does it?

@wkharold
Copy link

If you point the clients at the TCP endpoint then there's no CPU issue.

@titanous
Copy link

This might be moby/moby#5421.

@chuyeow
Copy link
Contributor

chuyeow commented Jul 24, 2014

We can probably close this issue now. The cause was moby/moby#5421 and it's been fixed a few months ago by moby/moby#5827.

@fsouza
Copy link
Owner

fsouza commented Jul 28, 2014

@chuyeow thanks!

@progrium can you try you code again with latest docker version?

@fsouza
Copy link
Owner

fsouza commented Jul 29, 2014

I just tried multiple times (about 20 times) and was enable to reproduce the issue. Please reopen if you find it again.

Thanks for reporting!

@fsouza fsouza closed this as completed Jul 29, 2014
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

No branches or pull requests

6 participants