Ruby on Rails/Devise smtp.rb 分段错误
我对这个问题做了很多研究,但未能解决我的问题。我正在使用 Rails 3.0.3、Ruby 1.8.7(补丁级别 334)、Apache、Passenger 3.0.7 和 Devise gem 1.1.8。另外,我使用 gmail 发送电子邮件。当我尝试发送密码重置时,我的 Apache error_log 中出现错误:
[Tue Nov 01 19:40:31 2011] [error] Premature end of script headers: users [ pid=9371 thr=3084437904 file=ext/apache2/Hooks.cpp:822 time=2011-11-01 19:40:31.664 ]: 后端应用程序(进程 9569)未发送有效的 HTTP 响应;相反,它什么也没发送。有可能是崩溃了;请检查此应用程序是否存在崩溃错误。
根据我的研究,我发现一个原因可能是 Ruby on Rails 寻找有问题的 OpenSSL 版本。我尝试了将其添加到我的 .bashrc 文件中的建议:
export RUBYOPT="-ropenssl"
另外,我尝试更新 production.rb 中的 SMTP 配置以不使用 TLS:
:enable_starttls_auto => false
我完整的 SMTP 配置:
config.action_mailer.default_url_options = { :host => '<domain>' }
ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => false,
:address => "smtp.gmail.com",
:port => 587,
:domain => <domain>,
:user_name => <username>,
:password => <password>,
:authentication => "plain"
}
我发现的所有建议似乎都不起作用。我不知道从这里去哪里,因为这些是我找到的唯一建议和修复。它在我的开发机器上运行没有任何问题。除了 Apache/Passenger 之外,它运行的是上述所有版本的相同版本,我在本地不使用 Apache/Passenger。
麦克风
I have done quite a bit of research on this issue and have not been able to solve my issue. I am using Rails 3.0.3, Ruby 1.8.7 (patchlevel 334), Apache, Passenger 3.0.7 and the Devise gem 1.1.8. Also, I am using gmail for sending out emails. When I attempt to send a password reset I am getting an error in my Apache error_log:
[Tue Nov 01 19:40:31 2011] [error] Premature end of script headers: users
[ pid=9371 thr=3084437904 file=ext/apache2/Hooks.cpp:822 time=2011-11-01 19:40:31.664 ]: The backend application (process 9569) did not send a valid HTTP response; instead, it sent nothing at all. It is possible that it has crashed; please check whether there are crashing bugs in this application.
From my research, I found one reason that it could be due to Ruby on Rails looking for a version of OpenSSL that is buggy. I tried the suggestion of adding this to my .bashrc file:
export RUBYOPT="-ropenssl"
Also, I tried to update my SMTP configuration in my production.rb to not use TLS:
:enable_starttls_auto => false
My complete SMTP configuration:
config.action_mailer.default_url_options = { :host => '<domain>' }
ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => false,
:address => "smtp.gmail.com",
:port => 587,
:domain => <domain>,
:user_name => <username>,
:password => <password>,
:authentication => "plain"
}
None of the suggestions I have found seem to have worked. I am not sure where to go from here as these are the only suggestions and fixes I have found. It does work without any issues on my development machine. Which is running the same versions of all the above except Apache/Passenger, which I do not us locally.
Mike
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可以通过将 Devise gem 升级到版本 1.4.8 来解决这个问题。但是,升级后我收到错误“未定义方法‘new_session_path’”。然后我升级到 Devise 版本 1.4.9,现在一切正常。希望这对某人有帮助。
麦克风
I was able to fix this by upgrading the Devise gem to version 1.4.8. However, after upgrading this I got an error "undefined method `new_session_path'." I then upgraded to Devise version 1.4.9 and everything is working fine now. Hope this helps someone.
Mike