public
Created

  • Download Gist
ssl_hang.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
# Attempt to reproduce SSL_shutdown() hang. http://bugs.ruby-lang.org/issues/7584
require 'net/http'
require 'uri'
 
20.times do
Thread.new {
loop do
# Sorry google!
uri = URI.parse("https://www.google.com/")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.start
sleep rand(10) * 0.1
http.finish if rand(2) == 1
sleep rand(10) * 0.1
# http://www.youtube.com/watch?v=ddUbsWnEVXM
puts "AND I KEEP GOING: #{Time.now} #{GC.count}"
end
}
end
 
5.times do
Thread.new {
loop do
GC.start
sleep rand(10) * 0.1
end
}
end
 
sleep 600
puts "DONE, failed to reproduce"

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.