Skip to content

view screenshot hangs on headless Linux: chromium waits indefinitely for external resources #181

Description

@wanguan2000

Bug: view screenshot hangs on headless Linux (chromium waits indefinitely for external resources)

Environment

  • OS: Rocky Linux 10.1
  • OfficeCLI: v1.0.131 (linux-x64)
  • Chromium: 149.0.7827.53 (headless=new)
  • Network: external access OK (fonts.googleapis.com and cdn.jsdelivr.net reachable)

Steps to reproduce

officecli create test.docx
officecli add test.docx / --type paragraph --prop text="Hello" --prop size=48
officecli close test.docx
officecli view test.docx screenshot -o test.png   # hangs forever

Root cause

OfficeCLI's generated HTML references external CDN resources:

  • fonts.googleapis.com/css2?family=...
  • cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css
  • cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js

Chromium in headless mode waits for these to fully load before taking the screenshot. Without --virtual-time-budget, it waits indefinitely even though the network is accessible.

Verified

  • chromium-browser --headless about:blank → screenshot completes instantly ✅
  • OfficeCLI's __resident-serve__ correctly discovers and spawns chromium with --headless=new --no-sandbox --disable-gpu --screenshot=...
  • Same chromium, same HTML file, but with --virtual-time-budget=10000 → screenshot completes in <2s ✅

Workaround

officecli view test.docx html -o test.html
chromium-browser --headless=new --no-sandbox --disable-gpu \
  --virtual-time-budget=10000 \
  --screenshot=test.png \
  file:///test.html

Suggested fix

Pass --virtual-time-budget (10000-15000ms) to chromium in screenshot mode, or inline critical CSS/fonts to avoid external dependency blocking.

Additional feedback

dumpbatch and merge are excellent. Worth the install cost alone. 🚀

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions