Jens Geyer created THRIFT-6375:
----------------------------------
Summary: netstd tutorial client runs all -mc clients over one
shared transport and protocol
Key: THRIFT-6375
URL: https://issues.apache.org/jira/browse/THRIFT-6375
Project: Thrift
Issue Type: Bug
Components: Tutorial, netstd - Library
Affects Versions: 0.24.0
Reporter: Jens Geyer
With {{\-mc:<n>}} the netstd tutorial client is meant to run _n_ clients
against the server; the tutorial README's sample is {{Client \-tr:tcp
\-pr:binary \-mc:10}}. With more than one client, none of them completes its
calls. {{RunAsync()}}
([Client/Program.cs:125-140|https://github.com/apache/thrift/blob/bcdf956895aeac5411ce3029ab8b33901b7c7a36/tutorial/netstd/Client/Program.cs#L125-L140])
creates one transport and one protocol and hands that same protocol to every
{{RunClientAsync()}} task. All clients then write to, read from and finally
close the one transport at the same time, through one shared protocol instance.
||Client||Runs||Result||
|{{\-tr:tcp \-mc:1}}|1|all calls complete|
|{{\-tr:tcp \-mc:2}}|1|both clients fail: "Cannot read, Remote side has closed"|
|{{\-tr:tcp \-mc:5}}|3|no client completes. One run hung until it was killed
after 60 s. The others failed with "Cannot read, Remote side has closed", or
with "MaxMessageSize reached" and {{IOException}}s from cancelled reads.|
|{{\-tr:tcp \-mc:10}}|2|all 10 clients fail: "Cannot read, Remote side has
closed"|
|{{\-tr:http \-mc:5}}|3|no client completes: four fail with "Sent 0 request
content bytes, but Content-Length promised 17." and one with "The operation was
canceled."|
The server ran with the same {{\-tr}} value. For HTTP it needed the one-line
fix from THRIFT-6374, because the tutorial's HTTP server does not start as it
is. Apart from the hung run, the client exits with 0 every time, because
{{RunClientAsync()}} logs the exception and returns.
Checked on master (bcdf956) with the .NET 10.0.401 SDK, server and client in
one container, binary protocol. The tutorial code is the same on master,
release/0.25.0 and release/0.24.0.
Commit 0d12832d ("misc. netstd improvements", 2021) replaced the per-client
arrays of transports and protocols with this single pair. Creating a transport
and a protocol for each client inside the loop again fixes it: with that change
every client completes, with {{\-tr:tcp \-mc:10}} (2 runs) as well as with
{{\-tr:http}} at {{\-mc:5}} and {{\-mc:10}}.
_Drafted with AI assistance (Claude Opus 5.5)._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)