Rails服务器恐慌:重复GET请求

时间:2015-06-28 22:37:58

标签: ruby-on-rails ruby-on-rails-4 safari server panic

我正在做一些与编码无关的事情(以及在不同的Safari窗口中),当我无处不在时,我看到日志生成了一堆GET请求。开头看起来像这样:

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'

然后第一个块再次重复n次,直到我停止服务器。唯一的异常现象如下:

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是我正在使用的user_id。

任何线索可能是什么?看起来很可疑。

1 个答案:

答案 0 :(得分:1)

您的应用是否会运行任何AJAX请求?由于这是在localhost上,在假设恶意或hackery之前,我假设一些与您的Rails服务器相关的流氓进程。具体而言,我会制作一份如下所示的清单:

  • 我的应用是否有任何可能发送AJAX请求的Javascript?
  • 当我禁用所有javascript时,请求是否仍会发生?
  • 我是否安装了任何可能触发AJAX请求的gem?
  • 当我没有在任何浏览器中打开网站时,是否会发出请求?
  • 无论我打开哪个浏览器,都会发生请求吗? (也许是一些奇怪的浏览器插件导致请求)
  • 如果我创建一个新的空/支架Rails应用程序,我是否可以在该应用程序上获得请求?
  • 当我没有打开任何浏览器时会发出请求吗?
  • 我的网络上有哪些其他人/计算机?这是一个大学宿舍,还是一个加密的个人家庭网络?我可以在不同的环境中重现请求吗?