-
Notifications
You must be signed in to change notification settings - Fork 561
Open
Labels
Description
Hi,
I'm fighting with a nasty bug. Sometimes, but not always (a bit hard to reproduce), AttachContainer will hangs, eating 100% of CPU.
I have profiled my program and ended up with this (profiled during the hang):
(pprof) top
Total: 3002 samples
1906 63.5% 63.5% 3002 100.0% github.com/fsouza/go-dockerclient/utils.StdCopy
1096 36.5% 100.0% 1096 36.5% bufio.(*Reader).Read
0 0.0% 100.0% 3002 100.0% github.com/fsouza/go-dockerclient.func·001
0 0.0% 100.0% 3002 100.0% runtime.gosched0
I'm using the latest go-dockerclient (master / e21b2a4), and having the same problem with older versions (tried until 992e6ab)
My code is pretty standard:
var buf bytes.Buffer
opts := docker.AttachToContainerOptions{
Container: w.container.ID,
OutputStream: &buf,
Logs: true,
Stdout: true,
Stderr: true,
}
err = w.client.AttachToContainer(opts)
if err != nil {
log.Printf("Error while fetching logs from container: %s\n", err)
}
and works "most of the time" (99% of runs).
I'm not sure if it's related to docker, but here's my configuration:
Containers: 0
Images: 206
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Dirs: 206
Execution Driver: native-0.2
Kernel Version: 3.2.0-4-amd64
Any hint would be appreciated :)