Skip to content

Simultaneous rendering of a template hangs the process #39

@elado

Description

@elado

Looks like rending same compiled template many times simultaneously fires errors like V8::Error: Maximum call stack size exceeded or worse, gets the process stuck.

Is there a better practice for that?
I don't want to lose the speed of compiled templates.

The rendering is running under Sidekiq process which gets stuck often.

require 'celluloid'

handlebars = Handlebars::Context.new
tpl = handlebars.compile(...)

# works fine
10.times { 20.times.map { |i| Celluloid::Future.new { puts "start #{i}"; sleep 0.1; puts "end #{i}" } }.each(&:value) }

# process will hang forever at some point
10.times { 20.times.map { |i| Celluloid::Future.new { puts "start #{i}"; tpl.call(data: data); puts "end #{i}" } }.each(&:value) }

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