fix(browse): add --disable-dev-shm-usage and --no-sandbox to Chromium launch args#1374
Closed
baofuen wants to merge 1 commit intogarrytan:mainfrom
Closed
fix(browse): add --disable-dev-shm-usage and --no-sandbox to Chromium launch args#1374baofuen wants to merge 1 commit intogarrytan:mainfrom
baofuen wants to merge 1 commit intogarrytan:mainfrom
Conversation
… launch args WSL2 and Docker containers often lack /dev/shm (shared memory) and unprivileged user namespaces. Chromium requires both to function correctly in multi-step browsing (chain commands, goto→js, goto→screenshot). Without these flags: - Individual browse commands work (goto, status) - Multi-step operations hang/timeout (chain, goto→js, goto→screenshot) Root cause: Chromium's CDP communication stalls when /dev/shm is insufficient, causing page.evaluate() and other IPC operations to hang. Fix: Add --disable-dev-shm-usage and --no-sandbox as default arguments in both launch() and launchCDP() methods, instead of conditionally adding --no-sandbox only in CI/CONTAINER environments. Verified: chain command with goto→status→js→console→network works on localhost SPA in WSL2 where it previously hung.
Owner
|
Closing in favor of #1366 (by @furkankoykiran) which scopes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
WSL2 and Docker containers often lack /dev/shm (shared memory) and unprivileged user namespaces. Chromium requires both to function correctly in multi-step browsing (chain commands, goto→js, goto→screenshot).
Without these flags:
Root cause: Chromium's CDP communication stalls when /dev/shm is insufficient, causing page.evaluate() and other IPC operations to hang indefinitely. The daemon starts and accepts connections, but any JS evaluation after navigation to a local SPA page hangs.
Fix
Add
--disable-dev-shm-usageand--no-sandboxas default arguments in bothlaunch()andlaunchCDP()methods, instead of conditionally adding--no-sandboxonly in CI/CONTAINER environments.Changes in browse/src/browser-manager.ts:
launch()method: inject both flags into launchArgs at initializationlaunchCDP()method: same flags added to the CDP launch args arrayVerification
Tested on WSL2 (Ubuntu 22.04) with a local React SPA at localhost:18081:
Before fix:
After fix:
Public URLs (example.com) were not affected but continue to work correctly after the change.
Need help on this PR? Tag
@codesmithwith what you need.