LoginSignup
2
0

More than 5 years have passed since last update.

bundle install で `RuntimeError: Digest::Base cannot be directly inherited in Ruby` となる件

Posted at

100%ではなく、希に発生するエラー。

どうやら、Ruby の Digest::* (Digest::SHA256 とか) を require 'digest' だけしてマルスレッド環境下で使った時に起こり得る問題だとか。
Ruby のバグレポートにあるテストコードを何度か実行すると再現できる。

# https://bugs.ruby-lang.org/issues/9494
# https://gist.github.com/ConradIrwin/8830465
require 'digest'

class << Digest::Base
  def inherited(*)
    sleep 0.01
  end
end

t = Thread.start do
  Digest::SHA256.new
end
Digest::SHA256.new
t.join

__END__
$ ruby test.rb
test.rb:10:in `new': Digest::Base cannot be directly inherited in Ruby (RuntimeError)
        from test.rb:10:in `block in <main>'

ひとまず、bundle install の際は --jobs を 1 にしておけば遭遇しない、と考えてよいのだろうか?

※ ググっても困っている人がいないので何かを見落としている気がします…。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0