2

Having a bit of a problem running multiple workers.

When creating workers with rake jobs:work jobs run without and problem, even when invoking it multiple times, but when creating workers with ruby script/delayed_job -n 5 start all jobs fail with undefined method on Syck::DomainType.

I've searched quite a bit, but can't seem to find the solution for this. I am running DelayedJob on the Mongoid backend. Gem versions:

  • rake 0.9.2
  • rails 3.0.6
  • delayedjob 2.1.4
  • delayedjob_mongoid 1.0.2

Has anyone experienced a similar error/have a solution? Or short of that some information on why/how workers are being created differently depending on which way they are invoked?

mu is too short
  • 426,620
  • 70
  • 833
  • 800
Peck
  • 822
  • 1
  • 9
  • 26

4 Answers4

1

I had the exact same problem. I could reproduce it by loading the job in the console and trying to unserialize it:

$ rails console production
> j = Delayed::Job.last
> YAML.load(j.handler)

On my production environment, I got a Syck::DomainType object whereas in development it just unserialized my object (the data stored in db is the same in both case).

Long story short, I realized that I had ruby 1.9.1 instead of 1.9.2 on my server. Switching to an rvm managed environment with ruby-1.9.2p290 solved the problem for me.

sarfata
  • 4,625
  • 4
  • 28
  • 36
0

Perhaps ruby script/delayed_job -n 5 start all doesn't invoke Bundler.setup and that's why it's different from other ways of launching workers? (Just a guess)

You may be able to fix the Syck::DomainType error by putting this at the top of config/application.rb

require 'yaml'
YAML::ENGINE.yamler = 'syck'
# [...]
require File.expand_path('../boot', __FILE__)

Thanks to this answer: rails error, couldn't parse YAML

Community
  • 1
  • 1
Seamus Abshere
  • 8,326
  • 4
  • 44
  • 61
  • No change in behavior. Adding those. Previously had set syck to my yamler so only addition was the require 'yaml' line. Same error though – Peck Jul 20 '11 at 21:02
0

It looks like the problem was derived from bundler >= 1.0.10 loading up psych and overwriting some of sycks functionality if libyaml is present. I was able to remove the libyaml install from my system, something that I know won't be possible for everyone. Tough to track down, hopefully this post will help someone else

Peck
  • 822
  • 1
  • 9
  • 26
0

Run it with:

bundle exec ./script/delayed_job -n 5 start
Moozly
  • 192
  • 1
  • 9