ftp: fix deadlock after failed update when concurrency=1 #5590
+2
−1
Conversation
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
What is the purpose of this change?
Our users complained many times that rclone FTP client manifests random problems with completing a file upload.
As my investigations have shown, the bug triggers because jlaffaye/ftp does not properly nudge the fshttp anti-hanging timer on command channel after a file upload. I have a working fix for jlaffaye/ftp and backend/ftp which I will submit later.
This pull request solves a second-stage bug triggered by the above bug which can be fixed solely in rclone. Frequently when users reported the above bug we recommended them to simplify their FTP client settings, in particular set
--ftp-concurrency=1
. When the FTP backend's upload routine encounters a error, it will remove the failed file. The removal needs another connection but due to low concurrency setting it will wait for connection token forever.This patch modifies the upload routine so that after error it will first release the failed connection and then remove the failed file and thus avoid the deadlock.
Due to presence of another bug I will include a relevant unit test with a dedicated pull request #5596, not here. I just hope that the change looks self-evident. @ncw ??
Was the change discussed in an issue or in the forum before?
Checklist
The text was updated successfully, but these errors were encountered: