On Wednesday, December 27, 2017 at 8:18:51 AM UTC+1, node...@gmail.com wrote: > > In the middleware function, to move on to the succeeding middleware > function, we need to invoke the next function. As we all know, if we omit > the call the next() function, the request will be hanging. In these > scenarios, are there any performance implications due to this? If yes, then > what are those issues? What might be the issues if we do not explicitly > call next function and requests are left hanging? > > > This depends on the clients, settings, etc. If the clients close the requests or timeout, and if there aren't that many of them, you might do fine. After a client disconnects, express will clean up and close your request (usually). The thing is though, until the connection closes, this request is left hanging. And with it all other request-allocated resources, such as session info etc. So if enough of the requests pile up, you might run out of memory or other resources. You also might have some resources open, locked, or whatever, and you require next middleware or error middleware or someone else to clean this up. E.g. depending of what libs you use, you might end up with one that is lousy and opens one db connection per request, and you run out of pool of db connections, so all other ops are left waiting for timeouts and requests closed etc.
So it can get to performance or even more, stability issues. It's usually not a super smart thing to leave middleware hanging. -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. To post to this group, send email to nodejs@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/906decc1-84bb-428a-b501-27b2fae88b98%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.