-
-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SecureRandom is slow or hangs. #3351
Comments
I'm running java 8 on OSX (2.7 GHz Intel Core i5) and I get the following: require 'benchmark'
require 'thread'
require 'securerandom'
def java_uuid
java.util.UUID.randomUUID
end
def secure_random_uuid
SecureRandom.uuid
end
def perform
threads = Array.new
10.times do
threads << Thread.new do
#secure_random_uuid # comment me
java_uuid # uncomment me
end
end
threads.each do |t|
t.join
end
end
puts "Warming..."
Benchmark.measure { 1000.times { perform } }
puts "Testing..."
puts Benchmark.measure { 1000.times { perform } }.inspect Note: I removed the Jruby 1.7 (1.7.20.1)(secure_random_uuid):
Jruby 1.7 (1.7.20.1)(java_uuid):
Jruby 9k (9.0.0.0)(secure_random_uuid):
Jruby 9k (9.0.0.0)(java_uuid):
I would love for some people to run this on a few other platforms and see what kind of results they get. For OSX, though, I don't see this as a problem since |
Here are the benchmarks in my environment. It did not hang in this test. envOS:CentOS 6.4
java_uuid jruby-9.0.0.0
java_uuid jruby-1.7.20
secure_random_uuid jruby-9.0.0.0
secure_random_uuid jruby-1.7.20
|
jruby was hanging for me on |
anyone tried running |
I got bitten hard by this on an OS reinstall. Installing an entropy daemon fixed it for me, but I spent several hours going through my SELinux policies with a fine-toothed comb trying to figure out if it was blocking me somewhere. :) +1 for revisiting #1405 |
|
should be better out of the box on JRuby 9.1 (>= 9.1.7.0 atm) my java uuid vs ruby uuid numbers are on par. |
This is likely a dupe of #1405.
SecureRandom.uuid is VERY slow or hangs, especially in a threaded environment. I changed to
java.util.UUID.randomUUID.to_s
and it seems responsive.Impacts jruby 9.0.0.0 and jruby 1.7.20.
The text was updated successfully, but these errors were encountered: