{"record":{"id":"5c6e4596e160c9ad","repo":"stablyai/orca","slug":"owned-x11-session-processes-survived-cleanup-re","errorCode":null,"errorMessage":"Owned X11 session processes survived cleanup: ${remaining.join('; ')}","messagePattern":"Owned X11 session processes survived cleanup: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/run-terminal-ibus-hangul-e2e.mjs","lineNumber":292,"sourceCode":"        IBUS_ENABLE_SYNC_MODE: '1',\n        LANG: process.env.LANG || 'C.UTF-8',\n        QT_IM_MODULE: 'ibus',\n        XDG_CACHE_HOME: path.join(evidenceDir, 'cache'),\n        XDG_CONFIG_HOME: path.join(evidenceDir, 'config'),\n        XDG_RUNTIME_DIR: runtimeDir,\n        XMODIFIERS: '@im=ibus'\n      },\n      stdio: 'inherit'\n    }\n  )\n  if (!sessionProcess.pid) {\n    throw new Error('xvfb-run did not return a PID')\n  }\n  console.error(`[terminal-ime] started isolated X11 session PID ${sessionProcess.pid}`)\n  const exitCode = await waitForExit(sessionProcess)\n  const remaining = await stopOwnedProcessGroup(sessionProcess.pid)\n  if (remaining.length > 0) {\n    throw new Error(`Owned X11 session processes survived cleanup: ${remaining.join('; ')}`)\n  }\n  return exitCode\n}\n\nconst insideSession = process.argv[2] === insideSessionFlag\ntry {\n  if (insideSession && !process.argv[3]) {\n    throw new Error(`${insideSessionFlag} requires an evidence directory argument`)\n  }\n  process.exitCode = insideSession ? await runInsideSession(process.argv[3]) : await runOuter()\n} catch (error) {\n  console.error(`[terminal-ime] ${error instanceof Error ? error.message : String(error)}`)\n  process.exitCode = 1\n}\n","sourceCodeStart":274,"sourceCodeEnd":307,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/run-terminal-ibus-hangul-e2e.mjs#L274-L307","documentation":"After the inner session exits, runOuter() calls stopOwnedProcessGroup(sessionProcess.pid) to reap the whole xvfb-run tree (Xvfb, the inner session's IBus, xfwm4, etc.). Survivors would leak X servers and DBus daemons onto the host. The surviving PID list is included in the message.","triggerScenarios":"A process spawned inside the X11 session escaped the process group (setsid, reparented to init) or ignored the kill — e.g. Xvfb itself, a DBus daemon, or a re-activated ibus-daemon.","commonSituations":"xvfb-run's Xvfb child runs in its own session; DBus autostarts a session bus that escapes the group; a long-lived helper started with setsid; cgroup isolation blocks SIGKILL.","solutions":["Inspect the surviving PIDs (the message lists them) and identify which component escapes.","Run the outer harness inside a PID namespace so xvfb-run's entire tree is reaped on session exit.","Disable DBus/session autostart of ibus and other helpers inside the inner session env.","Ensure stopOwnedProcessGroup escalates to SIGKILL and re-checks for the session group."],"exampleFix":"// before\npnpm run test:e2e:terminal-ibus-hangul-native\n// after\nunshare -p --fork --mount-proc pnpm run test:e2e:terminal-ibus-hangul-native","handlingStrategy":"validation","validationCode":"const remaining = await stopOwnedProcessGroup(sessionProcess.pid)\nif (remaining.length > 0) {\n  console.error('X11 session survivors:', remaining)\n}","typeGuard":null,"tryCatchPattern":"const exitCode = await waitForExit(sessionProcess)\nconst remaining = await stopOwnedProcessGroup(sessionProcess.pid)\nif (remaining.length > 0) throw new Error(`Owned X11 session processes survived cleanup: ${remaining.join('; ')}`)","preventionTips":["Run the outer harness inside a PID namespace.","Disable DBus/session autostart of helpers inside the X11 session env.","Have stopOwnedProcessGroup escalate to SIGKILL and re-verify."],"tags":["x11","xvfb","process-cleanup","process-group","leak","linux","e2e"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}