Note that there are some explanatory texts on larger screens.

plurals
  1. PONode.js server GET to separate API failing after a few hours of use
    primarykey
    data
    text
    <p>In my node site I call a restful API service I have built using a standard http get. After a few hours of this communication successfully working I find that the request stops being sent, it just waits and eventually times out. </p> <p>The API that is being called is still receiving requests from elsewhere perfectly well but when a request is sent from the site it does not reach the API.</p> <p>I have tried with stream.pipe, util.pump and just writing the file to the file system.</p> <p>I am using Node 0.6.15. My site and the service that is being called are on the same server so calls to localhost are being made. Memory usage is about 25% over all with cpu averaging about 10% usage.</p> <p>After a while of the problem I started using the <a href="https://github.com/mikeal/request" rel="nofollow">request</a> module but I get the same behaviour. The number of calls it makes before failing varrys it seems between 5 to 100. In the end I have to restart the site but not the api to make it work again.</p> <p>Here is roughly what the code in the site looks like:</p> <pre><code>var Request = require('request'); downloadPDF: function(req, res) { Project.findById(req.params.Project_id, function(err, project) { project.findDoc(req.params.doc_id ,function(err, doc) { var pdfileName; pdfileName = doc.name + ".pdf"; res.contentType(pdfileName); res.header('Content-Disposition', "filename=" + pdfileName); Request("http://localhost:3001/" + project._id).pipe(res); }); }); } </code></pre> <p>I am lots at what could be happening.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload