Nethttp memory leak on long-running daemon

I used nethttp library to my small program. My program is simple.
It loops and call nethttp get method at every loop.
But when this program run for a long time, memory was up and up
eventually.
Here's my program. What's the matter??

require 'net/http'
loop do
  begin
    url = "http://localhost/test.html"
    resp = Net::HTTP.get(URI.parse(url))
  rescue
    # do nothing
  end
  sleep rand(0.1) # just a wait
end

···

--
Posted via http://www.ruby-forum.com/.

Hello,

by exhuming this thread, sadly, I've got to inform you that I've
encountered the very same issue. It's still there. I have got a similar
script fetching images from a webcam every 15 seconds. Every request
puffs up the memory usage even more until all available memory is
occupied by the Ruby daemon and the server needs to be reset.

Has anyone else experienced this problem and is willing and able to
provide a solution aside from using another scripting language to
achieve our goals?

Thanks

Hendrik

···

--
Posted via http://www.ruby-forum.com/.

Has anyone else experienced this problem and is willing and able to
provide a solution aside from using another scripting language to
achieve our goals?

I'm able to reproduce it.
http://blog.rapleaf.com/dev/2009/10/02/we-finally-ditched-ruby-nethttp/
may be helpful for a workaround.

Anybody else get it?

-roger-

···

--
Posted via http://www.ruby-forum.com/\.

Can either of you show code used to reproduce it and post to redmine?

The referenced blog post is two years old and mentions ruby 1.8.6. Both ruby and net/http have changed since then.

PS: At work we use net/http to perform billions of HTTP requests per week without insane memory growth. Without specific code that exhibits this behavior it will be difficult to track down.

···

On Oct 6, 2011, at 3:44 PM, Roger Pack wrote:

Has anyone else experienced this problem and is willing and able to
provide a solution aside from using another scripting language to
achieve our goals?

I'm able to reproduce it.
http://blog.rapleaf.com/dev/2009/10/02/we-finally-ditched-ruby-nethttp/
may be helpful for a workaround.