Created
April 17, 2014 21:28
-
-
Save davetapley/11012625 to your computer and use it in GitHub Desktop.
Failing to call res.send(200) in an express app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ab -n 1000 -c 1000 http://localhost:3000/hang | |
This is ApacheBench, Version 2.3 <$Revision: 1554214 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking localhost (be patient) | |
apr_socket_recv: Connection reset by peer (104) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get '/hang', (req, res) -> | |
console.log 'Request ', n | |
n += 1 | |
# res.send 200 |
Additionally, I found you can pass -r
to ab
to have it ignore socket errors.
When I use that I actually start to see some requests being completed:
Completed 100 requests
Completed 200 requests
apr_pollset_poll: The timeout specified has expired (70007)
What could be happening here?
Does express or node know to time out and close the connections?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So it's pretty clear that without calling
res.send
we're just left "hanging".The
console.log
usually gets through a few 100s beforeab
gives up.My questions:
apr_socket_recv
?