{"record":{"id":"e4aba013fa39cf5c","repo":"containerd/containerd","slug":"failed-to-open-stdin-fifo-w","errorCode":null,"errorMessage":"failed to open stdin fifo: %w","messagePattern":"failed to open stdin fifo: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cio/io_unix.go","lineNumber":118,"sourceCode":"\t\t\tfor _, c := range pipes.closers() {\n\t\t\t\tif c != nil {\n\t\t\t\t\tc.Close()\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}, nil\n}\n\nfunc openFifos(ctx context.Context, fifos *FIFOSet) (f pipes, retErr error) {\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tfifos.Close()\n\t\t}\n\t}()\n\n\tif fifos.Stdin != \"\" {\n\t\tif f.Stdin, retErr = fifo.OpenFifo(ctx, fifos.Stdin, syscall.O_WRONLY|syscall.O_CREAT|syscall.O_NONBLOCK, 0700); retErr != nil {\n\t\t\treturn f, fmt.Errorf(\"failed to open stdin fifo: %w\", retErr)\n\t\t}\n\t\tdefer func() {\n\t\t\tif retErr != nil && f.Stdin != nil {\n\t\t\t\tf.Stdin.Close()\n\t\t\t}\n\t\t}()\n\t}\n\tif fifos.Stdout != \"\" {\n\t\tif f.Stdout, retErr = fifo.OpenFifo(ctx, fifos.Stdout, syscall.O_RDONLY|syscall.O_CREAT|syscall.O_NONBLOCK, 0700); retErr != nil {\n\t\t\treturn f, fmt.Errorf(\"failed to open stdout fifo: %w\", retErr)\n\t\t}\n\t\tdefer func() {\n\t\t\tif retErr != nil && f.Stdout != nil {\n\t\t\t\tf.Stdout.Close()\n\t\t\t}\n\t\t}()\n\t}\n\tif !fifos.Terminal && fifos.Stderr != \"\" {","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/containerd/containerd/blob/4246446a2bf7d03837b0244118d858799393bd80/pkg/cio/io_unix.go#L100-L136","documentation":"openFifos opens the container's stdio FIFOs so IO can be copied between the shim and the client. This error wraps fifo.OpenFifo failing for the stdin fifo, which is opened write-only, non-blocking, with create. When it fails, no IO setup is usable and the error propagates out of NewDirectIO/copyIO, aborting task IO setup.","triggerScenarios":"Creating a direct-IO task (NewDirectIO / WithFIFOs) where opening fifos.Stdin with syscall.O_WRONLY|O_CREAT|O_NONBLOCK fails — path doesn't exist and can't be created, the parent directory is missing or not writable, too many open fds, or a fifo path pointing at an existing non-fifo file (ENXIO/EEXIST mismatch).","commonSituations":"FIFO directory deleted between container create and start; bundle path on a read-only or full filesystem; fd exhaustion under high container density; leftover stale fifo files from a previous crashed run.","solutions":["Verify the fifo directory (bundle root) exists, is writable, and is on a filesystem supporting named pipes.","Remove stale leftover fifo files at the configured paths and retry the task creation.","Check ulimit -n / fd leaks if this appears under load.","Inspect the unwrapped errno (ENOENT, EACCES, ENOSPC, EMFILE) and address the specific resource condition."],"exampleFix":"// before\n// /run/containerd/io.containerd.../fifos dir was removed by a cleanup script\n// after\nos.MkdirAll(fifoDir, 0o711) // ensure fifo dir exists before NewDirectIO\nf, err := cio.NewFIFOSetInDir(fifoDir, id, false)","handlingStrategy":"try-catch","validationCode":"// Go: verify fifo paths are usable before opening IO\nfor _, p := range []string{fifos.Stdin, fifos.Stdout, fifos.Stderr} {\n    if p == \"\" { continue }\n    if info, err := os.Stat(p); err == nil && info.Mode()&os.ModeNamedPipe == 0 {\n        return fmt.Errorf(\"%s exists but is not a fifo\", p)\n    }\n}\nif err := unix.Access(filepath.Dir(fifos.Stdin), unix.W_OK); err != nil {\n    return fmt.Errorf(\"fifo dir not writable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"f, err := cio.NewDirectIO(ctx, fifos)\nif err != nil {\n    if errors.Is(err, syscall.EMFILE) { return errors.New(\"fd limit reached; raise ulimit -n\") }\n    if errors.Is(err, syscall.ENOENT) { return errors.New(\"fifo dir missing; recreate bundle\") }\n    return fmt.Errorf(\"io setup failed: %w\", err)\n}\ndefer f.Close()","preventionTips":["Keep the containerd IO fifo directory intact; exclude it from cleanup scripts","Raise RLIMIT_NOFILE in high container-density environments","Clean up stale fifos from crashed runs before recreating tasks with the same ID"],"tags":["containerd","cio","fifos","linux"],"backgroundTag":"fifo-open-failed","analyzedSha":"4246446a2bf7d03837b0244118d858799393bd80","analyzedAt":"2026-09-02T00:14:43.053Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}