Closed
Description
How to reproduce
[Test]
public async Task SendToOthersInChannelTest1()
{
for (var i = 0; i < 100; i++)
{
var channel = $"channel-{Guid.NewGuid()}";
var msg = new TestMessage { Msg = "Hello" };
var ch = Channel.CreateUnbounded<TestMessage>();
await using (var connection = await HubClient.ConnectAsync(config.Endpoint, config.TenantName, config.ClientId, accessKey)) //connect to our signalr server
await using (var connection1 = await HubClient.ConnectAsync(config.Endpoint, config.TenantName, config.ClientId, accessKey))
{
await connection.InvokeAsync<string>("JoinChannel", channel); //this will trigger a method in the server side, the server just add the connection to the channel, it will call groupManager.AddToGroupAsync(connectionId, channel, cancellationToken)
await connection1.InvokeAsync<string>("JoinChannel", channel);
connection.On<TestMessage>(Helper.DefaultMethod, receivedMsg => {
return ch.Writer.WriteAsync(receivedMsg).AsTask();
});
await connection1.InvokeAsync("SendToOthersInChannel", channel, msg); //send the msg to all other users of channel
var cts = new CancellationTokenSource();
cts.CancelAfter(TimeSpan.FromMinutes(5));
var received = await ch.Reader.ReadAsync(cts.Token);
Assert.True(received.Equals(msg), $"SendToOthersInChannelTest1({i}) receive check failed: {channel} {msg.GetType()}-{msg} {received.GetType()}-{received}");
}
}
}
This test will fail stably after run several times when I connect the server that deployed in the azure kubernetes cluster, the Message field of the received TestMessage is empty like below, but can't reproduce it when I connect to the server in my local computer.
SendToOthersInChannelTest1(0) receive check failed: channel-3cfcf029-312b-43a4-a173-787e43c1e564 TestMessage-Hello TestMessage-
Expected: True
But was: False
When connect to server that deployed in the azure kubernetes cluster, I capture the traffic with fiddler, and it shows that the entire message is received.
rcs.zip
I'm not sure it's an issue of signalr client or my misusage or misconfiguration, can anyone give some hints about how to fix this issue?
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
ghost commentedon Jan 8, 2025
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
ghost commentedon Jan 8, 2025
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
nagilson commentedon Jan 14, 2025
@dotnet/aspnetcore-tooling Please help route this to the correct person for inspection.
BrennanConroy commentedon Jan 14, 2025
Hi. It looks like this is a question about how to use SignalR. While we do our best to look through all the issues filed here, we are not a general-purpose forum. To get a faster response we suggest posting your questions to StackOverflow using the
signalr
tag.