Skip to content

THRIFT-6573: End only the failed listen pipe in the netstd TNamedPipeServerTransport - #4222

Merged
Jens-G merged 1 commit into
apache:masterfrom
Jens-G:THRIFT-6573
Nov 21, 2026
Merged

Jens-G merged 1 commit into
apache:masterfrom
Jens-G:THRIFT-6573

Conversation

@Jens-G

@Jens-G Jens-G commented Nov 21, 2026

Copy link
Copy Markdown
Member

THRIFT-6573

Since THRIFT-6539, a failed wait of one listen pipe reaches the catch block of TNamedPipeServerTransport.AcceptImplementationAsync(), and its Close() disconnects and disposes every listen pipe. With more than one listen pipe, clients that had connected to one of the other pipes, and had not been accepted yet, lost their connection.

Now a failed wait ends only its own pipe:

  • The call still throws TTransportException(NotOpen) with the error, which TSimpleAsyncServer and TThreadPoolAsyncServer log before they accept the next client. It is thrown after the try block, so the catch blocks' Close() does not run for it.
  • The other listen pipes keep their clients and go on waiting.
  • The next call sets up a new pipe in place of the failed one.

Cancellation, Close() during the wait and a connected client are handled as before.

TNamedPipeServerTransportTests gains AcceptAsync_WaitOfOnePipeFailed_KeepsClientOfOtherPipe. The test needs a failed wait on demand, so it puts a listen pipe whose wait has failed (by reflection) ahead of the pipe a second client is connected to:

check master this branch
the next call throws NotOpen with the injected error and closes the failed pipe passes passes
the call after it returns the second client's connection, and both clients complete a round trip fails: the client was dropped, and the call waits until its token is cancelled passes

On Linux with the .NET 11 SDK: TNamedPipeServerTransportTests 15/15 (20 repeated runs), Thrift.Tests 341/341, Thrift.IntegrationTests 57/57, and the Release build of Thrift.csproj for netstandard2.0, netstandard2.1, net10.0 and net11.0 without warnings. The MSVC job runs the test on Windows.

  • Apache Jira ticket: THRIFT-6573
  • Single commit
  • Code change, so the commit carries no CI-skip marker.

🤖 Generated with Claude Code

…ServerTransport

Client: netstd

Since THRIFT-6539, AcceptImplementationAsync() closed the whole server
transport when the wait of one listen pipe failed. With more than one
listen pipe, the clients that had connected to the other pipes, and were
not accepted yet, lost their connection.

A failed wait now ends only its own pipe. The call still throws
TTransportException(NotOpen) with the error, which TSimpleAsyncServer and
TThreadPoolAsyncServer log before they accept the next client. The other
listen pipes keep their clients and go on waiting, and the next call sets
up a new pipe in place of the failed one.

The new test puts a listen pipe whose wait has failed (inserted by
reflection) ahead of the pipe a client is connected to. It checks that
the call closes the failed pipe and that the next call returns that
client's connection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mergeable mergeable Bot added the c# Pull requests that update C# code Pull requests that update .NET code label Nov 21, 2026
@Jens-G
Jens-G merged commit 41c256c into apache:master Nov 21, 2026
93 checks passed
@Jens-G
Jens-G deleted the THRIFT-6573 branch November 21, 2026 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c# Pull requests that update C# code Pull requests that update .NET code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant