{"record":{"id":"a9f06fbe4e28db11","repo":"openai/codex","slug":"failed-to-read-synthetic-bubblewrap-mount-marker-i","errorCode":null,"errorMessage":"failed to read synthetic bubblewrap mount marker in {}: {err}","messagePattern":"failed to read synthetic bubblewrap mount marker in (.+?): (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/linux-sandbox/src/linux_run_main.rs","lineNumber":1064,"sourceCode":"fn synthetic_mount_marker_dir_has_active_process(marker_dir: &Path) -> bool {\n    synthetic_mount_marker_dir_has_active_process_matching(marker_dir, |_| true)\n}\n\nfn synthetic_mount_marker_dir_has_active_process_matching(\n    marker_dir: &Path,\n    matches_marker: impl Fn(&Path) -> bool,\n) -> bool {\n    let entries = match fs::read_dir(marker_dir) {\n        Ok(entries) => entries,\n        Err(err) if err.kind() == std::io::ErrorKind::NotFound => return false,\n        Err(err) => panic!(\n            \"failed to read synthetic bubblewrap mount marker directory {}: {err}\",\n            marker_dir.display()\n        ),\n    };\n    for entry in entries {\n        let entry = entry.unwrap_or_else(|err| {\n            panic!(\n                \"failed to read synthetic bubblewrap mount marker in {}: {err}\",\n                marker_dir.display()\n            )\n        });\n        let path = entry.path();\n        let Some(pid) = path\n            .file_name()\n            .and_then(|name| name.to_str())\n            .and_then(|name| name.parse::<libc::pid_t>().ok())\n        else {\n            continue;\n        };\n        if !process_is_active(pid) {\n            match fs::remove_file(&path) {\n                Ok(()) => {}\n                Err(err) if err.kind() == std::io::ErrorKind::NotFound => {}\n                Err(err) => panic!(\n                    \"failed to remove stale synthetic bubblewrap mount marker {}: {err}\",","sourceCodeStart":1046,"sourceCodeEnd":1082,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/linux-sandbox/src/linux_run_main.rs#L1046-L1082","documentation":"While iterating read_dir results in synthetic_mount_marker_dir_has_active_process_matching, every DirEntry resolution error panics. On Linux, entries disappearing mid-iteration does not produce an error, so this indicates real getdents-time trouble: kernel I/O or ENOMEM under pressure, or an external process mutating the directory while ignoring the flock that serializes registry access.","triggerScenarios":"Registering or cleaning up synthetic or protected targets while an external writer (cleanup script, monitoring tool) mutates the marker dir without the registry lock, or while the storage layer reports enumeration errors.","commonSituations":"Homegrown cron jobs cleaning /tmp racing active sessions; monitoring agents touching the dir; failing tmpfs or disk; memory pressure surfacing as ENOMEM.","solutions":["Stop external scripts and tools from mutating the registry while sessions run.","Check dmesg for I/O errors and OOM events.","With all codex processes stopped, clear the registry root and retry.","If it recurs with no external writers, capture strace -e getdents64 output and report upstream."],"exampleFix":"# before: cron races the launcher inside the registry\n*/5 * * * * find /tmp/codex-bwrap-synthetic-mount-targets-* -delete\n\n# after: never mutate the registry externally; remove it only when nothing runs\n# rm -rf /tmp/codex-bwrap-synthetic-mount-targets-$(id -u)  # sessions stopped","handlingStrategy":"retry","validationCode":"fn registry_enumerates_cleanly() -> bool {\n    let root = std::env::temp_dir().join(format!(\n        \"codex-bwrap-synthetic-mount-targets-{}\",\n        unsafe { libc::geteuid() }\n    ));\n    std::fs::read_dir(&root)\n        .map(|entries| entries.all(|e| e.is_ok()))\n        .unwrap_or(true)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the registry root exclusively managed by the sandbox launcher; no external writers.","Retry the sandboxed command once; transient enumeration errors usually clear.","Investigate storage health (dmesg, SMART) if the panic repeats across fresh registries."],"tags":["sandbox","registry","read-dir","io-error","race","bubblewrap"],"backgroundTag":"directory-read-io-error","analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}