Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

并发上来之后,会出现too many open files; #11

Closed
water007melon opened this issue Jan 14, 2022 · 9 comments
Closed

并发上来之后,会出现too many open files; #11

water007melon opened this issue Jan 14, 2022 · 9 comments

Comments

@water007melon
Copy link

No description provided.

@lqqyt2423
Copy link
Owner

@water007melon
Copy link
Author

1

@water007melon
Copy link
Author

更新之后效果不佳,打开文件数依然较多。

@lqqyt2423
Copy link
Owner

lqqyt2423 commented Jan 21, 2022

发日志出来

@sayue2019
Copy link

@lqqyt2423 请问下作者,新版本这个问题解决了吗?项目中想用go-mitmproxy替换mitmproxy

@lqqyt2423
Copy link
Owner

我测试下来没啥问题

@sayue2019
Copy link

好的,那我就放心用了,感谢开源

@philipnimble
Copy link

philipnimble commented Mar 30, 2022

hey :)
very cool repo!
Been testing your go-mitmproxy on the latest version with https://github.com/maurice2k/ab-proxy with the following params:
sudo ./ab-proxy --show-errors -c 300 -n 4000 -X http://127.0.0.1:9080 https://9gag.com
first i got indeed "too many files open" error, then I ran

sudo prlimit -n14096 -p PID

the result is the following:


Total initiated requests:     4000
   Completed requests:        4000
      HTTP-200 completed:     3754
      HTTP-501 completed:     246
   Failed requests:           0

and when checking the lsof of my proccess i get 3754 open sockets that won't close lsof_out.txt
I tried to add in helper.go in the transfer function this code

err := clientConn.SetDeadline(time.Now().Add(10 * time.Second))
if err != nil {
    LogErr(log, err)
}
err = serverConn.SetDeadline(time.Now().Add(10 * time.Second))
if err != nil {
    LogErr(log, err)
}

but it also did not help
any ideas?
uname of the machine i'm trying this on :

Linux ip-172-26-12-143 4.19.0-14-cloud-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64 GNU/Linux

@lqqyt2423
Copy link
Owner

@philipnimble
It seems the tcp connection between client (go-mitmproxy) and https endpoint (https://9gag.com) being alive, I guess you can try change client keepalive options in this area.
https://github.com/lqqyt2423/go-mitmproxy/blob/main/proxy/proxy.go#L49
Thanks for the test, I will follow your steps to test it by myself later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants