Error after downloading lots of files
See original GitHub issueI have a timer that runs every 100ms. It goes through a list of known remote file paths on the FTP server and attempts to download them to the local machine.
The timer has locks to ensure that only 3 requests are active at any one time (every time a download finishes it releases another slot to the pool).
This works well for about 20 seconds before get()
errors out with
Unable to make data connection
Here is a reduced example of what is happening
function ftpController() {
this.conn = new ftpClient();
}
ftpController.prototype.downloadFile = function(remotePath, cb) {
cb = cb || function() {};
localPath = mods.folderPath + remotePath;
ftp.conn.get(remotePath, function(err, stream) {
if (err) {
debug('** Error downloading ' + remotePath, err);
cb(false);
} else {
stream.pipe(fs.createWriteStream(localPath));
cb(true);
}
});
};
// Stripped code example
ftp.downloadFile('/test/test1.txt', releaseAnotherDownload);
ftp.downloadFile('/test/test2.txt', releaseAnotherDownload);
ftp.downloadFile('/test/test3.txt', releaseAnotherDownload);
Should I be creating a new connection for each download rather than trying to use the same, is my FTP server throttling me because I’m not making a new connection for each file?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:2
- Comments:14
Top Results From Across the Web
Fix file download errors - Google Chrome Help
If you get an error message on Chrome when you try to download apps, themes, extensions, or other files, try these fixes.
Read more >6 Ways to Fix the “Download Failed Network Error” on Chrome
6 Ways to Fix the “Download Failed Network Error” on Chrome · 1. Check Your Internet Speed and Connection · 2. Modify Your...
Read more >Can't Download Anything on a Windows 10 Computer [Solved]
Fix 1: Check If Many Files Are Being Downloaded; Fix 2: Change Internet Option Settings; Fix 3: Clear Your Browser's Cache; Fix 4:...
Read more >How to fix unable to run or other errors with a downloaded file
If you cannot open a file that you downloaded, or cannot run a downloaded executable file, the following steps may help you fix...
Read more >Folder copy error message when downloading a file that is ...
Describes a folder copy error that occurs because a security change in Windows XP SP2 or later affects the WebDAV redirector.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was just bitten by this as well. It looks like the problem is in
connection.js
withself._pasvSocket = socket;
. It replaces _pasvSocket each time. So for example, GET 1 sets _pasvSocket, GET 2 overrides _pasvSocket, then GET 1 completes, which clears _pasvSocket, so GET 2 fails withUnable to make data connection
. In my testing, it was always the third GET that was causing the problem, but I would guess that it depends on the timing for each GET.+1