Wednesday, April 6, 2011

EOFError: end of file reached


Ruby EOFError: end of file reached

EOFError: end of file reached
from /usr/lib/ruby/1.8/net/protocol.rb:135:in `sysread'
from /usr/lib/ruby/1.8/net/protocol.rb:135:in `rbuf_fill'
from /usr/lib/ruby/1.8/timeout.rb:62:in `timeout'
from /usr/lib/ruby/1.8/timeout.rb:93:in `timeout'
from /usr/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
from /usr/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
from /usr/lib/ruby/1.8/net/protocol.rb:126:in `readline'
from /usr/lib/ruby/1.8/net/http.rb:2020:in `read_status_line'
from /usr/lib/ruby/1.8/net/http.rb:2009:in `read_new'



The key point to resolve this kinda issue is to encode the url, before fire the connect or get.

@agent.get URI.encode(url)


OR

This is a timeout error you can handle it like below.



1
2
3
4
5
6
7
8
9
10
require 'net/pop3'
begin
Net::POP3.auth_only(@server, @port, @username, @password)
rescue => e
write_error_to_logfile(e)
do_something_sensible
rescue Timeout::Error => e
write_error_to_logfile(e)
do_something_sensible_for_timeout
end


No comments:

Post a Comment