express-myconnection
express-myconnection copied to clipboard
Connection leak when the response is terminated unexpectedly
Node HTTP API defines two events to finish the response: finish
and close
. When res.end()
is called node triggers the finish
event, but if the request terminates unexpectedly (i.e.: the client reloads the page before the response is sent) close
is triggered instead.
Proxying res.end()
does not take into account the close
event and it causes a connection leak. The strategy should be changed to listen for both finish
and close
events.
Any reason why the fix isn't being deployed as an update to NPM? I just experienced this on my production server, causing all requests to hang because the pool ran out of connections (because they weren't released properly).
Please deploy it to NPM so it doesn't happen to anyone else.
+1
+1
I fixed this bug on this basis and published it to npm
npm install express-mysql-connection
github: express-mysql-connection
npm: express-mysql-connection
Thanks a lot @szYuan For my part I was using a private npm package while waiting for a merge.
Ultimately, @seykron 's branch should be merged with the master branch... I don't know if @pwalczyszyn can make any of us a contributor (github + npm) or proceed himself...