Spaces:
Runtime error
Runtime error
akashyadav758 Claude Opus 4.8 (1M context) commited on
Commit ·
9d8e1f7
1
Parent(s): 888149c
Fix: extension SW DidStartWorkerFail + hanging /gpt API — drop renderer-capping Chrome flags
Browse filesRemove --renderer-process-limit=1, --process-per-site and --no-zygote from the
headless Chrome launch. Each of the 3 extensions runs an MV3 service worker (its own
renderer) and the chat flow injects via chrome.scripting.executeScript; capping
renderers to 1 starved them, so the GPT extension failed to start (DidStartWorkerFail)
and never connected, and when it did start executeScript hung — making /gpt (and
/gemini /flow) hang forever despite the browser UI chatting fine. HF cpu-basic has
16 GB (usage ~1-2 GB) so the memory flags weren't needed. Bump V8 heap 256->512MB.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- docs/troubleshooting.md +2 -0
- start_hf.sh +8 -4
docs/troubleshooting.md
CHANGED
|
@@ -28,6 +28,8 @@ Every issue we actually hit, and the fix.
|
|
| 28 |
| Login lost after restart | `DATABASE_URL` unset or DB unreachable (HF). Set the Neon secret; verify a row in `chrome_profile`. |
|
| 29 |
| ChatGPT Cloudflare "verify you are human" loops | UA/OS mismatch. The UA **must be Linux** (the Space runs Linux) — it's set in `start_hf.sh` and `chatgpt-free-api/cookies.go` (Chrome 145). If it still loops, it's the datacenter IP (HF=AWS) → use a residential `--proxy-server`. |
|
| 30 |
| `extensionConnected:false` / `has_flow_key:false` on `/…/health` | The in-Chrome extension hasn't connected to its server yet. It connects when (a) Chrome has loaded the extension and (b) **you're logged in** to that service. Open the monitor UI, log in, wait. Extensions auto-retry (~5 s reconnect alarm). |
|
|
|
|
|
|
|
| 31 |
| `chrome://extensions/` empty, no error | Branded Chrome ignoring `--load-extension` → must use Chrome for Testing (already in Dockerfile). |
|
| 32 |
| `Failed to connect to the bus` / `DidStartWorkerFail` in `chrome.log` | Harmless container warnings — not a crash. |
|
| 33 |
| "Restore pages?" popup | Handled by the `exit_type=Normal` Preferences injection in `start_hf.sh`. |
|
|
|
|
| 28 |
| Login lost after restart | `DATABASE_URL` unset or DB unreachable (HF). Set the Neon secret; verify a row in `chrome_profile`. |
|
| 29 |
| ChatGPT Cloudflare "verify you are human" loops | UA/OS mismatch. The UA **must be Linux** (the Space runs Linux) — it's set in `start_hf.sh` and `chatgpt-free-api/cookies.go` (Chrome 145). If it still loops, it's the datacenter IP (HF=AWS) → use a residential `--proxy-server`. |
|
| 30 |
| `extensionConnected:false` / `has_flow_key:false` on `/…/health` | The in-Chrome extension hasn't connected to its server yet. It connects when (a) Chrome has loaded the extension and (b) **you're logged in** to that service. Open the monitor UI, log in, wait. Extensions auto-retry (~5 s reconnect alarm). |
|
| 31 |
+
| Extension never connects + API calls **hang forever** (`DidStartWorkerFail` in `chrome.log`) | Chrome was launched with renderer-capping flags (`--renderer-process-limit=1`, `--process-per-site`, `--no-zygote`). Each extension's MV3 service worker is its own renderer and the chat flow injects via `executeScript`; capping renderers starves them → workers fail to start and `executeScript` hangs. **Removed from `start_hf.sh`** — keep Chrome multi-process (HF has 16 GB). The UI chatting fine while the API hangs is the tell. |
|
| 32 |
+
| Backend server logs | `GET /logs/{chatgpt,gemini,flow,monitor}` (API-key gated) tails each server's log without shelling into the container. |
|
| 33 |
| `chrome://extensions/` empty, no error | Branded Chrome ignoring `--load-extension` → must use Chrome for Testing (already in Dockerfile). |
|
| 34 |
| `Failed to connect to the bus` / `DidStartWorkerFail` in `chrome.log` | Harmless container warnings — not a crash. |
|
| 35 |
| "Restore pages?" popup | Handled by the `exit_type=Normal` Preferences injection in `start_hf.sh`. |
|
start_hf.sh
CHANGED
|
@@ -122,6 +122,13 @@ if [ -n "$DATABASE_URL" ]; then
|
|
| 122 |
fi
|
| 123 |
|
| 124 |
# 7. Launch Chrome Headless
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
echo "✨ Launching Chrome Headless..."
|
| 126 |
/opt/chrome-linux64/chrome \
|
| 127 |
--headless=new \
|
|
@@ -143,8 +150,6 @@ echo "✨ Launching Chrome Headless..."
|
|
| 143 |
--disable-crash-reporter \
|
| 144 |
--mute-audio \
|
| 145 |
--in-process-gpu \
|
| 146 |
-
--no-zygote \
|
| 147 |
-
--renderer-process-limit=1 \
|
| 148 |
--disable-dev-shm-usage \
|
| 149 |
--font-render-hinting=none \
|
| 150 |
--disable-font-subpixel-positioning \
|
|
@@ -164,7 +169,6 @@ echo "✨ Launching Chrome Headless..."
|
|
| 164 |
--disable-extensions-except=/opt/gpt-extension,/opt/gemini-extension,/opt/flow-extension \
|
| 165 |
--disable-translate \
|
| 166 |
--memory-pressure-off \
|
| 167 |
-
--process-per-site \
|
| 168 |
--disable-client-side-phishing-detection \
|
| 169 |
--disable-component-update \
|
| 170 |
--disable-domain-reliability \
|
|
@@ -179,6 +183,6 @@ echo "✨ Launching Chrome Headless..."
|
|
| 179 |
--disable-features=TranslateUI,PaintHolding,IsolateOrigins,site-per-process \
|
| 180 |
--enable-features=NetworkService,NetworkServiceInProcess \
|
| 181 |
--disable-site-isolation-trials \
|
| 182 |
-
--js-flags="--max-old-space-size=
|
| 183 |
--metrics-recording-only \
|
| 184 |
'about:blank' >> /home/chrome/chrome.log 2>&1
|
|
|
|
| 122 |
fi
|
| 123 |
|
| 124 |
# 7. Launch Chrome Headless
|
| 125 |
+
# NOTE: do NOT add --renderer-process-limit=1 / --process-per-site / --no-zygote here.
|
| 126 |
+
# Each of the 3 extensions runs an MV3 service worker (its own renderer) and the chat
|
| 127 |
+
# flow injects via chrome.scripting.executeScript into the service tab. Capping renderers
|
| 128 |
+
# starves those workers — they fail to start (DidStartWorkerFail) so the extension never
|
| 129 |
+
# connects, and when one does start, executeScript hangs → the /gpt /gemini /flow APIs
|
| 130 |
+
# hang forever. HF cpu-basic has 16 GB (we use ~1–2 GB), so the memory "savings" weren't
|
| 131 |
+
# needed and broke the extensions. Keep Chrome multi-process.
|
| 132 |
echo "✨ Launching Chrome Headless..."
|
| 133 |
/opt/chrome-linux64/chrome \
|
| 134 |
--headless=new \
|
|
|
|
| 150 |
--disable-crash-reporter \
|
| 151 |
--mute-audio \
|
| 152 |
--in-process-gpu \
|
|
|
|
|
|
|
| 153 |
--disable-dev-shm-usage \
|
| 154 |
--font-render-hinting=none \
|
| 155 |
--disable-font-subpixel-positioning \
|
|
|
|
| 169 |
--disable-extensions-except=/opt/gpt-extension,/opt/gemini-extension,/opt/flow-extension \
|
| 170 |
--disable-translate \
|
| 171 |
--memory-pressure-off \
|
|
|
|
| 172 |
--disable-client-side-phishing-detection \
|
| 173 |
--disable-component-update \
|
| 174 |
--disable-domain-reliability \
|
|
|
|
| 183 |
--disable-features=TranslateUI,PaintHolding,IsolateOrigins,site-per-process \
|
| 184 |
--enable-features=NetworkService,NetworkServiceInProcess \
|
| 185 |
--disable-site-isolation-trials \
|
| 186 |
+
--js-flags="--max-old-space-size=512" \
|
| 187 |
--metrics-recording-only \
|
| 188 |
'about:blank' >> /home/chrome/chrome.log 2>&1
|