{"record":{"id":"a5e156cc3941c7c9","repo":"firecracker-microvm/firecracker","slug":"cannot-create-api-eventfd","errorCode":null,"errorMessage":"Cannot create API Eventfd.","messagePattern":"Cannot create API Eventfd\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/firecracker/src/api_server_adapter.rs","lineNumber":168,"sourceCode":"}\n\n#[allow(clippy::too_many_arguments)]\npub(crate) fn run_with_api(\n    seccomp_filters: &mut BpfThreadMap,\n    config_json: Option<String>,\n    bind_path: PathBuf,\n    instance_info: InstanceInfo,\n    process_time_reporter: ProcessTimeReporter,\n    boot_timer_enabled: bool,\n    pci_enabled: bool,\n    api_payload_limit: usize,\n    mmds_size_limit: usize,\n    metadata_json: Option<&str>,\n) -> Result<(), ApiServerError> {\n    // FD to notify of API events. This is a blocking eventfd by design.\n    // It is used in the config/pre-boot loop which is a simple blocking loop\n    // which only consumes API events.\n    let api_event_fd = EventFd::new(libc::EFD_SEMAPHORE).expect(\"Cannot create API Eventfd.\");\n    // FD used to signal API thread to stop/shutdown.\n    let api_kill_switch = EventFd::new(libc::EFD_NONBLOCK).expect(\"Cannot create API kill switch.\");\n\n    // Channels for both directions between Vmm and Api threads.\n    let (to_vmm, from_api) = channel();\n    let (to_api, from_vmm) = channel();\n\n    let to_vmm_event_fd = api_event_fd\n        .try_clone()\n        .expect(\"Failed to clone API event FD\");\n    let api_seccomp_filter = seccomp_filters\n        .remove(\"api\")\n        .expect(\"Missing seccomp filter for API thread.\");\n\n    let mut server = match HttpServer::new(&bind_path) {\n        Ok(s) => s,\n        Err(ServerError::IOError(inner)) if inner.kind() == std::io::ErrorKind::AddrInUse => {\n            let sock_path = bind_path.display().to_string();","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/firecracker-microvm/firecracker/blob/0a745def42ddf4cc2a744d79a08a27ff50b5d27a/src/firecracker/src/api_server_adapter.rs#L150-L186","documentation":"Error \"Cannot create API Eventfd.\" thrown in firecracker-microvm/firecracker.","triggerScenarios":"Thrown at src/firecracker/src/api_server_adapter.rs:168 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the process file-descriptor limit; eventfd creation fails when the fd table is exhausted.","Verify the kernel supports eventfd2 and the call is not blocked by seccomp."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0a745def42ddf4cc2a744d79a08a27ff50b5d27a","analyzedAt":"2026-08-19T05:27:02.517Z","contentChangedAt":"2026-08-19T05:27:02.517Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}