-
Notifications
You must be signed in to change notification settings - Fork 182
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
DialPipe problem with multiple calls / waiting for busy pipe #67
Comments
It seems the problem only appears inside a container. I stripped a test down down to this (with some debug Println in go-winio): package main
import (
"fmt"
"time"
"github.com/StefanScherer/go-winio"
)
func main() {
namedPipePath := "\\\\.\\pipe\\docker_engine"
timeout := 5000 * time.Millisecond
conn1, err1 := winio.DialPipe(namedPipePath, &timeout)
fmt.Println("err1", err1)
conn2, err2 := winio.DialPipe(namedPipePath, &timeout)
fmt.Println("err2", err2)
if conn1 != nil {
conn1.Close()
}
if conn2 != nil {
conn2.Close()
}
} And running the container I very often see the problem opening the pipe the second time:
Only a few times I got
Running the testpipe.exe on the Windows Insider Docker host seems to work every time. |
cc @jstarks |
Any update on this? @StefanScherer @friism do we know when the named pipe mount feature will be released? |
@deviantony I will try to get more info at DockerCon today about this. |
Maybe @jstarks finds a minute after DockerCon to give us advise if it's fine to merge portainer PR now if go-winio doesn't need an update itself. |
Any update on this? |
I just stumbled upon this issue in hashicorp/terraform-provider-docker#58. I hit this on Windows 10 using Docker for Windows. It does not only happen when running inside a container. I wrote a stress test for the Win32 named pipes API and managed to reproduce the Long story short: there is a race condition in the Win32 named pipe API where the I'm pretty sure the client needs to handle the |
I submitted a pull request with a tentative fix for this issue. The test suite in hashicorp/terraform-provider-docker#58 now passes reliably when run with a build containing this fix. |
fixes #67 DialPipe problem with multiple calls / waiting for busy pipe
Currently there is some work in progress (portainer/portainer#1186) to add mapped named pipe support into Portainer so it will be easier to run it in a Windows container (
docker run -u ContainerAdministrator -it -v //./pipe/docker_engine://./pipe/docker_engine -p 9000:9000 stefanscherer/portainer:insider -H npipe:////./pipe/docker_engine
)We're using
winio.DialPipe()
to connect to the Docker engine from inside a microsoft/nanoserver-insider container.At the moment we see problems in Portainer as it sometimes makes multiple requests requested by the web frontend. Here's a WireShark screenshot with the problem.
The two /api/endpoints/1/docker/xx GET requests use separate connections and run in parallel. One of the calls aborts with "open //./pipe/docker_engine: The system cannot find the file specified."
I have seen the check for
cERROR_PIPE_BUSY
and first thought thatcreateFile()
returnscERROR_FILE_NOT_FOUND
and aborts immediatelly.We are using the default timeout right now
but I also tried giving a 5 second timeout
Digging deeper it seems like the
waitNamedPipe()
just does not wait long enough or cannot start wait for the pipe.Adding some Println in DialPipe I now see this running Portainer in the second DialPipe call:
DialPipe createFile err All pipe instances are busy.
DialPipe waitNamedPipe ms 4998
DialPipe waitNamedPipe returns err The system cannot find the file specified.
DialPipe returns err The system cannot find the file specified.
The problem is that
waitNamedPipe
returns immediatelly and does not wait the given 5000 milliseconds.How can we make
DialPipe
more reliable?The text was updated successfully, but these errors were encountered: