-
Notifications
You must be signed in to change notification settings - Fork 52
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
Memory leaks #107
Comments
|
|
Is the connection tracker protocol aware? It is common, for example, that UDP syslog messages are sent at a constant high velocity. If the code is waiting for responses (that don't happen with syslog), it will create new go routines at a faster rate than the one old ones can time out. |
@codomania it looks good, thanks! @dimalinux I took the same code as dockerd, I bet it is ok. You can take a look at the code: https://github.com/containers/gvisor-tap-vsock/blob/main/pkg/services/forwarder/udp_proxy.go (taken from https://github.com/moby/moby/blob/master/cmd/docker-proxy/udp_proxy.go) |
This fix appears to be working and takes the VM from several gigabytes of memory to less than 20mb. Is there anything that prevents this fix from being applied so that people don't have to patch the source manually? |
Decrement reference count after queueing the PacketBuffer. Since PacketBuffer objects come from a pool, this allows them to be returned to the pool instead of staying in memory and forcing new allocations. Fixes containers#107
Decrement reference count after queueing the PacketBuffer. Since PacketBuffer objects come from a pool, this allows them to be returned to the pool instead of staying in memory and forcing new allocations. Fixes containers#107 Signed-off-by: stevenmhood <[email protected]>
I just had to kill off gvproxy, it was consuming 30GB of ram on my M1 mac |
Decrement reference count after queueing the PacketBuffer. Since PacketBuffer objects come from a pool, this allows them to be returned to the pool instead of staying in memory and forcing new allocations. Fixes #107 Signed-off-by: stevenmhood <[email protected]>
@sc68cal me too it consumes 38GB of RAM on my M1 ultra on real memory and memory around 50GB |
I think the memory leak still exists |
@gam-phon can you open a new issue with more details about your usage of gvisor-tap-vsock? |
Hi,
I noticed a serious memory leak while using the gvisor-tap-vsock latest master. My host ran out of memory after 2 min of iperf runs. I used the pprof to root cause the leak source and found two issues:
Steps to reproduce
On Host:
iperf3-s
On VM:
while
true
; do iperf3 -c 192.168.127.254 -t 1 -u; doneOpen the pprof window and see the number of go routines. It keeps growing.
Steps to reproduce
On Host:
iperf3-s
On VM: iperf3 -c 192.168.127.254 -t 180
On another host terminal run "htop" and monitor the memory usage.
The output from pprof indicate that leak is coming from the
https://github.com/containers/gvisor-tap-vsock/blob/main/pkg/tap/switch.go#L264.
Stat from profile:
File: gvproxy
Type: inuse_space
Time: Mar 2, 2022 at 8:44pm (CST)
Entering interactive mode (type "help" for commands, "o" for options)
(pprof) top
Showing nodes accounting for 459.35MB, 99.65% of 460.94MB total
Dropped 15 nodes (cum <= 2.30MB)
Showing top 10 nodes out of 38
flat flat% sum% cum cum%
299.94MB 65.07% 65.07% 409.03MB 88.74% github.com/containers/gvisor-tap-vsock/pkg/tap.(*Switch).rxStream
152.13MB 33.00% 98.07% 152.13MB 33.00% gvisor.dev/gvisor/pkg/tcpip/stack.glob..func1
4.78MB 1.04% 99.11% 4.78MB 1.04% gvisor.dev/gvisor/pkg/refsvfs2.Register
2.50MB 0.54% 99.65% 2.50MB 0.54% runtime.allocm
0 0% 99.65% 409.03MB 88.74% github.com/containers/gvisor-tap-vsock/pkg/tap.(*Switch).Accept
0 0% 99.65% 409.03MB 88.74% github.com/containers/gvisor-tap-vsock/pkg/tap.(*Switch).rx
0 0% 99.65% 109.09MB 23.67% github.com/containers/gvisor-tap-vsock/pkg/tap.(*Switch).rxBuf
0 0% 99.65% 409.03MB 88.74% github.com/containers/gvisor-tap-vsock/pkg/virtualnetwork.(*VirtualNetwork).Mux.func4
0 0% 99.65% 5MB 1.09% github.com/google/tcpproxy.proxyCopy
0 0% 99.65% 5MB 1.09% gvisor.dev/gvisor/pkg/tcpip/adapters/gonet.(*TCPConn).Read
Any idea how to fix the leak. I have not looked at the gvisor in deep to figure out yet, any pointers are appreciated.
The text was updated successfully, but these errors were encountered: