Skip to content

Instantly share code, notes, and snippets.

@bpot bpot/ssl_hang.rb
Created Mar 23, 2013

Embed
What would you like to do?
# 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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.