You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using the request@2.52.0 module to download files from a node server.
This has also been tested on request@2.73.0
We are using file streaming from the node server and we are also streaming the response to a file
If we loose connection mid download the module gets stuck and never finishes.
We are running a synchronous application and there for it stops working when the request module gets stuck.
I wrote a test code which you should be able to use to test this.
//for server install restify and throttle
npm i restify
npm i throttle
//for client install request
npm i request
server code
varrestify=require("restify");varthrottle=require("throttle");varfs=require("fs");varserver=restify.createServer();server.use(restify.bodyParser());server.use(restify.queryParser());server.get("/server",function(req,res){res.send(200,"This is the correct server");})server.get("/download",function(req,res){vartrott=newthrottle(512);fs.createReadStream("fileUpload/file.dat").pipe(trott).pipe(res);});server.listen(3000,function(){console.log("Download Server listening");});
Run the client code on your desktop and turn off your internet adapted for more than 10 minutes. (I used a ubuntu virtual machine and turned off the 'Enable Networking')
When internet connection is resumed the module gets stuck and never finished the pipe and therefor the code in the output.on("finish", function is never run. (There the callback is called in our application)
If the internet connection is dropped for less that 10 minutes the output finish function is called but does not finish download the file. This scenario is okay for me because this will initiate a redownload.
The deadlock we have when the output finish function is never called is a big problem for us.
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
We are using the request@2.52.0 module to download files from a node server.
This has also been tested on request@2.73.0
We are using file streaming from the node server and we are also streaming the response to a file
If we loose connection mid download the module gets stuck and never finishes.
We are running a synchronous application and there for it stops working when the request module gets stuck.
I wrote a test code which you should be able to use to test this.
server code
client code
Request-Debug output
How to recreate
Deploy the server code to a remote server and create a file of size x
Run the client code on your desktop and turn off your internet adapted for more than 10 minutes. (I used a ubuntu virtual machine and turned off the 'Enable Networking')
When internet connection is resumed the module gets stuck and never finished the pipe and therefor the code in the output.on("finish", function is never run. (There the callback is called in our application)
If the internet connection is dropped for less that 10 minutes the output finish function is called but does not finish download the file. This scenario is okay for me because this will initiate a redownload.
The deadlock we have when the output finish function is never called is a big problem for us.
The text was updated successfully, but these errors were encountered: