错误Errno :: ECONNRESET:由对等体重置连接 [英] ERROR Errno::ECONNRESET: Connection reset by peer

查看:901
本文介绍了错误Errno :: ECONNRESET:由对等体重置连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ b gem'bson','> = 1.0.7'
gem'mongo_mapper',:branch => 'rails3',:git => 'http://github.com/jnunemaker/mongomapper.git'
gem'devise-mongo_mapper',,git => 'git://github.com/collectiveidea/devise-mongo_mapper'

使用上面的设置,我得到以下请求错误:

 于2010-09-27 13:00开始获取127.0.0.1的/ users / sign_out 16:30 +0300 
Devise :: SessionsController#销毁为HTML
重定向到http:// localhost:3000 /
完成302找到19ms
[2010-09 -27 13:16:31]错误Errno :: ECONNRESET:连接重置由对等体
/usr/local/ruby/lib/ruby/1.9.1/webrick/httpserver.rb:56:in`eof?
/usr/local/ruby/lib/ruby/1.9.1/webrick/httpserver.rb:56:in`run'
/usr/local/ruby/lib/ruby/1.9.1/ webrick / server.rb:183:在`block in start_thread'


在2010-09-27 13:16:35启动GET/ users / edit为127.0.0.1 + 0300
由Devise :: RegistrationsController处理#编辑为HTML
完成16ms
[2010-09-27 13:16:35]错误Errno :: ECONNRESET:连接由peer $ b重置$ b / usr / local / ruby​​ / lib / ruby /1.9.1/webrick/httpserver.rb:56:in`eof?'
/usr/local/ruby/lib/ruby/1.9.1/webrick/httpserver.rb:56:in`run'
/usr/local/ruby/lib/ruby/1.9.1/webrick/server.rb:183:in在start_thread中的块

用户模型:

  class User 
include MongoMapper :: Document
插件MongoMapper :: Devise
devise:可注册,:database_authenticatable,:可恢复
结束

想法?

解决方案

我很快猜测,这看起来像你的会话有问题,而protect_from_forgery是踢进。



我有一个类似的问题,把我的头砸在墙上几天,原来是将整个对象分配给会话对象而不是只是id。一个快速注释,非GET请求是触发protect_from_forgery的请求。


gem 'rails', '3.0.0'
gem 'devise'
gem 'bson_ext', '>= 1.0.7'
gem 'bson', '>= 1.0.7'
gem 'mongo_mapper', :branch => 'rails3', :git => 'http://github.com/jnunemaker/mongomapper.git'
gem 'devise-mongo_mapper', :git => 'git://github.com/collectiveidea/devise-mongo_mapper'

With the above setup I get the following errors on requests:

Started GET "/users/sign_out" for 127.0.0.1 at 2010-09-27 13:16:30 +0300
  Processing by Devise::SessionsController#destroy as HTML
Redirected to http://localhost:3000/
Completed 302 Found in 19ms
[2010-09-27 13:16:31] ERROR Errno::ECONNRESET: Connection reset by peer
    /usr/local/ruby/lib/ruby/1.9.1/webrick/httpserver.rb:56:in `eof?'
    /usr/local/ruby/lib/ruby/1.9.1/webrick/httpserver.rb:56:in `run'
    /usr/local/ruby/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'


Started GET "/users/edit" for 127.0.0.1 at 2010-09-27 13:16:35 +0300
  Processing by Devise::RegistrationsController#edit as HTML
Completed   in 16ms
[2010-09-27 13:16:35] ERROR Errno::ECONNRESET: Connection reset by peer
    /usr/local/ruby/lib/ruby/1.9.1/webrick/httpserver.rb:56:in `eof?'
    /usr/local/ruby/lib/ruby/1.9.1/webrick/httpserver.rb:56:in `run'
    /usr/local/ruby/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'

The user model:

class User
  include MongoMapper::Document
  plugin MongoMapper::Devise
  devise :registerable, :database_authenticatable, :recoverable
end

Ideas?

解决方案

My quick guess is this looks like you have a problem with your sessions and protect_from_forgery is kicking in.

I had a similar problem and smashed my head against the wall for a few days, it turned out to be I was assigning an entire object to a session object instead of just the id. A quick note, non-GET requests are the ones that trigger the protect_from_forgery.

这篇关于错误Errno :: ECONNRESET:由对等体重置连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