Skip to content

Instantly share code, notes, and snippets.

@bpot
Created March 23, 2013 01:12
Show Gist options
  • Save bpot/5225920 to your computer and use it in GitHub Desktop.
Save bpot/5225920 to your computer and use it in GitHub Desktop.
# 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