Search code examples
ruby-on-railsruby-on-rails-4safariserverpanic

Rails server panic: repeating GET requests


I was doing something unrelated to coding (and in a different Safari windows), when out of nowhere i see the logs generating a bunch of GET requests. The beginning looks like this:

Started GET "/" for ::1 at 2015-06-28 18:19:41 -0400
Processing by StaticPagesController#home as HTML
Rendered static_pages/home.html.erb within layouts/application (0.3ms)
Rendered layouts/_shim.html.erb (0.1ms)
Rendered layouts/_header.html.erb (3.0ms)
Rendered layouts/_footer.html.erb (0.2ms)
Completed 200 OK in 375ms (Views: 373.9ms | ActiveRecord: 0.0ms)

Started GET "/login" for ::1 at 2015-06-28 18:19:12 -0400
Processing by SessionsController#new as HTML
 Rendered sessions/new.html.erb within layouts/application (920.0ms)
 Rendered layouts/_shim.html.erb (0.1ms)
 Rendered layouts/_header.html.erb (101.4ms)
 Rendered layouts/_footer.html.erb (0.2ms)
Completed 200 OK in 1884ms (Views: 1883.2ms | ActiveRecord: 0.0ms)
[2015-06-28 18:19:14] ERROR Errno::ECONNRESET: Connection reset by peer
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/webrick/httpserver.rb:80:in `eof?'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/webrick/httpserver.rb:80:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'

The first block then repeats again for n times until I stopped the server. The only anomaly is the following:

Started GET "/" for ::1 at 2015-06-28 18:19:41 -0400
Processing by StaticPagesController#home as HTML
  Rendered static_pages/home.html.erb within layouts/application (0.3ms)
  Rendered layouts/_shim.html.erb (0.1ms)
  User Load (0.4ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1  [["id", 13]]
  Rendered layouts/_header.html.erb (4.5ms)
  Rendered layouts/_footer.html.erb (0.2ms)
Completed 200 OK in 237ms (Views: 235.3ms | ActiveRecord: 0.4ms)

ID:13 was the user_id i was working with.

Any clue what might this be ? Looks suspicious.


Solution

  • Does your app run any AJAX requests? Since this is on localhost, before assuming malice or hackery, I'd assume some rogue process related to your Rails server. In specific I'd make a checklist like the following:

    • Does my app have any Javascript that might be sending an AJAX request?
    • Do the requests still occur when I disable all javascript?
    • Do I have any gems installed which might be triggering an AJAX request?
    • Do the requests occur when I don't have the site open in any browser?
    • Do the requests occur regardless of which browser I have open? (perhaps some strange browser add-on is causing the requests)
    • If I create a new empty / scaffolded Rails app, can I get the requests to occur on that one too?
    • Do the requests occur when I don't have any browsers open?
    • What other people / computers are on my network? Is this a college dorm, or an encrypted personal home network? Can I reproduce the requests in a different setting?