Rails 服务器崩溃:重复 GET 请求
Rails server panic: repeating GET requests
我正在做一些与编码无关的事情(并且在不同的 Safari windows 中),突然间我看到日志生成了一堆 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。
知道这可能是什么吗?看起来很可疑。
您的应用 运行 有任何 AJAX 请求吗?由于这是在本地主机上,在假设恶意或黑客行为之前,我假设一些与您的 Rails 服务器相关的流氓进程。具体来说,我会制作如下清单:
- 我的应用是否有任何 Javascript 可能会发送 AJAX 请求?
- 当我禁用所有 javascript 时,请求是否仍然出现?
- 我是否安装了任何可能触发 AJAX 请求的 gem?
- 当我没有在任何浏览器中打开网站时,是否会出现请求?
- 无论我打开哪个浏览器,请求都会发生吗? (可能是一些奇怪的浏览器插件引起了请求)
- 如果我创建一个新的空/脚手架 Rails 应用程序,我是否也可以让请求发生在那个应用程序上?
- 当我没有打开任何浏览器时是否会出现请求?
- 我的网络上还有哪些其他人/计算机?这是大学宿舍,还是加密的个人家庭网络?我可以在不同的设置中重现请求吗?
我正在做一些与编码无关的事情(并且在不同的 Safari windows 中),突然间我看到日志生成了一堆 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。
知道这可能是什么吗?看起来很可疑。
您的应用 运行 有任何 AJAX 请求吗?由于这是在本地主机上,在假设恶意或黑客行为之前,我假设一些与您的 Rails 服务器相关的流氓进程。具体来说,我会制作如下清单:
- 我的应用是否有任何 Javascript 可能会发送 AJAX 请求?
- 当我禁用所有 javascript 时,请求是否仍然出现?
- 我是否安装了任何可能触发 AJAX 请求的 gem?
- 当我没有在任何浏览器中打开网站时,是否会出现请求?
- 无论我打开哪个浏览器,请求都会发生吗? (可能是一些奇怪的浏览器插件引起了请求)
- 如果我创建一个新的空/脚手架 Rails 应用程序,我是否也可以让请求发生在那个应用程序上?
- 当我没有打开任何浏览器时是否会出现请求?
- 我的网络上还有哪些其他人/计算机?这是大学宿舍,还是加密的个人家庭网络?我可以在不同的设置中重现请求吗?