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

版本1.6.6.1,运行了一两年的机台出实现了:调用SuperSocket.SocketEngine.AsyncSocketSession.OnSendingCompleted时出现System.ArgumentNullException: 值不能为 null。 #774

Open
goowell opened this issue Jan 6, 2025 · 1 comment

Comments

@goowell
Copy link

goowell commented Jan 6, 2025

异常日志:
2025/01/04 17:59:37.282 ERROR
System.ArgumentNullException: 值不能为 null。
参数名: source
在 System.Linq.Enumerable.Select[TSource,TResult](IEnumerable1 source, Func2 selector)
在 System.Linq.Enumerable.Sum[TSource](IEnumerable1 source, Func2 selector)
在 SuperSocket.SocketEngine.AsyncSocketSession.OnSendingCompleted(Object sender, SocketAsyncEventArgs e)
在 System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)
在 System.Net.Sockets.SocketAsyncEventArgs.ExecutionCallback(Object ignored)
在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)
在 System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
在 System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
2025/01/04 17:59:37.331 ERROR
System.InvalidOperationException: "现在已经正在使用此 SocketAsyncEventArgs 实例进行异步套接字操作。
在 System.Net.Sockets.SocketAsyncEventArgs.StartConfiguring()
在 System.Net.Sockets.SocketAsyncEventArgs.SetBufferInternal(Byte[] buffer, Int32 offset, Int32 count)
在 System.Net.Sockets.SocketAsyncEventArgs.SetBuffer(Byte[] buffer, Int32 offset, Int32 count)
在 SuperSocket.SocketEngine.AsyncSocketSession.ClearPrevSendState(SocketAsyncEventArgs e)
在 SuperSocket.SocketEngine.AsyncSocketSession.OnSendingCompleted(Object sender, SocketAsyncEventArgs e)
在 System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)
在 System.Net.Sockets.SocketAsyncEventArgs.ExecutionCallback(Object ignored)
在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)
在 System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
在 System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

对于该问题我快速看了代码,没有找到具体原因,有以下几个方向的猜测:

  1. 是否SendQueue在被访问的时候被其他线程赋值为null?
  2. 是否有可能是多线程访问的问题导致了queue引用异常?
  3. 能否在OnSendingCompleted中加入对queue的非空验证?因为这时候已经是发送结束的收尾阶段,异常后记录警告级别的日志。

其他信息:
server config:除了端口号和IP外其他都是默认。
程序会异步调用AppSession.Send(string message)

感谢支持。

@kerryjiang
Copy link
Owner

建议升级到SuperSocket 2.0.
1.6版本不再维护了。

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

No branches or pull requests

2 participants