moby / vpnkit

A toolkit for embedding VPN capabilities in your application
Apache License 2.0
1.1k stars 187 forks source link

vpnkit is using all available Sockets on windows #493

Open TheBlusky opened 4 years ago

TheBlusky commented 4 years ago

It's been months that I have this issue.

When working with Docker on Windows, after some hours of works, I have many connections error. (All with the no buffer space available maximum connections reached error).

Recently, I tried the powershell command Get-NetTCPConnection, and I can see that I got more than 50k Socket opened with vpnkit.exe with a Bound state.

The BOUND state is the state a socket shows after it is created and the 'bind()' call is made, but none of the 'listen()', 'accept()', 'connect()' or 'close()' calls have been made. The confusion is that it is not a TCP state, it is a socket state, but it appears in the field that 'netstat' usually uses for TCP state info.

When killing vpnkit.exe process, everything's back to normal... for a moment, then I have to re-kill vpnkit.exe.

I'm not sure how to exactly pinpoint this issue. Is there anything doable ?

LordReaver commented 2 years ago

I think I'm having the same issue. vpnkit is not opening these sockets on its own but upon requests from the K8S to the outside vpnkit is forwarding these, opening the sockets, but never closes them. At some point the sockets seem to be exhausted, leading to errors on requests. Sad that there is absolutely no attention to this here