2011-06-10 49 views
6

延遲工作(2.1.4)在我的開發機器上完美工作,發送帶有同性戀放棄的電子郵件 - 但是,在使用Apache/Passenger(3.0.7)在我的服務器上運行時, 。 Rails的3.0.7和紅寶石1.9.2都btw。延遲工作提供未定義的方法錯誤

我已經看到有使用薄時,在作業這樣產生了一個問題:

--- !ruby/struct:Delayed::PerformableMailer 
object: !ruby/object:Class UserMailer 

當它應該閱讀:

--- !ruby/struct:Delayed::PerformableMailer 
object: !ruby/class UserMailer 

我的是我的開發機器上正確創建,但在服務器上創建時是錯誤的。

有沒有其他人有這個問題,我應該從哪裏開始尋找?

堆棧跟蹤:

{undefined method `standard_message' for #<Class:0xc6ad054> 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/performable_mailer.rb:6:in `perform'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/backend/base.rb:87:in `invoke_job'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:120:in `block (2 levels) in run'\n 
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/timeout.rb:57:in `timeout'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:120:in `block in run'\n 
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:119:in `run'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:177:in `reserve_and_run_one_job'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:104:in `block in work_off'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:103:in `times'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:103:in `work_off'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:78:in `block (2 levels) in start'\n 
/usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:77:in `block in start'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:74:in `loop'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/worker.rb:74:in `start'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/command.rb:104:in `run'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/command.rb:83:in `block in run_process'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons/application.rb:249:in `call'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons/application.rb:249:in `block in start_proc'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons/daemonize.rb:199:in `call'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons/daemonize.rb:199:in `call_as_daemon'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons/application.rb:253:in `start_proc'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons/application.rb:293:in `start'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons/controller.rb:70:in `run'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons.rb:195:in `block in run_proc'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons/cmdline.rb:109:in `call'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons/cmdline.rb:109:in `catch_exceptions'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/daemons-1.1.3/lib/daemons.rb:194:in `run_proc'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/command.rb:81:in `run_process'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/command.rb:75:in `block in daemonize'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/command.rb:73:in `times'\n 
/home/safrea/site/shared/bundle/ruby/1.9.1/gems/delayed_job-2.1.4/lib/delayed/command.rb:73:in `daemonize'\n 
script/delayed_job:5:in `<main>' 
+0

我不知道爲什麼這個工作會以不同方式創建(也許是因爲類被吹走並重新加載到開發中),但是實際上得到了什麼錯誤?你有沒有嘗試在「生產」模式下本地運行?也許發佈堆棧跟蹤。 – 2011-06-10 05:01:55

+0

我有問題從3.0.6升級到3.0.9 Rails。 3.0.6(1.9.2)工作正常。 – KirylP 2011-06-20 09:38:57

+1

我的解決方案是在處理程序類中重新定義'taguri'函數。 http://stackoverflow.com/questions/6286432/delayed-job-in-rails-failing/6776593#6776593 – KirylP 2011-07-21 13:19:18

回答

4

我設法解決這個問題。

幾個星期前,當bundler由於某種原因停止工作時,我創建了一個setup_load_paths.rb。這意味着gemfile在任何地方都被加載,除了乘客。這搞砸了對YAML :: ENGINE.yamler =「syck」的調用,這似乎是什麼東西的保存對象。

我刪除了setup_load_paths,現在一切正常。

+0

我一直在調試這個問題很長一段時間然後偶然發現了這個!優秀! – coneybeare 2011-07-27 23:40:26

+0

但是這個setup_load_paths.rb做了什麼?我沒有它,但仍然遇到這個問題。它裏面有什麼? – meta 2012-12-14 16:59:27

0

如果使用Syck解析器似乎不起作用(如Marc的回答中所述),請嘗試使用psych解析器。

YAML::ENGINE.yamler = "psych" 
相關問題