Windows Server 2019 Build 17677 - Issue with Named Pipes

Copper Contributor

Description of the issue

 

I've installed LTSC Build 17677, Datacenter Edition, on two nodes.  I've seen something weird with Named Pipes communication that I'd like to report.

 

In my scenario, I the two systems are named NODE1 and NODE2.  I've got simple Powershell scripts that implement a named pipe server and client. These are included below.

 

I run the server on NODE2 using this command:

 

.\NamedPipeServer.ps1 Test

 

and it creates the pipe, waits for a connection, prints a message, disconnects, then repeats. 

 

On NODE1, I run this command:

 

.\NamedPipeClient.ps1 NODE2 Test

 

The client on NODE1 opens a client pipe using the server hostname and pipe name, connects to it, then closes the pipe and repeats every 5 seconds.  Please see the attached scripts for details.

 

If I reboot NODE2 while NODE1 is running the client script, as expected I see that connections fail.  However, when NODE2 comes back up, I can login and restart the server script.  However, it never re-establishes a connection - the client continues to report that the connect attempt failed.

 

There are two ways I can get communication to start again.

  1. stop the client script for 10 seconds.  Then restart it - it will connect immediately.
  2. open a share on NODE2 from NODE1 (i.e. "dir \\NODE2\c$").  The next client connect attempt will succeed.

It seems like something in the client Named Pipe logic is caching the connection result, and not retrying the connection to the host if it sees that the previous attempt failed less than 10 seconds ago.

 

Scripts for reproducing the issue

 

The following scripts are what I used to reproduce this.

 

NamedPipeServer.ps1

if($args[0] -eq $null) {
    'Must specify a pipe name to create'
    exit 1
}

while($true) {

    $npipeServer = new-object System.IO.Pipes.NamedPipeServerStream($args[0], [System.IO.Pipes.PipeDirection]::InOut)

    'Waiting for connection'
    $npipeServer.WaitForConnection()

    "Got connection $?"
    $npipeServer.Close()
}

 

NamedPipeClient.ps1

if($args[0] -eq $null) {
    'Specify a server name as the first argument'
    exit 1
}

if($args[1] -eq $null) {
    'Specify a pipe name as the second argument'
    exit 1
}

while($true) {
    $npipeClient = new-object System.IO.Pipes.NamedPipeClientStream($args[0], $args[1], [System.IO.Pipes.PipeDirection]::InOut, [System.IO.Pipes.PipeOptions]::None, [System.Security.Principal.TokenImpersonationLevel]::Impersonation)

    $npipeClient.Connect(3000)
    "Connected $?"
    Get-Date

    $npipeClient.Close()
    Start-Sleep 5
}

 

 

0 Replies