安装haveged以在虚拟机上更快地补充熵。
您可能没有足够的熵来生成UUID' , SecureRandom从中jRuby很容易耗尽随机性。尤其是在虚拟机上。所以你的虚拟机实际上是在等待更多的随机性成为可能。haveged通过收集新的熵来帮助快速补充随机性闪电。
安装...
下载:http ://www.issihosts.com/haveged/downloads.html
在类似 Debian 的 Linux 风格(如 Mint 和 Ubuntu)下,这可以完成:
sudo apt-get install haveged
SecureRandom这是一个已知问题jRuby...
过去我也遇到过这个问题,不得不用它strace来定位问题。请注意这个文件,它是在您在问题中提到的行之前加载的文件... internals/uuid.rb:
require "securerandom"
module Celluloid
module Internals
# Clearly Ruby doesn't have enough UUID libraries
# This one aims to be fast and simple with good support for multiple threads
# If there's a better UUID library I can use with similar multithreaded
# performance, I certainly wouldn't mind using a gem for this!
module UUID
values = SecureRandom.hex(9).match(/(.{8})(.{4})(.{3})(.{3})/)
PREFIX = "#{values[1]}-#{values[2]}-4#{values[3]}-8#{values[4]}".freeze
#de ...
end
end
end
那是有问题的代码,因为它会生成一个9十六进制数字字符串,它可以用作UUID代码的前缀......使用SecureRandom.
然后,通过该Celluloid::Internals::UUID.generate方法可以使用它。但是在加载时,Celluloid::Internals::UUID模块执行需要SecureRandom...的操作,jRuby但遇到了以下问题: