Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preventing Leakage of the RemotingSession #65

Merged
merged 4 commits into from
Nov 14, 2024

Conversation

sancheolz
Copy link
Contributor

If the client process crashes, then checking idle sessions will not be able to close the session, because the _rawMessageTransport.SendMessage call will throw an exception.

If the client process crashes, then checking idle sessions
will not be able to close the session, because the _rawMessageTransport.SendMessage call
will throw an exception.
Copy link
Collaborator

@yallie yallie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging.

@yallie yallie merged commit 95401db into theRainbird:master Nov 14, 2024
1 check failed
@yallie
Copy link
Collaborator

yallie commented Nov 14, 2024

Thanks for the PR!
Hmm, looks like test cleanup fails for some reason.

@sancheolz
Copy link
Contributor Author

Yes, it was introduced after updating WatsonTCP to 6.05. WatsonTcpServer trows TaskCanceledException in Dispose().

 [Test Class Cleanup Failure (CoreRemoting.Tests.SessionTests)]: System.AggregateException : One or more errors occurred. (A task was canceled.)
---- System.Threading.Tasks.TaskCanceledException : A task was canceled.
  Stack Trace:
     at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at WatsonTcp.WatsonTcpServer.Dispose(Boolean disposing)
   at WatsonTcp.WatsonTcpServer.Dispose()
   at CoreRemoting.Channels.Tcp.TcpServerChannel.Dispose() in /home/runner/work/CoreRemoting/CoreRemoting/CoreRemoting/Channels/Tcp/TcpServerChannel.cs:line 101
   at CoreRemoting.RemotingServer.Dispose() in /home/runner/work/CoreRemoting/CoreRemoting/CoreRemoting/RemotingServer.cs:line 208
   at CoreRemoting.Tests.ServerFixture.Dispose() in /home/runner/work/CoreRemoting/CoreRemoting/CoreRemoting.Tests/ServerFixture.cs:line 68

@sancheolz
Copy link
Contributor Author

sancheolz commented Nov 14, 2024

This test fails starting from 6.0 version of WatsonTCP:

var server = new WatsonTcpServer("127.0.0.1", 9000);
server.Events.MessageReceived += (_, _) => { Console.WriteLine("srecv"); };
server.Start();
var client = new WatsonTcpClient("127.0.0.1", 9000);
client.Events.MessageReceived += (_, _) => { Console.WriteLine("crecv"); };
client.Connect();
Task.Run(() => { client.SendAsync("aaa"); });
server.Dispose();

Reported dotnet/WatsonTcp#303

@yallie
Copy link
Collaborator

yallie commented Nov 14, 2024

This test fails starting from 6.0 version of WatsonTCP:

Hmm, sometimes this code sample throws another exception:

An item with the same key has already been added

I've filed another issue about it — dotnet/WatsonTcp#304

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants