Skip to content

Segfault with html5ever when using it in golang with a signal handler #393

Closed
servo/string-cache
#227
@joelwurtz

Description

@joelwurtz

This is really a weird bug that occurs on one of our program, i managed to make a reproduce small example under this repository: https://github.com/joelwurtz/segfault-golang-with-rust

What it does:

  • We are parsing a html fragment which contains a not existing local name attribute under html5ever
  • We exposing this parsing under a static library (on the musl target)
  • We compile this static library on go with musl gcc
  • We create a signal channel before calling the exposed api
  • We call this function after which cause the segfault (which happens on the LocalName::from(&*attribute_name) call with a not defined local name

This result in a segfault 100% of the time

There a some workaround for this:

  • Adding the attribute into the local_names.txt file will fix the problem
  • Calling the exposed API before creating the signal handler will fix the problem

I really don't know what happens inside and it's really difficult to trace it due to the way of compiling this.

I'm pretty sure this is a race case on rust lang and will do also an issue there.

Metadata

Metadata

Assignees

No one assigned

    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