-
Notifications
You must be signed in to change notification settings - Fork 49
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
[BUG] vsock: Mem leak caused by circular referencing #438
Comments
Or what about in @cutelizebin do you want to work on it? |
yes,I'll send a fix later on. |
This is also causing an issue after we merged commit 38caab2 When the VM reboot or shutdown, we have this error, instead of looping waiting for a new VM
This happens because we have these cyclic references and |
@cutelizebin do you have time to work on it? Otherwise, I can take a look ;-) |
We have the following circular references found by Li Zebin: VhostUserBackend ==> VhostUserVsockThread ==> VringEpollHandler In addition to causing a resource leak, this causes also an error after we merged commit 38caab2 ("vsock: Don't allow duplicate CIDs"). When the VM reboot or shutdown, the application exits with the following error: [ERROR vhost_device_vsock] Could not create backend: CID already in use by another vsock device This happened because we have these circular references and VhostUserVsockThread::drop() is never invoked. So, we don't remove the cid from the map. Let's fix this problem by simply removing the reference to VringEpollHandler from VhostUserVsockThread. In fact, we do not need to keep the reference for the lifetime of VhostUserVsockThread, as we only need to add the handlers once. Let's also rename the fields to follow the current VhostUserDaemon API. Closes rust-vmm#438 Reported-by: Li Zebin <cutelizebin@gmail.com> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
@cutelizebin was easier than expected, we don't need to keep the Thanks for reporting this! |
We have the following circular references found by Li Zebin: VhostUserBackend ==> VhostUserVsockThread ==> VringEpollHandler In addition to causing a resource leak, this causes also an error after we merged commit 38caab2 ("vsock: Don't allow duplicate CIDs"). When the VM reboot or shutdown, the application exits with the following error: [ERROR vhost_device_vsock] Could not create backend: CID already in use by another vsock device This happened because we have these circular references and VhostUserVsockThread::drop() is never invoked. So, we don't remove the cid from the map. Let's fix this problem by simply removing the reference to VringEpollHandler from VhostUserVsockThread. In fact, we do not need to keep the reference for the lifetime of VhostUserVsockThread, as we only need to add the handlers once. Let's also rename the fields to follow the current VhostUserDaemon API. Closes rust-vmm#438 Reported-by: Li Zebin <cutelizebin@gmail.com> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
We have the following circular references found by Li Zebin: VhostUserBackend ==> VhostUserVsockThread ==> VringEpollHandler In addition to causing a resource leak, this causes also an error after we merged commit 38caab2 ("vsock: Don't allow duplicate CIDs"). When the VM reboot or shutdown, the application exits with the following error: [ERROR vhost_device_vsock] Could not create backend: CID already in use by another vsock device This happened because we have these circular references and VhostUserVsockThread::drop() is never invoked. So, we don't remove the cid from the map. Let's fix this problem by simply removing the reference to VringEpollHandler from VhostUserVsockThread. In fact, we do not need to keep the reference for the lifetime of VhostUserVsockThread, as we only need to add the handlers once. Let's also rename the fields to follow the current VhostUserDaemon API. Closes #438 Reported-by: Li Zebin <cutelizebin@gmail.com> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
There might be a memory leak bug caused by circular referencing.
There three struct refers to each other using Arc , but no single line is using Weak, which make it a circle.
And all these three struct cannot be dropped properly.
Reproduction Process:
Advice
Maybe we can use
Weak<VhostUserBackend>
in VringEpollHandler.The text was updated successfully, but these errors were encountered: