-
Notifications
You must be signed in to change notification settings - Fork 5
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
Client receive loop Exception #16
Comments
Hi, |
The exception itself means that the client forcefully stopped connection (either sent Can you answer to these two questions:
|
I reproduced the issue. It happens when connection to client is dropped (or reset) when server is in progress of reading data (that happens as well if client didn't send Server seems to properly handle new clients. Can you confirm that's the case? |
For now I simply handled that exception. There is a way to rewrite part of the code to avoid this exception in the first place (it will require implementing part of the StreamReader manually) and I will consider doing so. The questions from my second reply are still relevant. |
Thanks. Has the program crashed right after this exception? I don't think that this exception caused it, because it's handled. Do you log stdout and stderr as well? If so, are there any exceptions or errors there? I believe that the crash is caused by some other exception (either in my library, in your app or some other library you use). |
The program does not crash but the smtp server does not respond anymore to any request.
|
|
|
Thanks.
Ok, I'm waiting for a crash.
Listener isn't responsible for receiving data from clients. Listener is only responsible for accepting new clients. So either |
I created branch |
I'will try this version and I'll let you know as soon as I get the error. |
Hi, today the situation is the following:
The application log shows the following errors:
Now I'm going to use the dispose-log branch to compile my application and I'll let you know what happens. |
Just another log before to pass to dispose-log branch.
here I've restarted the IIS server but the
In this particular case the first exception is inside the Client Write and the _fails counter is incremented by one. The other two exceptions are in the Client receive loop and after 2 exceptions the loop is exited and the SMTP server no more accepts emails even if it is active on all ports (tested with telnet).
|
Good news with the dispose-log branch the client is still alive even after more then three consecutive exceptions.
|
Hi, Sorry for the delay. So adding debug somehow fixed the issue? I love this kind of bugs... |
Yes me too !!! |
I use the SMTP server to process mails from a specific gmail account.
It frequently happens that there are subsequent System.IO.IOException inside the receive loop.
2024-09-08 22:09:01.772 +02:00 [ERR] [Client receive loop] Exception: System.IO.IOException, at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
at System.IO.StreamReader.ReadBufferAsync(CancellationToken cancellationToken)
at System.IO.StreamReader.ReadLineAsyncInternal(CancellationToken cancellationToken)
at CSharp_SMTP_Server.Networking.ClientProcessor.Receive(), Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..
2024-09-08 22:11:21.449 +02:00 [ERR] [Client receive loop] Exception: System.IO.IOException, at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
at System.IO.StreamReader.ReadBufferAsync(CancellationToken cancellationToken)
at System.IO.StreamReader.ReadLineAsyncInternal(CancellationToken cancellationToken)
at CSharp_SMTP_Server.Networking.ClientProcessor.Receive(), Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..
2024-09-08 22:12:51.415 +02:00 [ERR] [Client receive loop] Exception: System.IO.IOException, at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
at System.IO.StreamReader.ReadBufferAsync(CancellationToken cancellationToken)
at System.IO.StreamReader.ReadLineAsyncInternal(CancellationToken cancellationToken)
at CSharp_SMTP_Server.Networking.ClientProcessor.Receive(), An existing connection was forcibly closed by the remote host..
After 3 exceptions the loop is exited but the exception is not throwed and the listener is not stopped by anyone.
I have some questions:
The text was updated successfully, but these errors were encountered: