apify / proxy-chain

Node.js implementation of a proxy server (think Squid) with support for SSL, authentication and upstream proxy chaining.
https://www.npmjs.com/package/proxy-chain
Apache License 2.0
804 stars 138 forks source link

A lot of TCP connections #362

Closed Rumatoid closed 1 year ago

Rumatoid commented 1 year ago

proxy-chain generate a lot of TCP connections without PC I have about 50 connections, but 150 with PC

Im using ProxyChain.Server with prepareRequestFunction

kami4ka commented 1 year ago

Up! I Found the same issue. Connections are not closing.

jirimoravcik commented 1 year ago

Hello guys, thanks for reporting this issue. You have any minimal code to reproduce the problem? Thanks

Rumatoid commented 1 year ago

Hello guys, thanks for reporting this issue. You have any minimal code to reproduce the problem? Thanks

Just use prepareRequestFunction and watch for TCP connections (in Linux for example)

kami4ka commented 1 year ago

I suppose that the reason is that timeout event from the socket is not handled, so the connection wouldn't be closed, as in case of timeout it should be closed manually.

https://nodejs.org/api/net.html#event-timeout

PS: i guess that my issue couldn’t be the same as for the topic starter, but might be related as well. My issue is related to the active connections that are managed by the library growing despite actual connections with proxies closed and the browser that initiated the connection is closed as well, so the library doesn't recognize some cases of the closed connection.

jirimoravcik commented 1 year ago

Hello guys, thanks for your effort to report this issue. We have released version 2.2.1 that should not leak TCP connections anymore.