josephholsten / rets4r

Bringing RETS to ruby
MIT License
52 stars 28 forks source link

Requester Doesn't Recover From EOFError #9

Open josephholsten opened 14 years ago

josephholsten commented 14 years ago

We got this issue in hoptoad:

Error Message: EOFError: end of file reached

Where: /usr/ruby1.8.7/lib/ruby/1.8/net/protocol.rb, line 135

Backtrace Summary:

/usr/ruby1.8.7/lib/ruby/1.8/net/protocol.rb:135:in `sysread'
/usr/ruby1.8.7/lib/ruby/1.8/net/protocol.rb:135:in `rbuf_fill'
/usr/ruby1.8.7/lib/ruby/1.8/timeout.rb:62:in `timeout'
/usr/ruby1.8.7/lib/ruby/1.8/timeout.rb:93:in `timeout'
/usr/ruby1.8.7/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
/usr/ruby1.8.7/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
/usr/ruby1.8.7/lib/ruby/1.8/net/protocol.rb:126:in `readline'
/usr/ruby1.8.7/lib/ruby/1.8/net/http.rb:2026:in `read_status_line'
/usr/ruby1.8.7/lib/ruby/1.8/net/http.rb:2015:in `read_new'
/usr/ruby1.8.7/lib/ruby/1.8/net/http.rb:1051:in `__request__'
[PROJECT_ROOT]/.bundle/gems/ruby/1.8/gems/rest-client-1.6.1/lib/restclient/net_http_ext.rb:17:in `request_without_newrelic_trace'
/usr/ruby1.8.7/lib/ruby/1.8/net/http.rb:772:in `get'
[PROJECT_ROOT]/.bundle/gems/ruby/1.8/bundler/gems/rets4r-1ef13955a443/lib/rets4r/client/requester.rb:94:in `request'
/usr/ruby1.8.7/lib/ruby/1.8/net/http.rb:543:in `start'
[PROJECT_ROOT]/.bundle/gems/ruby/1.8/bundler/gems/rets4r-1ef13955a443/lib/rets4r/client/requester.rb:77:in `request'
[PROJECT_ROOT]/.bundle/gems/ruby/1.8/bundler/gems/rets4r-1ef13955a443/lib/rets4r/client.rb:461:in `request'
[PROJECT_ROOT]/.bundle/gems/ruby/1.8/bundler/gems/rets4r-1ef13955a443/lib/rets4r/client.rb:205:in `login'
[PROJECT_ROOT]/lib/rets_service/search_response.rb:43:in `each'
[PROJECT_ROOT]/lib/job/photo_sync/two_pass_strategy.rb:28:in `map'
[PROJECT_ROOT]/lib/job/photo_sync/two_pass_strategy.rb:28:in `remove_orphaned_photos'
[PROJECT_ROOT]/lib/job/photo_sync/two_pass_strategy.rb:10:in `sync_photos'
[PROJECT_ROOT]/lib/job/photo_sync.rb:7:in `perform_without_newrelic_transaction_trace'
kidbrax commented 13 years ago

Thought I commented on this issue recently but I guess not. Anyway, I am also getting this but only on one specific board. I am on ruby 1.9.2. Has anyone looked any further into this? I am stumped.

josephholsten commented 13 years ago

Is it at all reproducible? Maybe we should add some logging to see if we can correlate things?

kidbrax commented 13 years ago

It looks like it's an error with right_http_connection. https://github.com/rightscale/right_http_connection/issues/5

kidbrax commented 13 years ago

So it turns out I was trying to use the RETS offset parameter and this was causing the issue. Some boards allow offset and others don't. Still appears to be a bug since it should have returned a better error instead of reaching EOF. But the bug is not in Rets4r. Anyway, the workaround was to not use offset to avoid the EOF error but also extend the read timeout so that the entire query could be returned before it times out when not using offset.

kidbrax commented 13 years ago

So thought I had this fixed but unfortunately this issue has raised its head again.

I did some work with rest-client and as you pointed out it has net/http at core so I got the same problem. But I can reproduce this bug every time with a certain board I am working with. If I gave you the credentials, would you be willing to take a look at it?

I can't confirm this yet, but it seems that it may be related to the RETS action urls. This board has the action url but is unable to process the request for that url. If I skip the action url, then I get the error above.