Skip to content

fix: correct linux zygote process titles - #50509

Merged
jkleinsc merged 3 commits into
electron:mainfrom
mitchchn:mitch/fix-linux-process-titles
Mar 27, 2026
Merged

jkleinsc merged 3 commits into
electron:mainfrom
mitchchn:mitch/fix-linux-process-titles

Conversation

@mitchchn

@mitchchn mitchchn commented Mar 25, 2026 •

Copy link
Copy Markdown
Member

Description of Change

On Linux, Electron child processes all showed up as generic zygotes in ps aux:

mitch    1759609  2.0  0.3 1460051028 214440 ?   S<l  19:47   0:00 /home/mitch/.config/Electron Fiddle/electron-bin/current/electron /tmp/electron-fiddle-1279287-sMVygh0fH1jo --inspect --ozone-platform=wayland /home/mitch/.cache/fiddle-core/fiddles/b35b66f75612912880e4d66dd317c9b5/main.js
mitch    1759612  0.0  0.1 50920708 66004 ?      S<   19:47   0:00 /home/mitch/.config/Electron Fiddle/electron-bin/current/electron --type=zygote --no-zygote-sandbox
mitch    1759613  0.0  0.1 50920696 65672 ?      S<   19:47   0:00 /home/mitch/.config/Electron Fiddle/electron-bin/current/electron --type=zygote
mitch    1759615  0.0  0.0 50920724 14840 ?      S<   19:47   0:00 /home/mitch/.config/Electron Fiddle/electron-bin/current/electron --type=zygote
mitch    1759655  4.3  0.2 56064660 179472 ?     S<l  19:47   0:00 /home/mitch/.config/Electron Fiddle/electron-bin/current/electron --type=zygote --no-zygote-sandbox
mitch    1759661  0.1  0.1 1459874424 105480 ?   S<l  19:47   0:00 /home/mitch/.config/Electron Fiddle/electron-bin/current/electron --type=zygote

Now they show their proper types (gpu, renderer) and arguments including flags, like Chromium:

mitch    1762160  5.4  0.4 1460197916 282588 ?   S<l  19:49   0:00 /home/mitch/data/Projects/electron/src/out/Testing/electron --inspect --ozone-platform=wayland /tmp/electron-fiddle-1279287-nrTwr784BgJm /home/mitch/.cache/fiddle-core/fiddles/fffa3b930a77d2140805f58b927ab25a/main.js
mitch    1762163  0.1  0.1 51061676 74196 ?      S<   19:49   0:00 /home/mitch/data/Projects/electron/src/out/Testing/electron --type=zygote --no-zygote-sandbox
mitch    1762164  0.1  0.1 51061660 73664 ?      S<   19:49   0:00 /home/mitch/data/Projects/electron/src/out/Testing/electron --type=zygote
mitch    1762166  0.0  0.0 51061688 17084 ?      S<   19:49   0:00 /home/mitch/data/Projects/electron/src/out/Testing/electron --type=zygote
mitch    1762218  7.5  0.3 56222176 211964 ?     S<l  19:49   0:00 /home/mitch/data/Projects/electron/src/out/Testing/electron --type=gpu-process --ozone-platform=wayland --render-node-override=/dev/dri/renderD128 --enable-crash-reporter=a22a5bff-8f3b-4af2-880f-453ac5aa42e2,no_channel --user-data-dir=/home/mitch/.config/truthful-owner-accuse-p9k3a --gpu-preferences=UAAAAAAAAAAgAQAEAAAAAAAAAAAAAGAAAQAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAYAAAAAAAAABgAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAA --shared-files --field-trial-handle=3,i,14101308013274626288,521187619438631028,262144 --enable-features=PdfUseShowSaveFilePicker --disable-features=DropInputEventsWhilePaintHolding,LocalNetworkAccessChecks,ScreenAIOCREnabled,SpareRendererForSitePerProcess,TraceSiteInstanceGetProcessCreation --variations-seed-version --pseudonymization-salt-handle=7,i,506182766847727171,559410832760408655,4 --trace-process-track-uuid=3209054329606749827
mitch    1762220  0.3  0.1 50881940 116376 ?     Sl   19:49   0:00 /home/mitch/data/Projects/electron/src/out/Testing/electron --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-GB --service-sandbox-type=none --render-node-override=/dev/dri/renderD128 --enable-crash-reporter=a22a5bff-8f3b-4af2-880f-453ac5aa42e2,no_channel --user-data-dir=/home/mitch/.config/truthful-owner-accuse-p9k3a --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,14101308013274626288,521187619438631028,262144 --enable-features=PdfUseShowSaveFilePicker --disable-features=DropInputEventsWhilePaintHolding,LocalNetworkAccessChecks,ScreenAIOCREnabled,SpareRendererForSitePerProcess,TraceSiteInstanceGetProcessCreation --variations-seed-version --pseudonymization-salt-handle=7,i,506182766847727171,559410832760408655,4 --trace-process-track-uuid=3998329054067842808
mitch    1762232  1.2  0.2 1460023584 179472 ?   S<l  19:49   0:00 /home/mitch/data/Projects/electron/src/out/Testing/electron --type=renderer --enable-crash-reporter=a22a5bff-8f3b-4af2-880f-453ac5aa42e2,no_channel --user-data-dir=/home/mitch/.config/truthful-owner-accuse-p9k3a --app-path=/tmp/electron-fiddle-1279287-nrTwr784BgJm --enable-sandbox --ozone-platform=wayland --lang=en-GB --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=4 --time-ticks-at-unix-epoch=-1774386820747858 --launch-time-ticks=95740213746 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,14101308013274626288,521187619438631028,262144 --enable-features=PdfUseShowSaveFilePicker --disable-features=DropInputEventsWhilePaintHolding,LocalNetworkAccessChecks,ScreenAIOCREnabled,SpareRendererForSitePerProcess,TraceSiteInstanceGetProcessCreation --variations-seed-version --pseudonymization-salt-handle=7,i,506182766847727171,559410832760408655,4 --trace-process-track-uuid=4787603778528935789

