anyproxy icon indicating copy to clipboard operation
anyproxy copied to clipboard

Memory leaks issues

Open pedrogaldino opened this issue 4 years ago • 2 comments

Hello! I'm having some memory leaks problems.

This is my code:

const AnyProxy = require('anyproxy');

const options = {
    port: 8001,
    rule: {
        * beforeDealHttpsRequest(requestDetail) { /* ... */
            return true;
        },
    },
    webInterface: {
        enable: false,
        webPort: 8002
    },
    throttle: 10000,
    forceProxyHttps: true,
    wsIntercept: false,
    silent: false
};

const proxyServer = new AnyProxy.ProxyServer(options);

proxyServer.on('ready', () => {
    console.log('ready');
});

proxyServer.on('error', (e) => {
    console.log('error ocurred', e);
});

proxyServer.start();

proxyServer.close();

When i start the server, my memory consumption is about 30MB.

When i make a request behind the proxy like this: curl -i -X POST -H "Content-Type: multipart/form-data" -F "file=@/file" -k -v --insecure --proxy-insecure --proxy http://localhost:8001 "https://website.com"

After request finishes, my memory increases in the same size of the file that i've sent in the request. After tests, the problem seems to happen only in POST requests. GET is fine.

Inspecting the memory dump difference on Chrome's inspection, i see an variable (string) called reqBody[0] with all body request stored on memory.

Anyone can help how to fix this, please? Facing this issue on production server :/ Thanks for looking!

Which platform are you running AnyProxy

Tested on MacOS High Sierra and CentOS 7

The version of the AnyProxy

4.1.2

pedrogaldino avatar Mar 24 '20 17:03 pedrogaldino

@pedrogaldino I'm seeing this issue also. Did you find a solution to this?

Edit: I switched back to Node 14 and it stopped happening (might not have been caused by AnyProxy). If it occurs again I will update with more data.

Stormtv avatar Jun 02 '21 02:06 Stormtv

I have the same problem on CentOS 7

laissonsilveira avatar Aug 03 '21 18:08 laissonsilveira