Skip to content

Herb sometimes hangs when parsing an HTML file #103

@spect88

Description

@spect88

Hi Marco!

When I try to parse the default 404 page in Rails, herb works most of the time, but sometimes it hangs (stuck at 100% CPU and I have to kill it)

To reproduce:

# Try this a couple more times if it exits properly
for i in {1..10}; do herb parse 404.html > /dev/null; done

I use herb (0.1.1-arm64-darwin) on ruby 3.4.3 (2025-04-14 revision d0b7e5b6a0) +PRISM [arm64-darwin23].

I've also seen an occasional segfault (when parsing the same file).

Another thing, which might or might not be related is that when parsing the same HTML file using the Ruby API, I sometimes get empty <style> tag:

    │   │   │   │   ├── @ HTMLElementNode (location: (14:4)-(96:12))
    │   │   │   │   │   ├── open_tag:
    │   │   │   │   │   │   └── @ HTMLOpenTagNode (location: (14:4)-(14:11))
    │   │   │   │   │   │       ├── tag_opening: "<" (location: (14:4)-(14:5))
    │   │   │   │   │   │       ├── tag_name: "style" (location: (14:5)-(14:10))
    │   │   │   │   │   │       ├── tag_closing: ">" (location: (14:10)-(14:11))
    │   │   │   │   │   │       ├── children: []
    │   │   │   │   │   │       └── is_void: false
    │   │   │   │   │   │
    │   │   │   │   │   ├── tag_name: "style" (location: (14:5)-(14:10))
    │   │   │   │   │   ├── body: (1 item)
    │   │   │   │   │   │   └── @ HTMLTextNode (location: (14:11)-(96:4))
    │   │   │   │   │   │       └── content: ""
    │   │   │   │   │   │
    │   │   │   │   │   ├── close_tag:
    │   │   │   │   │   │   └── @ HTMLCloseTagNode (location: (96:4)-(96:12))
    │   │   │   │   │   │       ├── tag_opening: "</" (location: (96:4)-(96:6))
    │   │   │   │   │   │       ├── tag_name: "style" (location: (96:6)-(96:11))
    │   │   │   │   │   │       └── tag_closing: ">" (location: (96:11)-(96:12))
    │   │   │   │   │   │
    │   │   │   │   │   └── is_void: false

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions