-
-
Notifications
You must be signed in to change notification settings - Fork 658
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
Crashing host process on socket timeout #1690
Comments
I will see if the upgrade to 52.0.0 fares better. I can see that the close sequence was updated in the new version. I think there is still some logic related to handling the close, because a cancelled (outer) token will cause a different cancellation error than what is intended (will throw from within the close call, not the But at least the call chain is now preserved, and the exception should bubble to the caller. |
Yes, please check this with V52. As we should be ending up here: and I would be interested in how that "fares". |
It appears to still happen with 52.0.0, but I have not collected enough details yet: |
Ok, this one will be difficult. Stack trace might be helpful as a starter. I wonder about the exact order of events and methods called on this timeout. Oh, and we do now have some good logging in there also, so perhaps if you can get logs? |
@FanDjango , could it be something with multithreading? Duplicati will have multiple instances of There is a full stack trace in the issue I linked above, and I cannot see any retry happening inside FluentFTP. I will try to see if the current "LogToConsole" is sufficient to get deeper into the problem, and add some additional logging options in case it is not. |
You have reported a number of isssues. I need to be sure that we can keep them separate. #1686 This is classified as a bug, it is pending someone working on it, there is a workaround #1694 This is classified as a bug, has been fixed in master, pending release, there is a workaround #1690 (This one) This is not classified yet. Deity only knows what is going on here. This one:
I don't really think we still have holes in thread safety. We did have some in the FluentFTP.GnuTLS component, but only in the beginning and they were discovered right away. And without any logs I cannot even discern if you are using SslStream or GnuTLSStream.
#1694 was the issue which relates to "retry" activity. But this issue, for me to try to help: I would need MORE information, especially logging. This would show up the sequence of events, across all client sessions. Note that FluentFTP logs of your clients should have a logger that prefixes the client-identificator in front of the log lines, so that in a multi threaded FTP environment, one can correlate log entries to their client. So I must reiterate:
I will try to recreate this somehow in my own environment. My analysis of the stack trace you provided (at the top of this) and looking at the code: (Presumably) a transfer ends. Upload or Download (it is important) is not known to me. A log would tell. That part of the code you could call "faulty" and this needs to be fixed/addressed (I will do so, actually, but not this year :-) ). But it would also be very very nice to find out what is going wrong in the first place - unless it is a total eclipse of the net - both connections breaking down simultaneously, maybe. And that will be the first scenario I will test in order to reproduce this. Not this year, though. Until then, I hope you can find out more, but I am sure we can make progress in this in the end. |
Specifically, I can see the problem in CloseDataStream.cs: try {
if (IsConnected) {
// Because the data connection was closed, if the command that required the data
// connection was not successful then there will be no reply from the server,
// however if the command was successful the server will send a reply .
if (stream.CommandStatus.Type == FtpResponseType.PositivePreliminary) {
if (!(reply = ((IInternalFtpClient)this).GetReplyInternal(LastCommandExecuted)).Success) {
throw new FtpCommandException(reply);
}
}
}
}
finally {
// if this is a clone of the original control connection we should Dispose() the entire client
if (IsClone) {
((IInternalFtpClient)this).DisconnectInternal();
((IInternalFtpClient)this).DisposeInternal();
}
} The call to Lemme look at this some more in 2025, ok? |
Thanks for taking the time to sort out the mixed report threads. |
Fixed in master |
FTP Server OS: Linux
FTP Server Type: Unknown
Client Computer OS: Linux
FluentFTP Version: 50.1.0
Framework: .NET8
During a timeout it looks like the shutdown process causes an unhandled exception.
I think the cause is this line:
https://github.com/robinrodricks/FluentFTP/blob/master/FluentFTP/Streams/FtpSocketStream.cs#L560
In here it will attempt to close the connection due to a timeout, but if the socket is already faulty, the close call will fail as well.
Since this happens in the token callback, the uncaught exception has nowhere to go.
Logs :
The text was updated successfully, but these errors were encountered: