【问题标题】:Autoloading ruby gem warning, may be causing Heroku application error?自动加载 ruby​​ gem 警告,可能导致 Heroku 应用程序错误?
【发布时间】:2013-08-02 11:53:43
【问题描述】:

我有一个非常简单的 Ruby Serve 原型网站,它在本地运行良好,但在 Heroku 上无法运行:

Aug 02 12:35:40 localp app/web.1:  [2013-08-02 11:35:40] INFO  WEBrick 1.3.1 
Aug 02 12:35:40 localp app/web.1:  [2013-08-02 11:35:40] INFO  ruby 1.9.3 (2013-06-27) [x86_64-linux] 
Aug 02 12:35:40 localp app/web.1:  [2013-08-02 11:35:40] INFO  WEBrick::HTTPServer#start: pid=2 port=4000 
Aug 02 12:36:39 localp heroku/web.1:  Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch 
Aug 02 12:36:39 localp heroku/web.1:  Stopping process with SIGKILL 
Aug 02 12:36:41 localp heroku/web.1:  Process exited with status 137 
Aug 02 12:36:41 localp heroku/web.1:  State changed from starting to crashed 

认为这可能与 gem 未正确加载有关,因为这是我收到的 local 警告:

[2013-08-02 12:39:22] INFO  WEBrick 1.3.1
[2013-08-02 12:39:22] INFO  ruby 1.9.3 (2012-10-12) [x86_64-darwin12.2.0]
[2013-08-02 12:39:22] INFO  WEBrick::HTTPServer#start: pid=79265 port=4000
WARN: serve autoloading 'slim' in a non thread-safe way; explicit require 'slim' suggested.
WARN: serve autoloading 'slim' in a non thread-safe way; explicit require 'slim' suggested.
WARN: serve autoloading 'slim' in a non thread-safe way; explicit require 'slim' suggested.
WARN: serve autoloading 'slim' in a non thread-safe way; explicit require 'slim' suggested.
WARN: tilt autoloading 'redcarpet' in a non thread-safe way; explicit require 'redcarpet' suggested.
WARN: tilt autoloading 'rdiscount' in a non thread-safe way; explicit require 'rdiscount' suggested.
127.0.0.1 - local [02/Aug/2013 12:40:10] "GET /wireframes/ HTTP/1.1" 200 - 0.2049
127.0.0.1 - local [02/Aug/2013 12:40:10] "GET /styles/style.css HTTP/1.1" 200 765 0.0018
127.0.0.1 - local [02/Aug/2013 12:40:10] "GET /favicon.ico HTTP/1.1" 404 31 0.0026

我已尝试明确要求 gems,但我收到相同的错误消息。这是我的 Gemfile:

source 'https://rubygems.org'
ruby '1.9.3'
gem 'serve', '1.5.2'

gem 'rack-contrib'
gem 'compass'
gem 'sass-globbing'
gem 'rdiscount', :require => 'rdiscount'
gem 'slim', :require => 'slim'

FWIW,这是我的 Procfile:

web: bundle exec rackup config.ru -p $PORT

我已经查看了 Stack Overflow 的所有内容。有一些答案,但它们与在 Rails 上预编译资产有关。任何想法可能是什么问题?

【问题讨论】:

    标签: ruby heroku gem tilt


    【解决方案1】:

    WEBrick 是为开发而设计的 Ruby 网络服务器,不推荐用于生产环境。它也是多线程

    尝试将gem "thin" 添加到您的 Gemfile。 Heroku 将使用 Thin 作为服务器,它不是多线程的(默认情况下虽然它有线程选项),你的 non thread-safe way 可能会消失。

    【讨论】:

    • 啊,没有意识到 heroku 本身就是一个生产环境。我添加了gem 'thin',但没有收到non-thread safe way 加载警告。但是,我仍然从 Heroku 收到 Application ErrorError R10 (Boot timeout)。感谢您的建议,将在Serve users forum 上进一步调查
    • 这确实修复了警告消息。唉,对我来说,heroku 上的应用程序错误是由其他原因引起的! :(
    猜你喜欢
    • 2012-09-07
    • 2018-09-24
    • 2017-06-21
    • 1970-01-01
    • 2015-10-23
    • 2017-01-30
    • 1970-01-01
    • 2015-03-16
    • 2011-05-09
    相关资源
    最近更新 更多