Skip to content

paint recursion overflows stack on deep DOM #807

Description

@XDLCS

Steps to reproduce

Generate a page with 1272 nested <div>s and capture a screenshot with layout enabled:

n = 1272
html = '<div>' * n + 'x' + '</div>' * n
# serve it, then:
# moli fetch --layout --dump screenshot http://.../deep.html

Expected

A screenshot renders (Chrome 154 handles 5000 nesting levels fine).

Actual

thread 'render_runtime' has overflowed its stack
fatal runtime error: stack overflow, aborting

Process aborts with SIGABRT (rc=134).

Threshold (binary-searched)

nesting levels result
1271 ok (rc=0)
1272 SIGABRT (rc=134)

The threshold is identical on 1.1.9 (a54ba82) — not fixed, not regressed. Per-frame stack cost is ~6.7 KB against the 8 MiB render_runtime stack. --dump json / markdown paths are unaffected (no layout pass).

Suggestion

Iterativize the layout/paint recursion (explicit work queue instead of mutual recursion through compute_child_layout), or grow the render thread stack.

Environment

  • moli 1.1.10 (9b2f86b), Linux, --layout --dump screenshot

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions