apify / proxy-chain

Node.js implementation of a proxy server (think Squid) with support for SSL, authentication and upstream proxy chaining.

Home Page:https://www.npmjs.com/package/proxy-chain

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memory leak when using anonymize proxy

radonirinamaminiaina opened this issue · comments

Hello,

I'm using proxy-chain to my proxy rotation, and worker_threads to manage parallel crawling, and pm2 to start my server with proxy-chain.
It is possible that many workers perform many tasks in some minutes and it brokes the operation.
When the crawling app runs and use proxy-chain for many hours, I have the error below:

(node:31706) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added to [Socket]. Use emitter.setMaxListeners() to increase limit
    at _addListener (events.js:390:17)
    at Socket.addListener (events.js:406:10)
    at Socket.Readable.on (_stream_readable.js:845:35)
    at Socket.socketListenerWrap [as on] (_http_server.js:829:54)
    at Server.prepareRequestHandling (/data/scrapr/node_modules/proxy-chain/build/server.js:280:20)
    at Server.onRequest (/data/scrapr/node_modules/proxy-chain/build/server.js:195:18)
    at Server.emit (events.js:315:20)
    at parserOnIncoming (_http_server.js:779:12)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:117:17)

How can I fix this?

Node: v14.x.x
OS: Debian

Still happening

Fixed via #146