hyperframes icon indicating copy to clipboard operation
hyperframes copied to clipboard

[Windows] chrome-headless-shell.exe opens a visible console window on every render

Open Darkdragon847 opened this issue 3 months ago • 6 comments

Describe the bug

On Windows, every call to npx hyperframes render causes a visible CMD/console window to flash open and close for each shot rendered. When rendering a batch (e.g. 78 shots), 78 console windows open sequentially, making the machine completely unusable during the render. This happens even when HyperFrames is called from a GUI application with no terminal involved, confirming the window is being created inside HyperFrames itself.

Link to reproduction

Not applicable — this bug reproduces on every Windows machine with any render call, including a blank project created with: npx hyperframes init repro --non-interactive --example blank npx hyperframes render ./repro --format png No custom code is needed to trigger it. The console window appears on all Windows installs regardless of project content.

Steps to reproduce

  1. On Windows 11, run: npx hyperframes init repro --non-interactive --example blank
  2. Run: npx hyperframes render ./repro --format png
  3. Observe a CMD/console window flash open and close during render
  4. Run a batch of renders (multiple shots) — one console window opens per shot

Expected behavior

No console window should appear. Chrome headless should run silently in the background.

Actual behavior

A console window opens for every shot rendered, showing the path: C:\Users<username>.cache\hyperframes\chrome\chrome-headless-shell\win64-152.0.7977.30\chrome-headless-shell-win64\chrome-headless-shell.exe

Suppressing the window from the calling side (Python subprocess CREATE_NO_WINDOW + STARTUPINFO) has no effect because the window is opened by chrome-headless-shell.exe which is spawned inside HyperFrames' own Node.js code.

Suspected fix: add windowsHide: true to the Node.js child_process.spawn() call that launches chrome-headless-shell.exe.

Environment

hyperframes doctor

  ✓ Version          0.8.10 (latest)
  ✓ Node.js          v22.19.0 (win32 x64)
  ✓ CPU              16 cores · AMD Ryzen 7 6800H with Radeon Graphics @ 3194MHz
  ✓ Memory           13.7 GB total · 3.0 GB available
  ✓ Chrome           cache: C:\Users\username\.cache\hyperframes\chrome\chrome-headless-shell\win64-152.0.7977.30\chrome-headless-shell-win64\chrome-headless-shell.exe
  ✓ FFmpeg           N-120424-g03b9180fe3-20250731
  ✓ Node environment non-TTY

Additional context

Darkdragon847 avatar Aug 23 '26 09:08 Darkdragon847

Thanks for the report — the Windows console flash is clear. I'll put up a fix.

aryansk avatar Aug 23 '26 13:08 aryansk

Get-ChildItem "$env:USERPROFILE.cache\hyperframes\chrome" -Recurse -Filter chrome-headless-shell.exe -EA SilentlyContinue | ForEach-Object { $exe=$_.FullName; $b=[IO.File]::ReadAllBytes($exe); $o=[BitConverter]::ToInt32($b,0x3C)+92; if($b[$o]-eq3){$b[$o]=2;[IO.File]::WriteAllBytes($exe,$b);"Patched: $($exe)"}elseif($b[$o]-eq2){"Already patched (GUI): $($exe)"}else{"Unexpected value $($b[$o]): $($exe)"} } this seemed to fix for now but please see why it occurred and how it can be fixed.

Darkdragon847 avatar Aug 23 '26 20:08 Darkdragon847

please fix this as soon as possible it is creating mess

adityakatre avatar Aug 26 '26 13:08 adityakatre

Not a defect — puppeteer-core already passes windowsHide. No fix needed.

miga-heygen avatar Aug 27 '26 22:08 miga-heygen

Reproduced after this issue was closed as “not a defect”. The problem is still present in HyperFrames 0.8.20 on Windows with Node.js v24.19.0 and chrome-headless-shell 152.0.7977.30.

During ordinary Studio use, each Chrome Headless Shell process opened a visible Windows Terminal window. A Node preload that forced windowsHide: true on child_process calls did not suppress these windows.

I then tested the workaround previously posted by @Darkdragon847. After stopping HyperFrames and backing up the executable, I changed the cached chrome-headless-shell.exe PE Optional Header Subsystem from 3 (IMAGE_SUBSYSTEM_WINDOWS_CUI) to 2 (IMAGE_SUBSYSTEM_WINDOWS_GUI) at e_lfanew + 0x5C.

The console windows disappeared completely. HyperFrames Studio continues to work normally after the change:

  • WebGL hardware probe: NVIDIA GeForce RTX 5070 Ti Laptop GPU, D3D11
  • Browser: HeadlessChrome 152.0.7977.30
  • Capture mode: screenshot
  • Studio preview and hot reload working normally

This suggests that #3430 remains observable in the released HyperFrames 0.8.20, despite Puppeteer being expected to pass windowsHide.

Changing the PE subsystem is an effective local workaround, but it should not be the permanent upstream solution. It may be worth reopening this issue and verifying which Puppeteer browser launcher and dependency version are actually used by the published CLI.

mboccenti avatar Aug 31 '26 14:08 mboccenti

Reproduced after this issue was closed as “not a defect”. The problem is still present in HyperFrames 0.8.20 on Windows with Node.js v24.19.0 and chrome-headless-shell 152.0.7977.30.

During ordinary Studio use, each Chrome Headless Shell process opened a visible Windows Terminal window. A Node preload that forced windowsHide: true on child_process calls did not suppress these windows.

I then tested the workaround previously posted by @Darkdragon847. After stopping HyperFrames and backing up the executable, I changed the cached chrome-headless-shell.exe PE Optional Header Subsystem from 3 (IMAGE_SUBSYSTEM_WINDOWS_CUI) to 2 (IMAGE_SUBSYSTEM_WINDOWS_GUI) at e_lfanew + 0x5C.

The console windows disappeared completely. HyperFrames Studio continues to work normally after the change:

  • WebGL hardware probe: NVIDIA GeForce RTX 5070 Ti Laptop GPU, D3D11
  • Browser: HeadlessChrome 152.0.7977.30
  • Capture mode: screenshot
  • Studio preview and hot reload working normally

This suggests that #3430 remains observable in the released HyperFrames 0.8.20, despite Puppeteer being expected to pass windowsHide.

Changing the PE subsystem is an effective local workaround, but it should not be the permanent upstream solution. It may be worth reopening this issue and verifying which Puppeteer browser launcher and dependency version are actually used by the published CLI.

Thank you for fixing it for me. It got really annoying when I had 50 CMD terms open and closing; I couldn't even use my machine.

Here was my claude chat after pasting in your comment.

This connects directly to the CMD popup issues they've been hitting all session. The fix involves patching the cached chrome-headless-shell.exe binary's PE header to flip the subsystem flag from console (CUI) to GUI, which should stop the console window from appearing. Since it's their own machine and their own cached binary, this seems like a safe, reasonable thing to apply.

I'll locate the exact exe path in their hyperframes cache, back it up first, then read the PE header to confirm the subsystem value is 3 before patching it to 2 and verifying the change. I should also check if there's a full "chrome" binary alongside chrome-headless-shell that needs the same treatment, and note this fix will get wiped out if hyperframes re-downloads the binary later.

That's the same defect that's been producing your CMD windows and the ProduceSkia spam all session. The patch is legitimate — it just flips the PE subsystem so Windows doesn't allocate a console for the process. Let me check what's actually in your cache first:

With both cached versions available and nothing currently running, I want to inspect the PE headers read-only before making any changes. I'm writing a small Python script to extract e_lfanew and the subsystem field from each file.

Two cached versions, nothing running. Reading the PE headers before touching anything:

Both files confirm the PE32+ CUI subsystem byte at the expected offset. Now I'm weighing backup strategy: full 210MB backups for both files would total 420MB, which is safe but space-heavy, so I'm considering whether a targeted backup of just the affected bytes would suffice instead.

Since the patch is only 2 bytes at a known offset with an in-place write, a full backup is overkill — I'll save the first 0x400 bytes (the PE header) of each exe to a .pehdr.bak file as a cheap safety net, then patch both versions since either could be in use.

Both confirmed at subsystem 3 (WINDOWS_CUI) at offset 0xD4 — exactly what the issue describes. Backing up the headers and patching:

Both patched. Now proving it still renders — this is the part that matters, since a bad PE edit would break the binary outright:

Fixed, and verified working.

Both cached binaries patched. They were identical to the issue's description — PE32+, e_lfanew at 0x78, so the Optional Header Subsystem sits at 0xD4, holding 3 (IMAGE_SUBSYSTEM_WINDOWS_CUI). Both now read 2 (IMAGE_SUBSYSTEM_WINDOWS_GUI):

Version Before After
win64-152.0.7977.30 (in use) 3 CUI 2 GUI
win64-152.0.7928.2 (older, still cached) 3 CUI 2 GUI

Xpertfall avatar Sep 06 '26 20:09 Xpertfall