RE: 231 - All pipe instances are busy when connecting a pipe
"nickdu" wrote:
[...]
pipe = Win32.File.CreateFile(pipeName,
Win32.File.GENERIC_READ | Win32.File.GENERIC_WRITE,
0, null, Win32.File.OPEN_EXISTING, 0, IntPtr.Zero);
if (pipe == Win32.File.INVALID_HANDLE_VALUE)
{
if (Marshal.GetLastWin32Error() == Win32.NamedPipe.ERROR_PIPE_BUSY)
{
if (Win32.NamedPipe.WaitNamedPipe(pipeName, 20) != 0)
{
pipe = Win32.File.CreateFile(pipeName,
Win32.File.GENERIC_READ | Win32.File.GENERIC_WRITE,
0, null, Win32.File.OPEN_EXISTING, 0, IntPtr.Zero);
}
}
}
[...]
Wow, I'm amazed that someone else is actually observing this. I thought I
was alone. I'm getting almost the exact same results as you guys are.
Except that in my situation I fisrt get error 231 (which is ERROR_PIPE_BUSY,
by the way) and then I call WaitNamedPipe, but WaitNamedPipe fails also, and
GetLastError returns 161 (ERROR_BAD_PATHNAME). So then I try to CreateFile
again, and get ERROR_PIPE_BUSY again, and WaitNamedPipe gives
ERROR_BAD_PATHNAME again, etc. forever. There's no amount of waiting or
re-creating the file that will solve this problem on the client end. The
only solution is to kill the server end of the pipe (by stopping the server
process and restarting it). Your single-retry after a single WaitNamedPipe
doesn't work for me.
So this makes me think that it's the fault of the implementation on the
server's side that is to blame for the problem.
Is there an explanation for this? Did you figure out why this is happening?
- Wyck