The fix is to pass the original argv pointer through to Chromium, since libuv copies it to a different buffer and that breaks Chromium's integrity check when setting the process information.

Refs #50462.

Checklist

Release Notes

Notes: Fixed Electron child process titles on Linux so they show their types (render, gpu, etc.) and complete command-line arguments and flags in ps aux.

@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Mar 25, 2026

@ckerr ckerr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice & simple. 👍

@ckerr ckerr added semver/patch backwards-compatible bug fixes target/42-x-y PR should also be added to the "42-x-y" branch. labels Mar 26, 2026

@deepak1556 deepak1556 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Do we need a similar change on macOS

int ElectronMain(int argc, char* argv[]) {
?

Comment thread shell/app/electron_main_linux.cc Resolved
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Mar 27, 2026

@deepak1556 deepak1556 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@jkleinsc

Copy link
Copy Markdown
Member

Merging as CI failure unrelated to PR change.

@jkleinsc
jkleinsc merged commit b41ec65 into electron:main Mar 27, 2026
61 of 62 checks passed
@release-clerk

release-clerk Bot commented Mar 27, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed Electron child process titles on Linux so they show their types (render, gpu, etc.) and complete command-line arguments and flags in ps aux.

@trop

trop Bot commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "42-x-y", please check out #50533

@trop trop Bot added in-flight/42-x-y merged/42-x-y PR was merged to the "42-x-y" branch. and removed target/42-x-y PR should also be added to the "42-x-y" branch. in-flight/42-x-y labels Mar 27, 2026
MarshallOfSound pushed a commit that referenced this pull request Sep 24, 2026
Second batch of specs for fixes that landed without one, each checked to
fail on the nightly release before the fix and pass after it:

- child processes forked from the zygote carry their own process title
  (#50509)
- the app exits instead of hitting LOG(FATAL) when the X server goes
  away (#52603), using a private Xvfb picked with -displayfd
- a fully transparent titleBarOverlay colour is honoured (#51017)
- the titleBarOverlay and its caption buttons are drawn on Linux
  (#52577)
- transparent frameless windows get no border painted around them
  (#50541)

The last three read pixels back off the X screen through a new
captureDisplayPixels() helper that compares captured colours with each
other rather than with constants, so it holds up on the 16-bit Xvfb
screen CI uses.
MarshallOfSound pushed a commit that referenced this pull request Sep 24, 2026
Regression test for #50509, where processes forked from the zygote kept
the zygote's command line as their process title, so ps and friends
showed every child as --type=zygote. The spec reads /proc/<pid>/cmdline
for the GPU, renderer and utility processes reported by getAppMetrics()
and expects each to carry its own --type switch, tolerating processes
that exit in the meantime.

Verified against Linux release builds: fails on 43.0.0-nightly.20260323,
passes on 43.0.0-nightly.20260402.
MarshallOfSound pushed a commit that referenced this pull request Sep 24, 2026
Regression test for #50509, where processes forked from the zygote kept
the zygote's command line as their process title, so ps and friends
showed every child as --type=zygote. The spec reads /proc/<pid>/cmdline
for the GPU, renderer and utility processes reported by getAppMetrics()
and expects each to carry its own --type switch, tolerating processes
that exit in the meantime.

Verified against Linux release builds: fails on 43.0.0-nightly.20260323,
passes on 43.0.0-nightly.20260402.
MarshallOfSound added a commit that referenced this pull request Sep 24, 2026
* test: cover app.disableHardwareAcceleration() adding --disable-gpu

Regression test for #51817, where disableHardwareAcceleration() stopped
appending the --disable-gpu switch. A small fixture app calls it before
ready and reports whether app.commandLine has the switch once ready.

Verified against Linux release builds: fails on 45.0.0-nightly.20260716,
passes on 45.0.0-nightly.20260720.

* test: check the default menu has no Help menu

Regression test for #50629, which moved the Electron project links out of
the menu every app gets by default and into the default app. The
default-menu fixture gains a --print-items mode that prints the roles and
labels of the top-level items, and the spec asserts the window menu is
there but no Help menu is.

Verified against Linux release builds: fails on 43.0.0-nightly.20260408,
passes on 43.0.0-nightly.20260413.

* test: check an unopened Menu can be garbage collected

Regression test for #50806, where a Menu that was built but never opened
was kept alive forever. The spec drops the last reference, holds a WeakRef
and requests async GCs until it clears.

Verified against Linux release builds: fails on 43.0.0-nightly.20260408,
passes on 43.0.0-nightly.20260413.

* test: check openDevTools() ignores an unknown dock mode

Regression test for #50646, where the dock mode string was spliced into a
script evaluated in the DevTools frontend. The spec passes a mode that
would break out of the string literal and set a global, waits for the
frontend host to round-trip, and asserts the global was never set. Uses
its own session partition so the dock state it leaves behind does not leak
into other DevTools tests.

Verified against Linux release builds: fails on 43.0.0-nightly.20260402,
passes on 43.0.0-nightly.20260406.

* test: check DevTools reopens in its last dock state

Regression test for #50807, where calling openDevTools() without a mode
always docked to the right instead of restoring the previous dock state.
The spec opens DevTools undocked, closes it, reopens with no options and
reads currentDockState back from the frontend preferences.

Verified against Linux release builds: fails on 43.0.0-nightly.20260408,
passes on 43.0.0-nightly.20260413.

* test: check a running app keeps serving its original asar after replacement

Regression test for #52283. File contents used to be re-read from whatever
file was at the archive's path using offsets from the header read at
startup, so replacing app.asar under a running app (as updaters do) served
the wrong bytes or failed. A fixture app loads a file from a temporary
asar in a BrowserWindow, renames a different archive over it, loads the
same file again and reports both results; the spec expects them to match
the original archive. Skipped on Windows, which does not allow renaming
over an archive that is held open.

Verified against Linux release builds: fails on 45.0.0-nightly.20260706,
passes on 45.0.0-nightly.20260716.

* test: check zygote children get their own process title on Linux

Regression test for #50509, where processes forked from the zygote kept
the zygote's command line as their process title, so ps and friends
showed every child as --type=zygote. The spec reads /proc/<pid>/cmdline
for the GPU, renderer and utility processes reported by getAppMetrics()
and expects each to carry its own --type switch, tolerating processes
that exit in the meantime.

Verified against Linux release builds: fails on 43.0.0-nightly.20260323,
passes on 43.0.0-nightly.20260402.

* test: check losing the X server exits the app instead of crashing

Regression test for #52603, where losing the display server connection
went straight to LOG(FATAL). The spec starts a private Xvfb (skipping if
none is available), launches a fixture app on it that logs when its window
is ready, kills the X server and expects the app to exit with a normal
exit code rather than die on a signal. Either Ozone (the app.exit(0) path
the fix added) or GTK (_exit(1)) can be the first to notice the dead
connection, so both codes are accepted. The X server is started inside the
test so mocha's in-job retries get a fresh one.

Verified against Linux release builds: the app dies with SIGTRAP on
45.0.0-nightly.20260805 and exits cleanly on 45.0.0-nightly.20260808.

* test: check a fully transparent titleBarOverlay color on Linux

Regression test for #51017, where a fully transparent overlay colour was
treated as unset and replaced with the default opaque one. Adds
captureDisplayPixels()/expectDisplayPixelsEventually() screen helpers that
read the primary display back through desktopCapturer and retry a set of
assertions until the compositor catches up, then uses them to show a red
page under a transparent overlay and assert that nearly all of the overlay
strip shows the page (only the caption glyphs differ).

The page carries a marker square so the check cannot pass on an unpainted
or stale surface, and colours are compared against each other rather than
constants because CI's 16-bit Xvfb screen quantises them. X11 only:
Wayland has no portal-free capture and other platforms draw native
caption buttons. Tagged serial since it reads the real screen.

Verified against Linux release builds: fails on 44.0.0-nightly.20260529,
passes on 44.0.0-nightly.20260701.

* test: check titleBarOverlay draws its background and buttons on Linux

Regression test for #52577, where the caption button container was not
shown at all on Linux. Using the same capture helpers, the spec shows a
red page with a blue overlay and white symbols and asserts that the
overlay strip is mostly not the page colour and that a second colour (the
button glyphs) is present within it.

Verified against Linux release builds: fails on 45.0.0-nightly.20260731,
passes on 45.0.0-nightly.20260803.

* test: check transparent frameless windows draw no border on Linux

Regression test for #50541, where the frame painted an opaque border
around transparent frameless windows on Linux. The spec puts a blue
backdrop window across the work area, shows a transparent frameless
window with two marker squares over it, captures the screen and asserts
that the only colours in and just around the window bounds are the
backdrop, the see-through area and the two markers, i.e. no frame, border
or shadow pixels. X11 only, tagged serial with the rest of the
"transparent" suite.

Verified against Linux release builds: fails on 43.0.0-nightly.20260323,
passes on 43.0.0-nightly.20260402.

---------

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged/42-x-y PR was merged to the "42-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants