kurenn / sabisu-rails

Simple and powerful engine for exploring your Rails api application
MIT License
127 stars 29 forks source link

EOFError in SabisuRails::ExplorerController#index #19

Open xAxKx opened 10 years ago

xAxKx commented 10 years ago

Full trace:

/usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/net/protocol.rb:153:in read_nonblock' /usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/net/protocol.rb:153:inrbuf_fill' /usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/net/protocol.rb:134:in readuntil' /usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/net/protocol.rb:144:inreadline' /usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/net/http/response.rb:39:in read_status_line' /usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/net/http/response.rb:28:inread_new' /usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/net/http.rb:1406:in block in transport_request' /usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/net/http.rb:1403:incatch' /usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/net/http.rb:1403:in transport_request' /usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/net/http.rb:1376:inrequest' /usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/net/http.rb:1369:in block in request' /usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/net/http.rb:852:instart' /usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/net/http.rb:1367:in request' httparty (0.13.1) lib/httparty/request.rb:93:inperform' httparty (0.13.1) lib/httparty.rb:521:in perform_request' httparty (0.13.1) lib/httparty.rb:457:inget' /usr/local/rvm/gems/ruby-2.0.0-p481@market_place_api/bundler/gems/sabisu-rails-de6340971e70/lib/sabisu_rails/request.rb:17:in response' /usr/local/rvm/gems/ruby-2.0.0-p481@market_place_api/bundler/gems/sabisu-rails-de6340971e70/app/controllers/sabisu_rails/explorer_controller.rb:7:inindex' actionpack (4.1.4) lib/action_controller/metal/implicit_render.rb:4:in send_action' actionpack (4.1.4) lib/abstract_controller/base.rb:189:inprocess_action' actionpack (4.1.4) lib/action_controller/metal/rendering.rb:10:in process_action' actionpack (4.1.4) lib/abstract_controller/callbacks.rb:20:inblock in process_action' activesupport (4.1.4) lib/active_support/callbacks.rb:113:in call' activesupport (4.1.4) lib/active_support/callbacks.rb:113:incall' activesupport (4.1.4) lib/active_support/callbacks.rb:166:in block in halting' activesupport (4.1.4) lib/active_support/callbacks.rb:229:incall' activesupport (4.1.4) lib/active_support/callbacks.rb:229:in block in halting' activesupport (4.1.4) lib/active_support/callbacks.rb:166:incall' activesupport (4.1.4) lib/active_support/callbacks.rb:166:in block in halting' activesupport (4.1.4) lib/active_support/callbacks.rb:86:incall' activesupport (4.1.4) lib/active_support/callbacks.rb:86:in run_callbacks' actionpack (4.1.4) lib/abstract_controller/callbacks.rb:19:inprocess_action' actionpack (4.1.4) lib/action_controller/metal/rescue.rb:29:in process_action' actionpack (4.1.4) lib/action_controller/metal/instrumentation.rb:31:inblock in process_action' activesupport (4.1.4) lib/active_support/notifications.rb:159:in block in instrument' activesupport (4.1.4) lib/active_support/notifications/instrumenter.rb:20:ininstrument' activesupport (4.1.4) lib/active_support/notifications.rb:159:in instrument' actionpack (4.1.4) lib/action_controller/metal/instrumentation.rb:30:inprocess_action' actionpack (4.1.4) lib/action_controller/metal/params_wrapper.rb:250:in process_action' activerecord (4.1.4) lib/active_record/railties/controller_runtime.rb:18:inprocess_action' actionpack (4.1.4) lib/abstract_controller/base.rb:136:in process' actionview (4.1.4) lib/action_view/rendering.rb:30:inprocess' actionpack (4.1.4) lib/action_controller/metal.rb:196:in dispatch' actionpack (4.1.4) lib/action_controller/metal/rack_delegation.rb:13:indispatch' actionpack (4.1.4) lib/action_controller/metal.rb:232:in block in action' actionpack (4.1.4) lib/action_dispatch/routing/route_set.rb:82:incall' actionpack (4.1.4) lib/action_dispatch/routing/route_set.rb:82:in dispatch' actionpack (4.1.4) lib/action_dispatch/routing/route_set.rb:50:incall' actionpack (4.1.4) lib/action_dispatch/journey/router.rb:71:in block in call' actionpack (4.1.4) lib/action_dispatch/journey/router.rb:59:ineach' actionpack (4.1.4) lib/action_dispatch/journey/router.rb:59:in call' actionpack (4.1.4) lib/action_dispatch/routing/route_set.rb:678:incall' railties (4.1.4) lib/rails/engine.rb:514:in call' railties (4.1.4) lib/rails/railtie.rb:194:inpublic_send' railties (4.1.4) lib/rails/railtie.rb:194:in method_missing' actionpack (4.1.4) lib/action_dispatch/journey/router.rb:71:inblock in call' actionpack (4.1.4) lib/action_dispatch/journey/router.rb:59:in each' actionpack (4.1.4) lib/action_dispatch/journey/router.rb:59:incall' actionpack (4.1.4) lib/action_dispatch/routing/route_set.rb:678:in call' warden (1.2.3) lib/warden/manager.rb:35:inblock in call' warden (1.2.3) lib/warden/manager.rb:34:in catch' warden (1.2.3) lib/warden/manager.rb:34:incall' rack (1.5.2) lib/rack/etag.rb:23:in call' rack (1.5.2) lib/rack/conditionalget.rb:25:incall' rack (1.5.2) lib/rack/head.rb:11:in call' actionpack (4.1.4) lib/action_dispatch/middleware/params_parser.rb:27:incall' actionpack (4.1.4) lib/action_dispatch/middleware/flash.rb:254:in call' rack (1.5.2) lib/rack/session/abstract/id.rb:225:incontext' rack (1.5.2) lib/rack/session/abstract/id.rb:220:in call' actionpack (4.1.4) lib/action_dispatch/middleware/cookies.rb:560:incall' activerecord (4.1.4) lib/active_record/query_cache.rb:36:in call' activerecord (4.1.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:incall' activerecord (4.1.4) lib/active_record/migration.rb:380:in call' actionpack (4.1.4) lib/action_dispatch/middleware/callbacks.rb:29:inblock in call' activesupport (4.1.4) lib/active_support/callbacks.rb:82:in run_callbacks' actionpack (4.1.4) lib/action_dispatch/middleware/callbacks.rb:27:incall' actionpack (4.1.4) lib/action_dispatch/middleware/reloader.rb:73:in call' actionpack (4.1.4) lib/action_dispatch/middleware/remote_ip.rb:76:incall' actionpack (4.1.4) lib/action_dispatch/middleware/debug_exceptions.rb:17:in call' actionpack (4.1.4) lib/action_dispatch/middleware/show_exceptions.rb:30:incall' railties (4.1.4) lib/rails/rack/logger.rb:38:in call_app' railties (4.1.4) lib/rails/rack/logger.rb:20:inblock in call' activesupport (4.1.4) lib/active_support/tagged_logging.rb:68:in block in tagged' activesupport (4.1.4) lib/active_support/tagged_logging.rb:26:intagged' activesupport (4.1.4) lib/active_support/tagged_logging.rb:68:in tagged' railties (4.1.4) lib/rails/rack/logger.rb:20:incall' actionpack (4.1.4) lib/action_dispatch/middleware/request_id.rb:21:in call' rack (1.5.2) lib/rack/methodoverride.rb:21:incall' rack (1.5.2) lib/rack/runtime.rb:17:in call' activesupport (4.1.4) lib/active_support/cache/strategy/local_cache_middleware.rb:26:incall' rack (1.5.2) lib/rack/lock.rb:17:in call' actionpack (4.1.4) lib/action_dispatch/middleware/static.rb:64:incall' rack (1.5.2) lib/rack/sendfile.rb:112:in call' railties (4.1.4) lib/rails/engine.rb:514:incall' railties (4.1.4) lib/rails/application.rb:144:in call' rack (1.5.2) lib/rack/lock.rb:17:incall' rack (1.5.2) lib/rack/content_length.rb:14:in call' rack (1.5.2) lib/rack/handler/webrick.rb:60:inservice' /usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/webrick/httpserver.rb:138:in service' /usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/webrick/httpserver.rb:94:inrun' /usr/local/rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'

kurenn commented 9 years ago

Can you explain a little bit further when is this being presented?

adnanpirota commented 9 years ago

This happened to me also while following http://apionrails.icalialabs.com/ tutorial, any idea why this is happening?

kurenn commented 9 years ago

I think is something related to simple_form or the way the explorer is being accesed.

Are you running the application to explore on another server?

Cortlandd commented 9 years ago

I am having this issue also. I'm running Ubuntu Linux. At first I was getting: Errno::ECONNREFUSED in SabisuRails::ExplorerController#index Connection refused - connect(2) for "api.marketplaceapi.dev" port 80

Went to terminal and entered: prax start Now I'm getting: EOFError in SabisuRails::ExplorerController#index end of file reached

Any help if possible?

Mparaiso commented 9 years ago

same issue here , I'm using

rails s -b 0.0.0.0 -p 8080 

with vagrant (forwarded port 8080 => 3000 )

rails -v
Rails 4.2.3

ruby -v
ruby 2.2.1p85 (2015-02-26 revision 49769) [i686-linux]
kurenn commented 9 years ago

Are you running the instance on a multithread server? something like Puma or Unicorn?

Mparaiso commented 9 years ago

nope, i'm following rails api book( great book btw ) , but running the default server (webrick I guess ). That's the only thing that didn't work.

kurenn commented 9 years ago

Are you using pow? or prax?

ghost commented 8 years ago

I also have same problem I use pow. and mac os may be,I think the problem is localhost port is 3000, but default port 80.

env ruby : ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin15] Rails 4.2.4

img https://gyazo.com/8aca0a31573006d989cfc946687f7808

Errno::ECONNREFUSED in SabisuRails::ExplorerController#index Connection refused - connect(2) for nil port 80

Extracted source (around line #879): D "opening connection to #{conn_address}:#{conn_port}..." s = Timeout.timeout(@open_timeout, Net::OpenTimeout) { TCPSocket.open(conn_address, conn_port, @local_host, @local_port) } s.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) D "opened"

Application Trace | Framework Trace | Full Trace /Users/y_kim/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:879:in initialize' /Users/y_kim/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:879:inopen' /Users/y_kim/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:879:in block in connect' /Users/y_kim/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/timeout.rb:74:intimeout' /Users/y_kim/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:878:in connect' /Users/y_kim/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:863:indo_start' /Users/y_kim/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:852:in start' /Users/y_kim/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/http.rb:1375:inrequest' httparty (0.13.7) lib/httparty/request.rb:117:in perform' httparty (0.13.7) lib/httparty.rb:545:inperform_request' httparty (0.13.7) lib/httparty.rb:476:in get' /Users/y_kim/.rvm/gems/ruby-2.2.1/bundler/gems/sabisu-rails-af7499e87912/lib/sabisu_rails/request.rb:17:inresponse' /Users/y_kim/.rvm/gems/ruby-2.2.1/bundler/gems/sabisu-rails-af7499e87912/app/controllers/sabisu_rails/explorer_controller.rb:7:in index' actionpack (4.2.4) lib/action_controller/metal/implicit_render.rb:4:insend_action' actionpack (4.2.4) lib/abstract_controller/base.rb:198:in `process_action'

kurenn commented 8 years ago

Are you using a multithread server like puma or unicorn?

ppeusco commented 8 years ago

I have linux, recently solved the same problem running

prax start prior to: rails s

kurenn commented 8 years ago

@ppeusco 's solution should work, make sure you have a multithread server...

tarasmatsyk commented 8 years ago

Having the same issue. It does not actually matter whether I use webrick or puma. As @yongwoonKim mentioned the issue is that Sabisu expects app to run on port 80 when it runs on 3000.

Setup: webrick || puma prax linux

tarasmatsyk commented 8 years ago

The issue is that a port is not picked up by HTTParty and it starts using the default one which is 80.

new_uri = path.relative? ? options[:uri_adapter].parse("#{base_uri}#{path}") : path.clone

since base_uri is passed as is and path is /users/ (a default resource) we get the error above. I have not found the fix/reasons for the issue so far

an exact place in httparty (httparty/connection_adapter.rb)

port = uri.port || (uri.scheme == 'https' ? 443 : 80)

even if I specify the port in api_base_uri and the right URI is built, net/http.rb cannot establish connection to http://api.marketplace.dev:3000/users/

tarasmatsyk commented 8 years ago

@yongwoonKim, are you sure you have specified api_base_uri in sabisu_rails.rb config file? My exception looks differently than yours. (yours shows 'nil' instead of host)

Connection refused - connect(2) for "api.marketplaceapi.dev" port 80
kurenn commented 8 years ago

@yongwoonKim did you made it work?

ghost commented 8 years ago

@kurenn yeap, I did it!

https://github.com/kurenn/market_place_api/issues/7

kurenn commented 8 years ago

I'll close this then!

tarasmatsyk commented 8 years ago

@kurenn The issue is still valid for me =(

kurenn commented 8 years ago

@tamatsyk what is going on?, sorry about that, I'll reopen!

casimcdaniels commented 8 years ago

@kurenn

Same issue here. Hanging on "http://localhost:3000/sabisu_rails/explorer", then a Net::ReadTimeout in SabisuRails::ExplorerController#index

Following tutorial at http://apionrails.icalialabs.com/ exactly. Made sure the base_uri_path is set and all configurations set.

After the timeout error stack, there are two instances of

Started GET "/api/users/" for 127.0.0.1 at 2016-02-19 15:09:53 -0500

ActionController::RoutingError (No route matches [GET] "/api/users"):
  actionpack (4.2.5.1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  web-console (2.3.0) lib/web_console/middleware.rb:28:in `block in call'
  web-console (2.3.0) lib/web_console/middleware.rb:18:in `catch'
  web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
  actionpack (4.2.5.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.2.5.1) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.2.5.1) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.2.5.1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.2.5.1) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.2.5.1) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.2.5.1) lib/rails/rack/logger.rb:20:in `call'
  actionpack (4.2.5.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
  rack (1.6.4) lib/rack/runtime.rb:18:in `call'
  activesupport (4.2.5.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  actionpack (4.2.5.1) lib/action_dispatch/middleware/static.rb:116:in `call'
  rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
  railties (4.2.5.1) lib/rails/engine.rb:518:in `call'
  railties (4.2.5.1) lib/rails/application.rb:165:in `call'
  rack (1.6.4) lib/rack/urlmap.rb:66:in `block in call'
  rack (1.6.4) lib/rack/urlmap.rb:50:in `each'
  rack (1.6.4) lib/rack/urlmap.rb:50:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  rack (1.6.4) lib/rack/content_length.rb:15:in `call'
  rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
  /home/casi/.rbenv/versions/2.2.3/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
  /home/casi/.rbenv/versions/2.2.3/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
  /home/casi/.rbenv/versions/2.2.3/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'

Tested with both prax and WEBRick, same errors.

kurenn commented 7 years ago

Try using puma or unicorn, or run two different instances of the rails app, one running on the 3000 port and other one on 5000 then you can just run one of them to display sabisu.

Let me know how it goes!