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

accept4: too many open files #31

Open
ncruces opened this issue Jan 25, 2021 · 0 comments
Open

accept4: too many open files #31

ncruces opened this issue Jan 25, 2021 · 0 comments

Comments

@ncruces
Copy link

ncruces commented Jan 25, 2021

Hi, this is not a fault with the project, but it's something I hit while using this (and almost every alternative) and which surprised me, so maybe it'd be nice to add something about it to the documentation?

tcpproxy, correctly, does its best to take advantage of Go using the splice syscall to implement io.Copy between two net.TCPConn. This, however, leads to 6 fds being created for each proxied connection: the 2 net.TCPConn and 4 pipes (one in each direction for the each of the connections). This means you hit the (default?) soft ulimit of 1024 fds per process with just ~170 connections.

The "fix" is to raise the ulimit for the process, either using the syscall package, or systemd's LimitNOFILE directive.

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

1 participant