express-myconnection icon indicating copy to clipboard operation
express-myconnection copied to clipboard

Connection leak when the response is terminated unexpectedly

Open seykron opened this issue 10 years ago • 5 comments

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.

seykron avatar Nov 07 '14 13:11 seykron

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.

eladnava avatar Jan 11 '15 09:01 eladnava

+1

ohgyun avatar Feb 07 '15 13:02 ohgyun

+1

colonelz avatar Aug 13 '15 13:08 colonelz

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

szyuan avatar Jun 16 '17 01:06 szyuan

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...

jybleau avatar Jun 16 '17 21:06 jybleau