http server hangs (delays request processing) when using utils.pause #644

natevw opened this Issue Aug 15, 2012 · 0 comments

2 participants


I am having trouble with my connect-based server simply hanging up on more or less every other request that uses utils.pause. What happens is a request comes in and connect doesn't even seem to get it (e.g. logging w/immediate doesn't show it come in). But then after a few minutes, suddenly it goes through happy as ever — just hugely delayed.

The symptom seems similar to these postings:!topic/nodejs/6TqmSfsqEs8%5B1-25%5D ("http server hangs up for 2 mins and then serves")!searchin/nodejs-dev/http$20server$20hang/nodejs-dev/Lw2nfG054Go/rMwsN7TLr0sJ%5B1-25%5D ("http.Server.request.pause() without request.resume() followed by response.end() causes subsequent requests received on keep-alive connection to hang for 2 minutes.")

I suspect this is related to issue #137 (no idea why that's closed, still no actual event pausing is done) in that the way the "pause" dependency works is simply by repeating (=duplicating) events on resume. I wonder if these extra events are causing other listeners (i.e. node's http core itself?) to get into a bad state. According to @isaacs on the second groups thread above, apparently there is/was a

"res.end() before req.emit("end") causes mayhem" issue

…so maybe there is other mayhem in the presence of req.emit("end") goofiness?

If I simply req.pause(); /*…*/ req.resume() instead of var pausedReq = connect.utils.pause(req); /*…*/ pausedReq.resume() the hangs go away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment