{"record":{"id":"2b6f63f0eba815b0","repo":"astrid-runtime/astrid","slug":"fuse-service-control-endpoint-is-already-present","errorCode":null,"errorMessage":"FUSE service control endpoint is already present","messagePattern":"FUSE service control endpoint is already present","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-storage-provider-fuse/src/service.rs","lineNumber":292,"sourceCode":"            .components()\n            .any(|component| matches!(component, std::path::Component::ParentDir))\n    {\n        bail!(\"FUSE service control path is malformed\");\n    }\n    if control_path != resource_path.join(\"process-control.sock\") {\n        bail!(\"FUSE service control path is not the kernel endpoint\");\n    }\n    let parent = control_path\n        .parent()\n        .context(\"FUSE service control path has no parent\")?;\n    platform_fs::validate_private_directory(parent)\n        .context(\"validate private FUSE control parent\")?;\n    platform_fs::verify_no_redirects(control_path)\n        .context(\"reject redirected FUSE control path\")?;\n    if local_transport::endpoint_is_present(control_path)\n        .context(\"inspect FUSE service control endpoint\")?\n    {\n        bail!(\"FUSE service control endpoint is already present\");\n    }\n    Ok(())\n}\n\nasync fn probe_callback(launch: &StorageProviderServiceLaunchV1) -> Result<()> {\n    let mut stream = local_transport::connect(&launch.lease.callback_path)\n        .await\n        .context(\"connect FUSE lease callback\")?;\n    let request = StorageFilesystemRequestV2 {\n        protocol_version: STORAGE_FILESYSTEM_PROTOCOL_V2,\n        request_id: format!(\"fuse-service-{}\", Uuid::new_v4()),\n        lease_token: launch.lease.lease_token.clone(),\n        operation: StorageFilesystemOperationV2::Stat {\n            path: String::new(),\n        },\n    };\n    let bytes = serde_json::to_vec(&request).context(\"encode FUSE callback probe\")?;\n    let length = u32::try_from(bytes.len()).context(\"FUSE callback probe is too large\")?;","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-storage-provider-fuse/src/service.rs#L274-L310","documentation":"validate_control_path finishes by checking, via local_transport::endpoint_is_present, that no control endpoint (Unix socket) already exists at the control path. A pre-existing endpoint means another service instance owns or leaked the socket, so a new launch would either fail to bind or hijack the peer's channel.","triggerScenarios":"Calling validate_launch when a socket file already exists and is live at <resource_path>/process-control.sock — i.e. another FUSE service is running or a stale socket file was left behind.","commonSituations":"Double-starting the service (systemd restart overlapping, two supervisor processes); a crashed prior instance leaving the socket file on disk; reusing the same resource_path/launch directory for multiple concurrent launches.","solutions":["Stop the already-running service instance that owns the socket, or wait for it to exit, before launching","Remove the stale socket file (it is inside resource_path, deleted with the lease directory) if no process is listening","Use a unique resource_path per launch so endpoints never collide","Add supervisor logic that cleans the lease directory after abnormal termination"],"exampleFix":"# before: stale socket from crashed instance\n$ ss -x | grep process-control   # confirm no listener\n$ rm /run/astrid/leases/<id>/process-control.sock\n# then relaunch","handlingStrategy":"validation","validationCode":"if std::path::Path::new(control_path).exists() {\n    // confirm no live listener, then remove stale socket before launching\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Stop prior instances before relaunching the same resource","Clean lease directories after crashes","Use one resource_path per concurrent launch"],"tags":["fuse","unix-socket","already-exists","stale-state"],"backgroundTag":"file-already-exists","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"}