SuperSocket icon indicating copy to clipboard operation
SuperSocket copied to clipboard

websocket在大量连接下发送数据遇到一个BUG

Open x0gundam1133 opened this issue 2 years ago • 2 comments

外网大量用户连接,每天大概触发2-3次,找不到规律 内网大量连接发送测试没重现 看错误是websocket连接过程中握手发送消息错误 版本2.0 beta18

2024-03-01 11:15:27,765 [.NET ThreadPool Worker] ERROR SuperSocketService - Session[02e35048-d60a-49e7-8aa9-7b19e44669ad]: session exception. SuperSocket.PackageHandlingException1[SuperSocket.WebSocket.WebSocketPackage]: Session 02e35048-d60a-49e7-8aa9-7b19e44669ad got an error when handle a package. ---> System.InvalidOperationException: Writing is not allowed after writer was completed. at System.IO.Pipelines.ThrowHelper.ThrowInvalidOperationException_NoWritingAllowed() at System.IO.Pipelines.Pipe.DefaultPipeWriter.GetSpan(Int32 sizeHint) at SuperSocket.ProtoBase.Extensions.Write(IBufferWriter1 writer, ReadOnlySpan1 text, Encoding encoding) at SuperSocket.WebSocket.Server.WebSocketPackageHandler.<>c__DisplayClass17_0.<HandleHandshake>b__0(PipeWriter writer) at SuperSocket.Channel.PipeChannel1.SendAsync(Action1 write) at SuperSocket.WebSocket.Server.WebSocketPackageHandler.HandleHandshake(IAppSession session, WebSocketPackage p) at SuperSocket.WebSocket.Server.WebSocketPackageHandler.Handle(IAppSession session, WebSocketPackage package) at SuperSocket.Server.PackageHandlingSchedulerBase1.HandlePackageInternal(IAppSession session, TPackageInfo package) --- End of inner exception stack trace ---

x0gundam1133 avatar Mar 01 '24 06:03 x0gundam1133

我也遇到了同样的错误,像客户端发送报文时偶尔会出错:

****************************异常文本**************************** 【出现时间】:2024/7/15 14:09:43 【异常类型】:InvalidOperationException 【异常信息】:Writing is not allowed after writer was completed. 【堆栈调用】: at System.IO.Pipelines.ThrowHelper.ThrowInvalidOperationException_NoWritingAllowed() at System.IO.Pipelines.Pipe.DefaultPipeWriter.GetSpan(Int32 sizeHint) at SuperSocket.Channel.PipeChannel1.WriteBuffer(PipeWriter writer, ReadOnlyMemory1 buffer) in D:\coding\夏工\code\SuperSocket-master\src\SuperSocket.Channel\PipeChannel.cs:line 335 at SuperSocket.Channel.PipeChannel1.SendAsync(ReadOnlyMemory1 buffer) in D:\coding\夏工\code\SuperSocket-master\src\SuperSocket.Channel\PipeChannel.cs:line 323 at AcquisitionPlatform.Command_Heart.Execute(MyAppSession session, StringPackageInfo package) in D:\coding\夏工\code\SuperSocket-master\AcquisitionPlatform\Command\Command_Heart.cs:line 47 ***************************************************************

loveyeguo avatar Jul 16 '24 00:07 loveyeguo

It looks like something was being sent but the connection dropped.

kerryjiang avatar Aug 27 '24 04:08 kerryjiang

Released SuperSocket 2.0.0-beta.27 to fix this issue: https://www.nuget.org/packages/SuperSocket/2.0.0-beta.27

kerryjiang avatar Oct 01 '24 04:10 kerryjiang