-
Notifications
You must be signed in to change notification settings - Fork 955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Job failed to load: undefined method `load_dj' for Syck:Module. #786
Comments
You have to set the YAML engine before DJ is required or the correct files will not be loaded. This means you have to set the YAML engine at the top of your Also be aware many libraries are dropping Syck support and we probably will as well. |
I had the YAML ENGINE configuration in my |
I also checked that before the delayed job library is loaded, the YAML engine is correctly set to Syck |
The below code is from def payload_object
@payload_object ||= YAML.load_dj(handler)
rescue TypeError, LoadError, NameError, ArgumentError, SyntaxError, Psych::SyntaxError => e
raise DeserializationError, "Job failed to load: #{e.message}. Handler: #{handler.inspect}"
end |
What version of ruby? |
|
So Syck detection does not work in 1.9.3. I can't test if 1.9.2 worked, and 2.0 removed Syck support. Given that 1.9.3 is now EOL and you are the only person with this issue in 3 years, our fix is probably going to be to remove the Syck extensions entirely, which doesn't help you, but If you fork and change https://github.com/collectiveidea/delayed_job/blob/master/lib/delayed/yaml_ext.rb#L5 to
it should load the correct libraries but it still may not work. |
Yeah, I had already tried your fork and code change and it did not work. I have monkey patched a fix for now. We will be moving to Thanks for your prompt responses. |
Hey Manjunath, I am not sure if this is the fix you implemented, but this works well for me (added in a Rails initializer): module Delayed
module Backend
module Base
def payload_object
if YAML.respond_to? :load_dj
@payload_object ||= YAML.load_dj(handler)
elsif YAML.respond_to? :unsafe_load
@payload_object ||= YAML.load(handler, safe: false)
else
@payload_object ||= YAML.load(handler)
end
rescue TypeError, LoadError, NameError, ArgumentError, SyntaxError, Psych::SyntaxError => e
raise DeserializationError, "Job failed to load: #{e.message}. Handler: #{handler.inspect}"
end
end
end
end I am using:
|
Carlos, This is kind of the same fix which I monkey-patched and it works well for me. We have moved to Ruby 2.1 though and the monkey-patch is no longer needed. |
Fixes "Job failed to load: undefined method `load_dj' for Syck:Module" when Syck is used as YAML engine Fixes collectiveidea#786
Submitted a job and ran a DJ worker and the job failed with an exception
Job failed to load: undefined method 'load_dj' for Syck:Module.
This is my configuration
YAML::ENGINE.yamler= 'syck'
Exception Trace
Job failed to load: undefined method `load_dj' for Syck:Module.
Handler: "--- !ruby/object:Delayed::PerformableMethod \nargs: \n- 198\n- 2015-02-25 01:08:41.226804 Z\nmethod_name: :set_favorite_last_accessed\nobject: !ruby/class SegmentReportQueriesController\n"
The text was updated successfully, but these errors were encountered: