Gäng Tian
Gäng Tian

Reputation: 1608

Debug nodejs pipe ERR_EMPTY_RESPONSE

I have an single page app running off nodejs + express 4.0, the app is a filtering program that let the user select some target population for data analysis then once the user click submit, the app will send the filter as a JSON to the node server then the server will pipe the POST request to another server which is running R and do some computation and send back the result file for the app to download. For small and fast computation is running fine, but for large data set I keep getting ERR_EMPTY_RESPONSE on chrome with no additional error code. I did a log on the piping in node with the following code

  request.post({url:RSS.R, form:params,forever:true,timeout:10*60*1000},function(err,http,body){
    console.log(err);
    console.log(http.headers);
  }).pipe(res);

And I am able to log the response headers from the R server even I got the error page on Chrome, so I think it's either node or express is timing out my connection. I am using express 4.0 with connect-timeout and set this following code

app.use(timeout('1800s'));

But it doesn't seem to do anything, the connection still times out after couple minutes.

So my question is what could be the gating item here? Or is there something else I should set at node level instead of express?

Thank you very much for the help in advance.

P.S same issue with Firefox and IE also, but it seems that they wait a bit longer and instead of getting ERR_EMPTY_RESPONSE, FF and IE just blanks the page and stop loading altogether.

Upvotes: 3

Views: 422

Answers (0)

Related Questions