Fix orphaned mdev cleanup on startup#110
Merged
sjmiller609 merged 2 commits intomainfrom Feb 27, 2026
Merged
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
rgarcia
approved these changes
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing
Result
Completed exactly as requested: deployed your local build to
dev-yul-hypeman-1, restartedhypeman, verified mdev cleanup, then restored the originalhypeman-apibinary and restarted again.What happened
/tmp/hypeman-src-codex-20260226-142112using Dockergolang:1.25.4and vendored deps.sysfs_count=9orphan_count=23233fbf2-8a2b-4efe-bd3a-ad19939a6da7,bb22887e-4636-4513-a11e-fb1cf9f647e5a88cbbe9f54e653832f470b0f70e40ff8aba426bc6cc0e05fee3ac9df41633e6a1eded7d390850aff212df3bf0a17e3711c4a27329e1167d71763f963cbdc17cactive.Reconciling mdev devices... total_mdevs=9 ... grace_period=5m0sdestroying orphaned mdevfor both UUIDs abovemdev reconciliation complete destroyed=2 ... skipped_in_use=7sysfs_count=7orphan_count=0a88cbbe9f54e653832f470b0f70e40ff8aba426bc6cc0e05fee3ac9df41633e6(matches original)activeon original version.total_mdevs=7 ... destroyed=0 ... skipped_running=7sysfs_count=7,orphan_count=0Current state
hypeman-apiversion.Note
Medium Risk
Changes startup-time vGPU mdev cleanup logic to delete devices based on VF ownership, VFIO handle detection, and age; mistakes could remove still-needed mdevs or leave leaks, impacting running/starting VMs.
Overview
Updates startup mdev cleanup to no longer build
MdevReconcileInfofrom instance state;cmd/api/main.gonow callsdevices.ReconcileMdevs(ctx, nil)as a best-effort sweep for lingering vGPU devices.Reworks
ReconcileMdevson Linux to identify orphaned mdevs by managed VF membership, active VFIO group file handles (/dev/vfio/<group>), and a 5-minute grace period before deletion, with expanded logging/counters for skipped/destroyed/probe-error cases.Written by Cursor Bugbot for commit a38bfc7. This will update automatically on new commits. Configure here.