-
Notifications
You must be signed in to change notification settings - Fork 204
Description
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 that createFile() returns cERROR_FILE_NOT_FOUND and aborts immediatelly.
We are using the default timeout right now
return winio.DialPipe(namedPipePath, nil)but I also tried giving a 5 second timeout
timeout := 5000 * time.Millisecond
return winio.DialPipe(namedPipePath, &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?
