#15685·webdriverio

[ Bug]: All workers die with "write EINVAL" on Ubuntu 26.04 — xvfb-run does not preserve the IPC fd

Author: amorujaoCreated Sep 22, 2026Updated Sep 23, 2026
LabelsBug 🐛help wantedgood first pickwdio-local-runner

What happened?

On an ubuntu-26.04 GitHub-hosted runner, every worker dies the instant it is spawned:

SYNCHRONOUS TERMINATION NOTICE: ...
node:events:505
    throw er; // Unhandled 'error' event
Error: write EINVAL
    at target._send (node:internal/child_process:917:20)
    at target.send (node:internal/child_process:792:19)
    at .../node_modules/@wdio/local-runner/build/run.js:18:11
  errno: -22, code: 'EINVAL', syscall: 'write'

25 workers, 25 identical crashes, no spec ever starts and no results are written. The same suite is healthy on ubuntu-24.04.

Cause

run.js:17-21 announces readiness over the fork IPC channel as its first act. On CI, XvfbManager.shouldRun() is satisfied by "Linux and no DISPLAY" alone, so ProcessFactory.createWorkerProcess does not fork — it spawns the worker through the wrapper (@wdio/xvfb/build/index.js:396):

javascript
spawn('xvfb-run', ['--auto-servernum', '--', 'node', ...nodeArgs],
      { cwd, env, stdio: ['inherit', 'pipe', 'pipe', 'ipc'] })

That puts the IPC channel on fd 3 and sets NODE_CHANNEL_FD, and the fd then has to survive xvfb-run's exec into node. Ubuntu 26.04 ships xvfb 2:21.1.22-1ubuntu1, where it does not. The child still sees process.send as a function, calls it, and the write fails.

Minimal reproduction

No wdio involved — two files:

javascript
// child.mjs
process.send({ name: 'ready', origin: 'worker' })
javascript
// parent.mjs
import { spawn } from 'node:child_process'
import { fileURLToPath } from 'node:url'

const child = spawn(
  'xvfb-run', ['--auto-servernum', '--', 'node', fileURLToPath(new URL('./child.mjs', import.meta.url))],
  { stdio: ['inherit', 'pipe', 'pipe', 'ipc'] },
)
child.on('message', (m) => console.log('got message', JSON.stringify(m)))
child.on('exit', (code) => console.log('exit', code))

node parent.mjs, node 24.20.0, identical command on both images:

runner image xvfb result
ubuntu-24.04 2:21.1.12-1ubuntu1.6 got message {...}, exit 0
ubuntu-26.04 2:21.1.22-1ubuntu1 Error: write EINVAL, exit 1

Replacing the spawn with a plain fork passes on both images — also with stdio: ['inherit','pipe','pipe','ipc'], with 25 concurrent children, on node 22/24/26, and with an ESM or a CommonJS child. The xvfb-run wrapper is the only variable that changes the outcome.

Impact

ubuntu-latest moves to 26.04 between 2026-10-19 and 2026-11-19 (actions/runner-images#14748). Every Linux CI user whose capabilities do not name a local browser — Appium, cloud device farms, anything remote — loses their whole suite the moment that lands, with an error that names neither WebdriverIO nor xvfb.

Suggestion

Don't route the IPC channel through xvfb-run: keep fork and give the worker a DISPLAY from an Xvfb the launcher owns. Failing that, verify the channel after spawn and fall back to fork, rather than letting the worker die on an unhandled error event.

Versions

  • @wdio/local-runner 9.32.0
  • @wdio/xvfb 9.32.0
  • Node.js 24.20.0
  • GitHub-hosted ubuntu-26.04, image 20260907.131.1