[ENHANCEMENT] Resource Cleanup on Panic/Crash #11

Closed
opened 2026-02-11 19:23:43 +00:00 by thabeta · 1 comment
Owner

Description

Network interfaces and IPTables rules remain on the host if the process crashes.

Proposed Fix

Implement a signal handler or a garbage collection routine in chvm doctor.

### Description Network interfaces and IPTables rules remain on the host if the process crashes. ### Proposed Fix Implement a signal handler or a garbage collection routine in `chvm doctor`.
rawan self-assigned this 2026-03-05 10:37:05 +00:00
Member

implemented in #26

Change 1: Auto-cleanup in refresh_status()

Added teardown_network + cleanup_storage() to refresh_status() when a dead VM process is detected
Previously it only marked the VM as Stopped — now it cleans up network interfaces and storage before updating state

Change 2: chvm doctor --gc

Added --gc flag to the doctor command for manual garbage collection
Level 1 (state-aware): Uses refresh_status() to detect crashed VMs and clean their resources
Level 2 (stateless orphan detection): Scans for tap-* interfaces not belonging to any running VM and removes them. Scans iptables nat rules referencing chvm-subnet IPs (192.168.200.X) not owned by a running VM and removes them

implemented in https://forge.ourworld.tf/geomind_code/my_hypervisor/pulls/26 ## Change 1: Auto-cleanup in refresh_status() Added teardown_network + cleanup_storage() to refresh_status() when a dead VM process is detected Previously it only marked the VM as Stopped — now it cleans up network interfaces and storage before updating state ## Change 2: chvm doctor --gc Added --gc flag to the doctor command for manual garbage collection Level 1 (state-aware): Uses refresh_status() to detect crashed VMs and clean their resources Level 2 (stateless orphan detection): Scans for tap-* interfaces not belonging to any running VM and removes them. Scans iptables nat rules referencing chvm-subnet IPs (192.168.200.X) not owned by a running VM and removes them
rawan closed this issue 2026-03-10 21:41:33 +00:00
thabeta added this to the ACTIVE project 2026-03-12 10:53:31 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
geomind_code/my_hypervisor#11
No description provided.