ProxymanApp / Proxyman

Modern. Native. Delightful Web Debugging Proxy for macOS, iOS, and Android ⚑️
https://proxyman.io
5.53k stars 183 forks source link

Memory leak #1330

Open johnrogers opened 2 years ago

johnrogers commented 2 years ago

Proxyman version? (Ex. Proxyman 1.4.3)

3.8.0

macOS Version? (Ex. mac 10.14)

12.5

Steps to reproduce

Keep the app running for a while

Expected behavior

The app doesn't chew up all of my memory

Screenshots (optional)

image
NghiaTranUIT commented 2 years ago

Thanks. It's a known issue. Just wondering: Do you use * or Google Chrome/Safari on Tool menu -> SSL Proxying List πŸ€”

Ref: https://docs.proxyman.io/troubleshooting/proxyman-consumes-too-much-ram-and-unresponsive

matt-wood23 commented 1 year ago

Is there any update on this issue? Seems to also occur when attempting to save captured sessions:

image

NghiaTranUIT commented 1 year ago

Thanks. I'm working on the Export Session v2 to make sure it uses less memory πŸ‘

NghiaTranUIT commented 1 year ago

@johnrogers if you don't mind, you can try this Beta build: https://github.com/ProxymanApp/Proxyman/issues/1111#issuecomment-1371882258

christos commented 1 year ago

Similar issue here. I am on Version 4.0.0 (40000)

I am using Proxyman to proxy an iOS simulator with a React Native app to my local web server.

I've spotted a pattern. When the app hits the React server running locally via websockets ws://localhost:9090/ to load the code bundles, I see around 1K request per GB of memory used. See video.

Doesn't seem to happen with regular HTTP proxying, as far as I can tell. And the websocket response is tiny. It is just an upgrade response.

https://user-images.githubusercontent.com/736/212537123-86fb6726-e5ae-48c4-97ca-9b1b7ccb8d5b.mp4

ScreenShot 2023-01-15 at 12 08 56@2x

NghiaTranUIT commented 1 year ago

Port 9090 is listening by Proxyman.

I'm not sure why you want to connect to locahost:9090, which is what Proxyman is listening πŸ€”

If you'd like to capture the WS traffic, you should connect to your WS server, e.g localhost:3000 (if you have a WS server at port 3000). If you use Google Chrome, it automatically proxies to Proxyman at port 9090.

The issue you reports is a loop issue. I'm going to fix it now πŸ‘

christos commented 1 year ago

Port 9090 is listening by Proxyman.

OK. Then this is weird then. The source of that ws: request seems to be my app running in the iOS simulator as it appears under the Apps section in the sidebar.

I wrongly assumed that the Metro React Native Bundler was the source of those requests. It is not. Metro listens on http://localhost:8081

I'll wait for a build with your loop fix and see if this is what causes the memory leak too.

johnrogers commented 1 year ago

@johnrogers if you don't mind, you can try this Beta build: #1111 (comment)

Apologies for not getting back to you sooner. Are the fixes above included in 4.0.0? I have to that and I will let you know if the issue occurs again. It has not happened recently but I must admit that I haven't had to use Proxyman very frequently as I haven't been working on much networking stuff.

Thanks. It's a known issue. Just wondering: Do you use * or Google Chrome/Safari on Tool menu -> SSL Proxying List πŸ€”

Ref: https://docs.proxyman.io/troubleshooting/proxyman-consumes-too-much-ram-and-unresponsive

No *.

NghiaTranUIT commented 1 year ago

Port 9090 is listening by Proxyman.

OK. Then this is weird then. The source of that ws: request seems to be my app running in the iOS simulator as it appears under the Apps section in the sidebar.

I wrongly assumed that the Metro React Native Bundler was the source of those requests. It is not. Metro listens on http://localhost:8081

I'll wait for a build with your loop fix and see if this is what causes the memory leak too.

Can you show me how to reproduce it? I access http://localhost:9090 on web browser, but it doesn't cause the loop.

I'm not sure how to setup the Metro?

christos commented 1 year ago

Can you show me how to reproduce it? I access http://localhost:9090 on web browser, but it doesn't cause the loop.

I am having a hard time reproducing it in a simplified manner. My setup is quite complex. I can't quite tell who accesses ws://loclahost:9090. It seems as it might be the iOS simulator but in the Proxyman Apps list, the source of that request loop is Proxyman itself.

The trigger for the loop is when the React Native app running in the iOS simulator is reloaded and so asks the Metro bundling server for the javascript files it needs. That in theory should be a simple request to http://localhost:8081 and no websockets involved. I am guessing since the requests to http://localhost:8081 go through the macOS proxy, maybe that is what triggers the loop somehow?

I managed to "fix" the bug by changing the proxy port in Proxyman's settings to 9091 β€”Β The loop no longer happens. I don't understand why either.