himl icon indicating copy to clipboard operation
himl copied to clipboard

Thread

Open sakuro opened this issue 5 years ago • 0 comments

Following script succeeds or fails with NoMethodError randomly.

  • case 1 .../himl-0.1.1/lib/himl/parser.rb:141:in current_line': undefined method column' for nil:NilClass (NoMethodError)
  • case 2 .../himl-0.1.1/lib/himl/parser.rb:149:in close_tags': undefined method name' for nil:NilClass (NoMethodError)

To reproduce, give two (large) integer numbers: number of threads and number of loops

require 'himl'
require 'erb'

parser = Himl::Parser.new
template = '<%= 1 %>'

nthreads = (ARGV.shift || 10).to_i
nloop = (ARGV.shift || 1000).to_i

nthreads.times.map {
  Thread.start do
    nloop.times do
      ERB.new(parser.call(template).to_erb).result
    end
  end
}.each(&:join)

sakuro avatar Mar 24 '19 05:03 sakuro