【问题标题】:Issue with daemons gem in RailsRails 中的守护进程 gem 问题
【发布时间】:2014-07-24 05:06:00
【问题描述】:

除了 daemon_generator 插件之外,我还在使用带有 Rails 的 daemons gem。我在守护进程日志文件中得到了这个输出:

 Logfile created on Sat May 09 20:10:35 -0700 2009 by /
-below you find the most recent exception thrown, this will be likely (but not certainly) the exception that made the application exit abnormally ***
#<NameError: uninitialized constant SmsMessage>
-below you find all exception objects found in memory, some of them may have been thrown in your application, others may just be in memory because they are standard exceptions ***
#<NoMemoryError: failed to allocate memory>
#<SystemStackError: stack level too deep>
#<fatal: exception reentered>
#<MissingSourceFile: no such file to load -- ./config/global_constants.conf>
#<NameError: uninitialized constant SmsMessage>

我发现这个输出很难理解。它显示不同的错误消息,我可以说这不是 ./config/global_constants.conf 问题,因为我没有在守护程序文件中调用它。另外,我认为这不是内存问题,因为我的 Mac 有 2GB 内存并且运行的程序不多。至于我通常使用的 SmsMessage 调用它:

scheduledMessagesParent = SmsMessage.valid.find(:all, :conditions => {:status => $SCHEDULED_MESSAGE})

在我网站的其他地方也可以使用!! 我注意到记录器是使用

调用的
ActiveRecord::Base.logger.info "....

是否有可能我必须以其他方式指定模型的路径?我通常使用 logger.info 调用记录器,而不需要 ActiveRecord::Base。如果有怎么办?

任何想法如何去调试这个问题?有没有办法显示堆栈跟踪或更好的错误消息?

【问题讨论】:

    标签: ruby-on-rails ruby-daemons


    【解决方案1】:

    我通过使用 Daemon 加载 Rails 环境解决了这个问题。它没有包含在我从中获取信息的教程中,但它现在可以工作了:)

    【讨论】:

      猜你喜欢
      • 2012-07-28
      • 1970-01-01
      • 2018-05-27
      • 2016-04-29
      • 2011-09-26
      • 1970-01-01
      • 2016-08-30
      • 2011-08-28
      • 1970-01-01
      相关资源
      最近更新 更多