{"record":{"id":"263b39ced04dfeec","repo":"kovidgoyal/kitty","slug":"failed-to-flush-shm-file-with-error-w","errorCode":null,"errorMessage":"Failed to flush SHM file with error: %w","messagePattern":"Failed to flush SHM file with error: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/ssh/askpass.go","lineNumber":142,"sourceCode":"\t\t\"is_password\": !is_fingerprint_check,\n\t}\n\tdata, err := json.Marshal(q)\n\tif err != nil {\n\t\treturn fatal(err)\n\t}\n\tdata_shm, err := shm.CreateTemp(\"askpass-*\", uint64(len(data)+32))\n\tif err != nil {\n\t\treturn fatal(fmt.Errorf(\"Failed to create SHM file with error: %w\", err))\n\t}\n\tdefer data_shm.Close()\n\tdefer func() { _ = data_shm.Unlink() }()\n\n\tdata_shm.Slice()[0] = 0\n\tif err = shm.WriteWithSize(data_shm, data, 1); err != nil {\n\t\treturn fatal(fmt.Errorf(\"Failed to write to SHM file with error: %w\", err))\n\t}\n\tif err = data_shm.Flush(); err != nil {\n\t\treturn fatal(fmt.Errorf(\"Failed to flush SHM file with error: %w\", err))\n\t}\n\ttrigger_ask(data_shm.Name())\n\tfor {\n\t\ttime.Sleep(50 * time.Millisecond)\n\t\tif data_shm.Slice()[0] == 1 {\n\t\t\tbreak\n\t\t}\n\t}\n\tdata, err = shm.ReadWithSize(data_shm, 1)\n\tif err != nil {\n\t\treturn fatal(fmt.Errorf(\"Failed to read from SHM file with error: %w\", err))\n\t}\n\tresponse := \"\"\n\tif is_confirm {\n\t\tvar ok bool\n\t\terr = json.Unmarshal(data, &ok)\n\t\tif err != nil {\n\t\t\treturn fatal(fmt.Errorf(\"Failed to parse response data: %#v with error: %w\", string(data), err))","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/ssh/askpass.go#L124-L160","documentation":"RunSSHAskpass flushes the SHM region with data_shm.Flush() after writing the request so the parent process can see it. If msync/flush fails, this fatal error is raised before trigger_ask is called.","triggerScenarios":"Flush of the memory-mapped SHM file failing due to msync errors on the backing filesystem.","commonSituations":"/dev/shm backed by a filesystem that does not support msync, or the file was unlinked/closed concurrently.","solutions":["Ensure /dev/shm is tmpfs","Check for other processes unlinking the temp SHM file","Re-run; report wrapped errno if persistent"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := f.Flush(); err != nil { /* abort IPC round-trip, clean up temp file */ }","preventionTips":["Ensure no concurrent unlink of the SHM file","Use tmpfs for /dev/shm"],"tags":["shared-memory","shm","flush","ssh","askpass"],"backgroundTag":"shared-memory-flush-failed","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}