Error Pipe Busy 231 (0xE7): Fix it With These 5 Methods

To fix this, ensure that your code is properly configured

Reading time icon 2 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more

XINSTALL BY CLICKING THE DOWNLOAD FILE
A message from our partner

For fixing Windows errors, we recommend Fortect:

Fortect will identify and deploy the correct fix for your Windows errors. Follow the 3 easy steps to get rid of Windows errors:

  • Download Fortect and install it on your PC
  • Launch the tool and Start scanning your PC for Windows errors
  • Right-click on Start Repair to deploy the right fix for each error encountered during the scan
Download Now Fortect has been downloaded by 0 readers this month, rated 4.6 on TrustPilot

Error_Pipe_Busy is a common developer error and it’s followed by 231 (0xE7) All pipe instances are busy message. If you ever encounter this issue, today’s guide will show you how to fix it.

How can I fix Error_Pipe_Busy?

1. Check your code

  1. Open your code.
  2. Ensure that there are no typos on any of the paths on the target host.
  3. Ensure that the client doesn’t try to connect twice. To do that, use DisconnectNamedPipe to disconnect from the previous client.
  4. Use ConnectNamedPipe() after CreateNamedPipe() or DisconnectNamedPipe(). Remember to use it before trying any I/O operations.

2. Keep calling WaitNamedPipe and CreateFile in a loop

  1. Open your code.
  2. Ensure you’re using WaitNamedPipe and CreateFile in a loop, like this:
    repeat
    hPipe := CreateFile(...);
    if hPipe = INVALID_HANDLE_VALUE then
    begin
    if GetLastError() = ERROR_PIPE_BUSY then
    begin
    if not (attempted too many times) then
    begin
    if WaitNamedPipe(...) then Continue;
    end;
    end;
    end;
    Break;
    until False;

    wait named pipe
  3. Save changes.

Alternatively, you can use the following code:

while(true)
{
    hPipe = CreateFile(pipeName,
                       GENERIC_READ | GENERIC_WRITE,
                       0,
                       0,
                       OPEN_EXISTING,
                       FILE_ATTRIBUTE_NORMAL,
                       0);
    if(hPipe == INVALID_HANDLE_VALUE)
    {
        if(GetLastError() == ERROR_PIPE_BUSY)
        {
            if(!WaitNamedPipe(pipeName, NMPWAIT_USE_DEFAULT_WAIT))
                continue;   // timeout, try again}
        elsereturnfalse;   // error}
    elsebreak;   // success}

  1. Opet NETLink configuration and change it. It needs to look like this:
    Needs["NETLink`"]
    InstallNET[];
    LoadNETType["System.IO.Pipes.PipeDirection"];

    netlink settings
  2. Ensure that the PowerShell server is running.
  3. Evaluate the following:
    NETBlock @
      Internal`WithLocalSettings[
        {pipe = NETNew["System.IO.Pipes.NamedPipeClientStream", ".", "testPipe", PipeDirection`In]}
      , pipe@Connect[]
      ; Internal`WithLocalSettings[
          {stream = NETNew["System.IO.StreamReader", pipe]}
        , stream@ReadLine[]
        , stream@Dispose[]
       ]
     , pipe@Dispose[]
      ]
    (* "Server pid is 12345" *)

    netblock
  4. Save changes.

4. Adjust Telerik configuration

  1. Open your code.
  2. Ensure that there’s only one instance of [SetUp], [TearDown], [TestFixtureTearDown].
  3. Adjust the code if needed and save changes.

5. Podman tips

  1. If you’re using a VPN, always start the podman machine before the VPN.
  2. Run the following commands to restart WSL:
    podman machine stop
    wsl –shutdown
  3. If nothing else works, remove .wslconfig from the %USERPROFILE%/.wslconfig

As previously stated, Error_Pipe_Busy is a developer error, and to fix it you’ll need to adjust your code accordingly.

This isn’t the only developer error you can encounter, and we wrote about ERROR_BROKEN_PIPE in an earlier guide.

As for pipe errors, we wrote about The pipe is being closed and The pipe has ended in our previous guides, so don’t miss them for more information.

More about the topics: error

User forum

0 messages