Skip to content

Crash when parallel render; not thread safe? Dies with X::HyperRace::Died in test case #41

@softmoth

Description

@softmoth

The benchmarking test case in t/11-iterables.t is failing:

An operation first awaited:
  in block  at t/11-iterable.t line 71
  in block <unit> at t/11-iterable.t line 38

Died with the exception:
    A worker in a parallel iteration (hyper or race) initiated here:
      in block  at lib/Template/Mustache.rakumod (Template::Mustache) line 577
      in block  at lib/Template/Mustache.rakumod (Template::Mustache) line 566
      in sub format at lib/Template/Mustache.rakumod (Template::Mustache) line 537
      in sub format at lib/Template/Mustache.rakumod (Template::Mustache) line 397
      in sub format at lib/Template/Mustache.rakumod (Template::Mustache) line 397
      in method render at lib/Template/Mustache.rakumod (Template::Mustache) line 295
      in block  at t/11-iterable.t line 57

    Died at:
        Cannot invoke this object (REPR: Uninstantiable; Callable)

Unfortunately this was not caught because the test case is run only when TEST_BENCHMARK=1 (or TEST_ALL=1). While that is set on the Travis CI runs, there aren't enough CPU cores when running there to run the test. So I am not sure when this started failing.

At line 577 of Template/Mustache.rakudoc it essentially calls .map(&format_section).join. There may be some shared state happening inside the format() routine that could be pulled out to outside of the map, if that is what's needed.

The test case is complicated, and of course the rendering function itself is very complex, so it may take some time to get an isolated test case for this issue. And I don't have a lot of experience with hyper/race handling. Any suggestions or links to relevant docs are very welcome!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions