# Open uri buf read overflow

**URL:** <https://www.ruby-forum.com/t/open-uri-buf-read-overflow/114999>\
**Category:** Ruby\
**Created:** [September 19, 2007, 4:34pm UTC](https://www.ruby-forum.com/t/open-uri-buf-read-overflow/114999 "2007-09-19T16:34:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![animate123](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e19b73/32.png) [@animate123](https://www.ruby-forum.com/u/animate123)\
**Post date:** [September 19, 2007, 4:34pm UTC](https://www.ruby-forum.com/t/open-uri-buf-read-overflow/114999/1 "2007-09-19T16:34:25Z")

</div>

I’m using open-uri to open approx 3500 web pages to check to see if they  
have active contect. I’m using open uri to do it, but after about 2346  
pages have been open I get a buf\_read error and the program crashes.  
After looking in the open-uri documentation I couldn’t find anything  
that closes the connection and dumps the memory after the open method is  
called. Does anyone know how to dump the memory after I make each open()  
call?  
begin  
while (line = f.readline)  
line = line.split(/\n/)  
url = “[http://www](http://www).” + line[0] + “.com”  
#puts url  
begin  
open(url) { #|page| page\_content = page.read()  
puts url + " exists"  
nf.puts url  
}  
rescue  
puts"URL does not exist"  
#retry  
end  
end  
rescue EOFError  
f.close  
nf.close  
end
