feat add mycelium reconnect logic #22

Merged
salmaelsoly merged 8 commits from development_mycelium into development 2026-03-12 07:48:34 +00:00
Member

#5

#5
feat: add initial restart mycelium logic
Some checks failed
Unit and Integration Test / test (push) Failing after 8s
cd8c12e4bb
refactor: add mycelium healthcheck in inspect + adjust auto-restart
All checks were successful
Unit and Integration Test / test (push) Successful in 1m48s
b2e019596c
refactor: remove redudant delay + adjust ip splitting
All checks were successful
Unit and Integration Test / test (push) Successful in 2m10s
85f2ecf9d7
refactor: improve mycelium spawn logic with retry mechanism and enhance health status checks
All checks were successful
Unit and Integration Test / test (push) Successful in 1m44s
ea5b912792
salmaelsoly changed title from WIP: feat add mycelium reconnect logic to feat add mycelium reconnect logic 2026-03-03 08:08:28 +00:00
salmaelsoly changed title from feat add mycelium reconnect logic to WIP: feat add mycelium reconnect logic 2026-03-04 08:52:16 +00:00
salmaelsoly force-pushed development_mycelium from ea5b912792
All checks were successful
Unit and Integration Test / test (push) Successful in 1m44s
to ecf1eca212
Some checks failed
Unit and Integration Test / test (push) Failing after 31s
2026-03-04 09:54:14 +00:00
Compare
refactor: update mycelium spawning and reaping logic to include child process handling
All checks were successful
Unit and Integration Test / test (push) Successful in 2m25s
9329b3e334
salmaelsoly changed title from WIP: feat add mycelium reconnect logic to feat add mycelium reconnect logic 2026-03-04 12:22:04 +00:00
rawan requested changes 2026-03-05 23:47:24 +00:00
Dismissed
@ -4,1 +4,3 @@
pub fn execute(manager: &mut VmManager, args: &InspectArgs) -> anyhow::Result<()> {
pub async fn execute(manager: &mut VmManager, args: &InspectArgs) -> anyhow::Result<()> {
// Run mycelium health check for running VMs before displaying state.
if let Err(e) = manager.check_mycelium_health(&args.container).await {
Member

-- open for discussion

can't we make the health checking an option? --check-health
to avoid having to wait for 10s before seeing any output even if the user's goal of the inspect command wasn't to test mycelium?

-- open for discussion can't we make the health checking an option? `--check-health` to avoid having to wait for 10s before seeing any output even if the user's goal of the inspect command wasn't to test mycelium?
salmaelsoly marked this conversation as resolved
@ -533,0 +569,4 @@
.and_then(|ns| ns.mycelium_ip.as_deref())
.filter(|ip| !ip.is_empty());
let health = match (&probed_ip, known_ip) {
Member

the match can be simplified to

 let health = if probed_ip.is_some() {
            MyceliumHealth::Healthy
        } else {
            tokio::time::timeout(
                health_timeout,
                self.check_mycelium_process(&vsock_path, &state.id),
            )
            .await
            .unwrap_or(MyceliumHealth::Unknown)
        };

as last two cases do the exact same thing, can also collapse them into single (None, _)

the match can be simplified to ``` let health = if probed_ip.is_some() { MyceliumHealth::Healthy } else { tokio::time::timeout( health_timeout, self.check_mycelium_process(&vsock_path, &state.id), ) .await .unwrap_or(MyceliumHealth::Unknown) }; ``` as last two cases do the exact same thing, can also collapse them into single (None, _)
salmaelsoly marked this conversation as resolved
refactor: inspect command
All checks were successful
Unit and Integration Test / test (push) Successful in 1m49s
de932b4966
rawan approved these changes 2026-03-08 21:30:18 +00:00
Dismissed
refactor: enhance zombie reaping logic to include main process exit handling
All checks were successful
Unit and Integration Test / test (push) Successful in 1m52s
f3ed521003
salmaelsoly changed title from feat add mycelium reconnect logic to WIP: feat add mycelium reconnect logic 2026-03-10 11:46:59 +00:00
salmaelsoly changed title from WIP: feat add mycelium reconnect logic to feat add mycelium reconnect logic 2026-03-10 12:46:06 +00:00
rawan requested changes 2026-03-10 22:42:49 +00:00
Dismissed
@ -22,0 +74,4 @@
} else if mycelium_pid == Some(raw_pid) {
eprintln!("[init] Mycelium (PID {raw_pid}) exited, scheduling restart...");
if let Some(mut child) = mycelium_child.take() {
let _ = child.wait();
Member

now this child.wait() internally calls waitpid again for the same PID that was already reaped above, so the kernel returns ECHILD ("no such child").
so we're now doing something that always fails

fix: remove the .wait() call since it serves no purpose. The .take() already removes the Child from the Option, and dropping it is enough to clean up the Rust-side resources

now this `child.wait()` internally calls waitpid again for the same PID that was already reaped above, so the kernel returns `ECHILD` ("no such child"). so we're now doing something that always fails fix: remove the .wait() call since it serves no purpose. The .take() already removes the Child from the Option, and dropping it is enough to clean up the Rust-side resources
salmaelsoly marked this conversation as resolved
refactor: simplify mycelium restart handling by removing unnecessary child wait
All checks were successful
Unit and Integration Test / test (push) Successful in 1m50s
6c4acd1d9b
rawan approved these changes 2026-03-12 00:20:47 +00:00
salmaelsoly merged commit 613d335ea6 into development 2026-03-12 07:48:34 +00:00
Sign in to join this conversation.
No reviewers
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!22
No description provided.