Skip to content

Instantly share code, notes, and snippets.

@jorangreef
Created February 24, 2011 17:58
Show Gist options
  • Save jorangreef/842563 to your computer and use it in GitHub Desktop.
Save jorangreef/842563 to your computer and use it in GitHub Desktop.
Server.request.pause() causing problems for subsequent requests on keep-alive connections
var http = require('http');
http.createServer(
function(request, response) {
request.pause();
response.writeHead(200, { 'Content-Type': 'text/plain' });
response.write('now press CMD + R and every other request will hang for 2 minutes before returning');
response.end();
}
).listen(4000);
http.createServer(
function(request, response) {
response.writeHead(200, { 'Content-Type': 'text/plain' });
response.write('now press CMD + R and the next request will return fine');
response.end();
}
).listen(2000);
// Visit http://localhost:2000 and everything works fine.
// Visit http://localhost:4000 and every other request will hang for 2 minutes before returning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment