Skip to content

fix: handle dead VMM and scan all urunc TAP devices during cleanup#476

Merged
cmainas merged 1 commit intourunc-dev:main-pr476from
goyalpalak18:fix/network-leak-cleanup
Mar 10, 2026
Merged

fix: handle dead VMM and scan all urunc TAP devices during cleanup#476
cmainas merged 1 commit intourunc-dev:main-pr476from
goyalpalak18:fix/network-leak-cleanup

Conversation

@goyalpalak18
Copy link
Contributor

Description

Fixed the issue where vmm.Stop() was returning an error if the process was already dead (like from a crash), which prevented network cleanup from running.

I updated killProcess in utils.go to treat ESRCH (process not found) as a success. If it's gone, it's gone, so we can proceed.

Also refactored network.Cleanup to actually scan for any tap.*_urunc interfaces instead of looking for a hardcoded string. This handles leftover devices much better.

Huge thanks to @sidneychang for the scanning logic in #407 — I integrated that here.

Related issues

Fixes #408
Integrates #407

How was this tested?

  • make lint passes.
  • Verified that killing the VMM process manually now properly triggers the network cleanup instead of failing.

@netlify
Copy link

netlify bot commented Feb 12, 2026

Deploy Preview for urunc canceled.

Name Link
🔨 Latest commit 30e590f
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/69b026b42576c30008a934b5

Copy link
Contributor

@cmainas cmainas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @goyalpalak18 ,

the changes look good. I have only left two small comments. Do not forget to fix the linting issues and rebase over main.

@goyalpalak18 goyalpalak18 force-pushed the fix/network-leak-cleanup branch from cce0f5c to cfeaadb Compare February 17, 2026 16:25
@goyalpalak18
Copy link
Contributor Author

Thanks @cmainas ! Just pushed these updates and rebased over main. Let me know if everything looks good now.

Copy link
Contributor

@cmainas cmainas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @goyalpalak18 for the changes. One thing I noticed is that if something fails during a cleanup of a single device then the function returns ignoring the rest. So it would be better to log the error but not return immediately but later at the end of the loop. Also, please rebase over main, so we can merge.

@goyalpalak18
Copy link
Contributor Author

goyalpalak18 commented Mar 7, 2026

@cmainas
Fixed. It now logs and collects cleanup errors rather than returning early, so all devices get processed. Rebased on main too.

@cmainas
Copy link
Contributor

cmainas commented Mar 9, 2026

Hello @goyalpalak18 , it seems you have not signed your commits. Also, make sure to rebase and squash your commits so we can merge this PR.

@goyalpalak18 goyalpalak18 force-pushed the fix/network-leak-cleanup branch from a256fcb to 927cada Compare March 9, 2026 18:44
@goyalpalak18
Copy link
Contributor Author

Hey @cmainas , done! Squashed the commits into one, added the sign-off, and rebased on top of main. Let me know if anything else needs to be changed.

@cmainas
Copy link
Contributor

cmainas commented Mar 10, 2026

Hello @goyalpalak18 , the commit linter is complaining about ESRCH. You can either remove the word or add it here https://github.com/urunc-dev/urunc/blob/main/.github/linters/urunc-dict.txt

@goyalpalak18 goyalpalak18 force-pushed the fix/network-leak-cleanup branch from 927cada to c27eb2c Compare March 10, 2026 14:08
@goyalpalak18
Copy link
Contributor Author

@cmainas Done! Added ESRCH to the dictionary file.

Treat ESRCH from killProcess as success since the process is already
gone, allowing network cleanup to proceed instead of failing silently.

Refactored network.Cleanup to scan for all tap.*_urunc interfaces
rather than relying on a hardcoded name. Continue processing remaining
devices on per-device errors and return a joined error at the end.

Fixes urunc-dev#408
Integrates urunc-dev#407

Signed-off-by: goyalpalak18 <goyalpalak1806@gmail.com>
@goyalpalak18 goyalpalak18 force-pushed the fix/network-leak-cleanup branch from c27eb2c to 30e590f Compare March 10, 2026 14:12
@urunc-bot urunc-bot bot changed the base branch from main to main-pr476 March 10, 2026 15:40
Copy link
Contributor

@cmainas cmainas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @goyalpalak18 for this fix.

@cmainas cmainas merged commit 4fbbafa into urunc-dev:main-pr476 Mar 10, 2026
49 of 52 checks passed
github-actions bot pushed a commit that referenced this pull request Mar 10, 2026
Treat ESRCH from killProcess as success since the process is already
gone, allowing network cleanup to proceed instead of failing silently.

Refactored network.Cleanup to scan for all tap.*_urunc interfaces
rather than relying on a hardcoded name. Continue processing remaining
devices on per-device errors and return a joined error at the end.

Fixes #408
Integrates #407

PR: #476
Signed-off-by: goyalpalak18 <goyalpalak1806@gmail.com>
Reviewed-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Approved-by: Charalampos Mainas <cmainas@nubificus.co.uk>
urunc-bot bot pushed a commit that referenced this pull request Mar 10, 2026
Treat ESRCH from killProcess as success since the process is already
gone, allowing network cleanup to proceed instead of failing silently.

Refactored network.Cleanup to scan for all tap.*_urunc interfaces
rather than relying on a hardcoded name. Continue processing remaining
devices on per-device errors and return a joined error at the end.

Fixes #408
Integrates #407

PR: #476
Signed-off-by: goyalpalak18 <goyalpalak1806@gmail.com>
Reviewed-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Approved-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Network cleanup fails when VMM process is already dead

2 participants