Skip to content

Add bash script demonstrating browser shell-wrapper pipe-hang bug (Brave + Chromium)#3748

Draft
Copilot wants to merge 8 commits intomasterfrom
copilot/fix-tests-hanging-at-end
Draft

Add bash script demonstrating browser shell-wrapper pipe-hang bug (Brave + Chromium)#3748
Copilot wants to merge 8 commits intomasterfrom
copilot/fix-tests-hanging-at-end

Conversation

Copy link
Contributor

Copilot AI commented Mar 18, 2026

Browser shell wrappers that use exec > >(exec cat) for stdio sanitization leave orphaned cat processes that hold a pipe's write end open indefinitely after the browser is killed — causing karma's Node.js event loop to hang forever waiting for EOF.

Root cause

/usr/bin/brave-browser sanitizes stdio before launching the real binary:

exec > >(exec cat)        # cat#1 holds caller's PIPE open
exec 2> >(exec cat >&2)   # cat#2 (stderr relay)
"$HERE/brave" "$@" || true

When karma kills the wrapper PID, brave's already-spawned children (renderer, zygote, crashpad-handler) become orphaned (PPID=1) but still hold the inner pipe's write end. cat can't see EOF → karma's pipe stays open → event loop never exits.

Demonstration script: .devcontainer/demonstrate-brave-pipe-hang.sh

Self-contained bash script (no Node.js, karma, or Scripture Forge) that replicates karma's spawn() pipe pattern using only a FIFO + cat reader, then empirically verifies the hang:

Command Wrapper type Hangs?
/usr/bin/brave-browser exec > >(exec cat) YES — 2 orphaned cat processes
/opt/brave.com/brave/brave Direct binary no
/usr/bin/chromium-browser Direct symlink (no wrapper) no
Debian chromium apt/deb wrapper Plain exec $binary "$@" no

The Debian chromium wrapper was also tested, disproving the speculation that it might share the same bug. It uses a plain exec that replaces the shell with the browser binary — no cat helpers, no orphaned processes.

Chromium tests are optional

