Closed twodogmbh closed 5 years ago
This error only appears when there is a ReadAsync
or TryRead
without an AdvanceTo
, but I'm unable to reproduce the problem. I'll try to make a blind fix. Please test it with 3.1.2-ci.23
as soon as it's published (I guess in ca. 1 hour). Thank you in advance.
You can download the packages from the following feed:
Thank you for the fix. With the version 3.1.2-ci.23 the exception in the StreamPipeWriterService does not occur anymore. (At least not until now, but I have to continue watching our acceptance tests)
But now I get sporadically the following exception on the client side. When trying to call a FTP delete command:
System.Net.WebException: Unable to connect to the remote server
at System.Net.FtpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.WebRequest.<>c.<GetResponseAsync>b__68_2(IAsyncResult iar)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
There is no exception in the FTP server log. When I call the command 100ms later again it is successful. This never happened in the previous versions. I don't know if this could issue could be related to your latest changes.
Is it possible for you to provide a unit test?
I also promoted 3.1.2-ci.42 to prerelease status where I fixed some corner cases (including an ObjectDisposedException).
EDIT: Maybe it's a saturation of the connection handling code. I had a similar (or the same) problem when I used the unit test for #82 and increased the maximum number of concurrent connections to 500.
EDIT 2: Yes, it seems like it's the same problem:
FubarDev.FtpServer.Tests.Issues.Issue82ProtocolViolation.TestParallelRequests
System.Net.WebException : Unable to connect to the remote server
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source)
at System.Net.FtpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.WebRequest.<>c.<GetResponseAsync>b__68_2(IAsyncResult iar)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at FubarDev.FtpServer.Tests.Issues.Issue82ProtocolViolation.GetFilesAsync() in D:\OpenSource\FtpServer\test\FubarDev.FtpServer.Tests\Issues\Issue82ProtocolViolation.cs:line 46
at FubarDev.FtpServer.Tests.Issues.Issue82ProtocolViolation.TestParallelRequests() in D:\OpenSource\FtpServer\test\FubarDev.FtpServer.Tests\Issues\Issue82ProtocolViolation.cs:line 34
--- End of stack trace from previous location where exception was thrown ---
EDIT 3: It seems unlikely that I can improve this situation, so I suggest that you use some tool like Polly or request throttling.
Unfortunately issue #82 is still not completely solved. The FTP client still occasionally throws "The server committed a protocol violation" exceptions.
The FTP server then shows an InvalidOperationException.
Here an extract of the FTP server log file with the exception: