{"record":{"id":"c1fff2d86d377271","repo":"astrid-runtime/astrid","slug":"winfsp-daemon-did-not-report-readiness-within-30-s","errorCode":null,"errorMessage":"WinFsp daemon did not report readiness within 30 seconds","messagePattern":"WinFsp daemon did not report readiness within 30 seconds","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-storage-provider-winfsp/src/win.rs","lineNumber":596,"sourceCode":"            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}\n\nfn native_mountpoint(mountpoint: &Path) -> Result<PathBuf> {\n    let text = mountpoint\n        .to_str()\n        .context(\"WinFsp mountpoint is not valid Unicode\")?;\n    let bytes = text.as_bytes();\n    if bytes.len() == 3\n        && bytes[0].is_ascii_alphabetic()\n        && bytes[1] == b':'\n        && matches!(bytes[2], b'\\\\' | b'/')\n    {\n        // FspFileSystemSetMountPoint accepts drive designators (`X:`), not\n        // drive-root paths (`X:\\\\`). Keep the latter in the public lifecycle\n        // record while passing the native spelling to WinFsp.\n        return Ok(PathBuf::from(&text[..2]));","sourceCodeStart":578,"sourceCodeEnd":614,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-storage-provider-winfsp/src/win.rs#L578-L614","documentation":"spawn_daemon wraps the readiness handshake in tokio::time::timeout(DAEMON_READY_TIMEOUT) of 30 seconds. If the daemon never prints a valid READY line within that window, it is killed and this error is raised, preventing indefinite hangs on a wedged daemon.","triggerScenarios":"The spawned daemon produces no READY line within 30s: it blocks on driver loading, waits on a missing dependency, deadlocks during init, or stdout is not flushed.","commonSituations":"Slow WinFsp driver installation first-run; daemon blocked on a prompt or network call at startup; stdout buffering so READY exists but is never flushed; the wrong executable launched (e.g. a shell script that waits for input).","solutions":["Check the daemon's stderr/log output during the 30s window to find where startup blocks.","Fix stdout flushing in the daemon (use println! + flush or LineWriter) so READY is emitted promptly.","Pre-install/warm the WinFsp driver so first-start initialization fits the timeout.","Verify the launched command and arguments are correct and the binary doesn't wait on stdin."],"exampleFix":"// before (daemon)\nwrite!(stdout, \"READY {}\", mount_id)?; // buffered, never flushed\n// after\nlet mut stdout = io::stdout();\nwriteln!(stdout, \"READY {}\", mount_id)?;\nstdout.flush()?;","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match spawn_daemon(&lease, &launch).await {\n    Err(e) if e.to_string().contains(\"did not report readiness within 30 seconds\") => {\n        // daemon was killed; inspect its stderr log, then retry after fixing startup stall\n        Err(e)\n    },\n    other => other,\n}","preventionTips":["Flush stdout immediately after writing the READY line.","Pre-warm/install the WinFsp driver before launch to avoid slow first init.","Ensure the daemon never blocks on stdin or interactive prompts at startup.","Alert on startup duration; if init legitimately exceeds 30s, negotiate a longer timeout upstream."],"tags":["timeout","startup","process"],"backgroundTag":"request-timeout","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}