If no Chromium is installed, those tests are skipped with instructions for setting them up (snap install or Debian deb extraction).

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 1.0.17.172.in-addr.arpa
    • Triggering command: /snap/cups/1146/sbin/cups-browsed cups-browsed -c /var/snap/cups/common/etc/cups/cups-browsed.conf enerator --no�� --noprofile (dns block)
  • 1.1.8.9.6.5.e.f.f.f.d.8.d.e.e.7.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa
    • Triggering command: /snap/cups/1146/sbin/cups-browsed cups-browsed -c /var/snap/cups/common/etc/cups/cups-browsed.conf enerator --no�� --noprofile (dns block)
  • accounts.google.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=4374 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/chromium_test_profile2 --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,6977420279721148034,12848469216065462557,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /usr/bin/chromium-browser /usr/bin/chromium-browser --headless --no-sandbox --disable-gpu --user-data-dir=/tmp/chromium_test_profile2 --dump-dom about:blank (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=4575 --enable-crash-reporter=,built on Debian GNU/Linux 12 (bookworm) --noerrdialogs --user-data-dir=/tmp/org.chromium.Chromium.scoped_dir.07jQm0 --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,16013454786389650431,2800950038668315020,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
  • android.clients.google.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=4374 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/chromium_test_profile2 --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,6977420279721148034,12848469216065462557,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /usr/bin/chromium-browser /usr/bin/chromium-browser --headless --no-sandbox --disable-gpu --user-data-dir=/tmp/chromium_test_profile2 --dump-dom about:blank (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=4817 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/chromium_symlink_pipe_test --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,155752377253780431,17229688320485250328,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
  • clients2.google.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=4374 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/chromium_test_profile2 --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,6977420279721148034,12848469216065462557,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /usr/bin/chromium-browser /usr/bin/chromium-browser --headless --no-sandbox --disable-gpu --user-data-dir=/tmp/chromium_test_profile2 --dump-dom about:blank (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=4575 --enable-crash-reporter=,built on Debian GNU/Linux 12 (bookworm) --noerrdialogs --user-data-dir=/tmp/org.chromium.Chromium.scoped_dir.07jQm0 --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,16013454786389650431,2800950038668315020,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
  • dict.brave.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=9335 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/tmp.SzZiddz3nw --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,3527843178424170683,11606244414411573090,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,15753281697493352399,9025177431895612609,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/brave.com/brave/brave /opt/brave.com/brave/brave --headless --no-sandbox --disable-gpu --user-data-dir=/tmp/tmp.SzZiddz3nw --remote-debugging-port=0 erator.late snap-seccomp xforge (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=9448 --enable-crash-reporter=,REDACTED --noerrdialogs --user-data-dir=/tmp/tmp.lptlxPvNq5 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,8334387987660079939,7634567572364261519,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,10122145265390306313,17512942230793764104,4 --trace-process-track-uuid=3190708989122997041 nfig/composer/vendor/bin/git rs/netplan (dns block)
  • go-updater.brave.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=9335 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/tmp.SzZiddz3nw --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,3527843178424170683,11606244414411573090,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,15753281697493352399,9025177431895612609,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/brave.com/brave/brave /opt/brave.com/brave/brave --headless --no-sandbox --disable-gpu --user-data-dir=/tmp/tmp.SzZiddz3nw --remote-debugging-port=0 erator.late snap-seccomp xforge (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=9448 --enable-crash-reporter=,REDACTED --noerrdialogs --user-data-dir=/tmp/tmp.lptlxPvNq5 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,8334387987660079939,7634567572364261519,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,10122145265390306313,17512942230793764104,4 --trace-process-track-uuid=3190708989122997041 nfig/composer/vendor/bin/git rs/netplan (dns block)
  • redirector.gvt1.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=4374 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/chromium_test_profile2 --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,6977420279721148034,12848469216065462557,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /usr/bin/chromium-browser /usr/bin/chromium-browser --headless --no-sandbox --disable-gpu --user-data-dir=/tmp/chromium_test_profile2 --dump-dom about:blank (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=4575 --enable-crash-reporter=,built on Debian GNU/Linux 12 (bookworm) --noerrdialogs --user-data-dir=/tmp/org.chromium.Chromium.scoped_dir.07jQm0 --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,16013454786389650431,2800950038668315020,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
  • usage-ping.brave.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=9335 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/tmp.SzZiddz3nw --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,3527843178424170683,11606244414411573090,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,15753281697493352399,9025177431895612609,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/brave.com/brave/brave /opt/brave.com/brave/brave --headless --no-sandbox --disable-gpu --user-data-dir=/tmp/tmp.SzZiddz3nw --remote-debugging-port=0 erator.late snap-seccomp xforge (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=9919 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/tmp.Q2AUJpozFf --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,239168255197074204,5537360220295456934,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,9328994437218483852,16133954678583969702,4 --trace-process-track-uuid=3190708989122997041 meta/snap.yaml /usr/lib/systemdHEAD (dns block)
  • variations.brave.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=9335 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/tmp.SzZiddz3nw --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,3527843178424170683,11606244414411573090,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,15753281697493352399,9025177431895612609,4 --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /opt/brave.com/brave/brave /opt/brave.com/brave/brave --headless --no-sandbox --disable-gpu --user-data-dir=/tmp/tmp.SzZiddz3nw --remote-debugging-port=0 erator.late snap-seccomp xforge (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=9448 --enable-crash-reporter=,REDACTED --noerrdialogs --user-data-dir=/tmp/tmp.lptlxPvNq5 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,8334387987660079939,7634567572364261519,262144 --disable-features=PaintHolding --variations-seed-version --pseudonymization-salt-handle=7,i,10122145265390306313,17512942230793764104,4 --trace-process-track-uuid=3190708989122997041 nfig/composer/vendor/bin/git rs/netplan (dns block)
  • www.google.com
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=4374 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/chromium_test_profile2 --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,6977420279721148034,12848469216065462557,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)
    • Triggering command: /usr/bin/chromium-browser /usr/bin/chromium-browser --headless --no-sandbox --disable-gpu --user-data-dir=/tmp/chromium_test_profile2 --dump-dom about:blank (dns block)
    • Triggering command: /proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=network --no-sandbox --use-angle=swiftshader-webgl --crashpad-handler-pid=4575 --enable-crash-reporter=,built on Debian GNU/Linux 12 (bookworm) --noerrdialogs --user-data-dir=/tmp/org.chromium.Chromium.scoped_dir.07jQm0 --change-stack-guard-on-fork=enable --shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101 --field-trial-handle=3,i,16013454786389650431,2800950038668315020,262144 --disable-features=PaintHolding --variations-seed-version --trace-process-track-uuid=3190708989122997041 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Frontend tests run but hang at the end. Even with --no-watch. Perhaps only in Ubuntu 24.04. When you try it out, I suggest you prefix the test run with timeout 180 so the test run is automatically killed when the timeout is succeeded.

Please reproduce the problem.
Please fix the problem so that the tests successfully finish and exit the process when completed (without needing to be killed by timeout).

To be clear, I want the following command to run and exit without hanging.

cd REPO_ROOT/src/SIL.XForge.Scripture/ClientApp && timeout 180 npm run test:headless -- --watch=false

Please do not assume that your edits or solutions have fixed the problem. You must verify that the problem is fixed by running the command.

The user has attached the following file paths as relevant context:

  • AGENTS.md

Created from VS Code.


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.


This change is Reviewable

…cript

Co-authored-by: marksvc <7265309+marksvc@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix frontend tests hanging issue on Ubuntu 24.04 Fix frontend test:headless hanging at end Mar 18, 2026
Copilot AI requested a review from marksvc March 18, 2026 21:08
Co-authored-by: marksvc <7265309+marksvc@users.noreply.github.com>
Copilot AI changed the title Fix frontend test:headless hanging at end Fix frontend test:headless hanging at end; add devcontainer Mar 18, 2026
Co-authored-by: marksvc <7265309+marksvc@users.noreply.github.com>
Copilot AI changed the title Fix frontend test:headless hanging at end; add devcontainer Add devcontainer with Brave browser for verifying frontend test fix Mar 19, 2026
…ia CHROMIUM_BIN

Co-authored-by: marksvc <7265309+marksvc@users.noreply.github.com>
Copilot AI changed the title Add devcontainer with Brave browser for verifying frontend test fix Install Brave browser in devcontainer and use it for frontend tests via CHROMIUM_BIN Mar 19, 2026
…shell wrapper

Co-authored-by: marksvc <7265309+marksvc@users.noreply.github.com>
Copilot AI changed the title Install Brave browser in devcontainer and use it for frontend tests via CHROMIUM_BIN Fix karma test run hanging at end when using Brave browser Mar 19, 2026
Co-authored-by: marksvc <7265309+marksvc@users.noreply.github.com>
…nd direct binary)

Co-authored-by: marksvc <7265309+marksvc@users.noreply.github.com>
Copilot AI changed the title Fix karma test run hanging at end when using Brave browser Add bash script demonstrating browser shell-wrapper pipe-hang bug (Brave + Chromium) Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants