{"record":{"id":"b9442639a3c55fb5","repo":"astrid-runtime/astrid","slug":"winfsp-daemon-exited-immediately-after-readiness","errorCode":null,"errorMessage":"WinFsp daemon exited immediately after readiness","messagePattern":"WinFsp daemon exited immediately after readiness","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-storage-provider-winfsp/src/win.rs","lineNumber":581,"sourceCode":"            .context(\"terminate daemon lease\")?;\n        drop(stdin);\n\n        let stdout = child\n            .stdout\n            .take()\n            .context(\"WinFsp daemon stdout is unavailable\")?;\n        let mut stdout = tokio::io::BufReader::new(stdout);\n        let mut ready = String::new();\n        stdout\n            .read_line(&mut ready)\n            .await\n            .context(\"read WinFsp daemon readiness\")?;\n        let expected = format!(\"READY {}\\n\", lease.mount_id);\n        if ready != expected {\n            bail!(\"WinFsp daemon returned invalid readiness: {ready:?}\");\n        }\n        if child.try_wait().context(\"inspect WinFsp daemon\")?.is_some() {\n            bail!(\"WinFsp daemon exited immediately after readiness\");\n        }\n        Result::<()>::Ok(())\n    };\n\n    match tokio::time::timeout(DAEMON_READY_TIMEOUT, success).await {\n        Ok(Ok(())) => Ok(()),\n        Ok(Err(error)) => {\n            let _ = child.kill().await;\n            let _ = child.wait().await;\n            Err(error.context(\"start WinFsp native filesystem\"))\n        },\n        Err(_) => {\n            let _ = child.kill().await;\n            let _ = child.wait().await;\n            bail!(\"WinFsp daemon did not report readiness within 30 seconds\");\n        },\n    }\n}","sourceCodeStart":563,"sourceCodeEnd":599,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-storage-provider-winfsp/src/win.rs#L563-L599","documentation":"Immediately after reading a valid READY line, spawn_daemon calls child.try_wait(); if the daemon has already exited, startup is aborted. This catches daemons that print READY and then crash before serving, which would otherwise leave a half-initialized mount.","triggerScenarios":"The daemon writes \"READY {mount_id}\\n\" to stdout and then exits (panic after handshake, missing WinFsp driver, failed service loop init) before try_wait is polled.","commonSituations":"Missing or broken WinFsp driver installation on the Windows host; the service loop fails to bind its control endpoint after printing READY; daemon killed by a supervisor or OOM; DLL/runtime missing so the process dies right after startup.","solutions":["Run the daemon manually with the same args and read its stderr for the post-READY crash cause.","Install/repair the WinFsp driver and runtime on the host.","Ensure the daemon only prints READY after the control endpoint and service loop are fully initialized.","Check antivirus/EDR or resource limits (OOM) that may be killing the freshly spawned process."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if child.try_wait()?.is_some() { eprintln!(\"daemon died right after READY\"); }","typeGuard":null,"tryCatchPattern":"match spawn_daemon(&lease, &launch).await {\n    Err(e) if e.to_string().contains(\"exited immediately after readiness\") => {\n        // capture daemon stderr/stdout, repair environment (driver/runtime), retry once\n        Err(e)\n    },\n    other => other,\n}","preventionTips":["Verify the WinFsp driver is installed before attempting mounts.","Print READY only after the service loop and control endpoint are bound.","Capture daemon stderr to a log file for post-mortem of post-READY crashes.","Set supervisor limits so the daemon isn't OOM-killed at startup."],"tags":["process-crash","startup","winfsp"],"backgroundTag":"module-init-failed","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}