delayed_job: SystemStackError, stack level too deep

With latest RVM, Ruby 1.9.2, delayed_job_active_record (0.3.2), Rails 3.2.0, pow (or webrick/thin);

I get “stack level too deep” error with notifier.

Notifier.delay(queue: "invitation").invitation(email, name)

Any suggestions?

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 18

Most upvoted comments

This should be written in bold:

If you have an #enqueue method in your job model, you’ll get this error

Quick fix: just add encode_with with empty method body for Mailer, that psych will know how to serialize Mailer class.

class Mailer
...
  def encode_with coder
  end
...
end

Problem lines which hide this bug by ‘stack too deep’ in https://github.com/collectiveidea/delayed_job/blob/master/lib/delayed/yaml_ext.rb#L5 so line with:

require File.expand_path('../psych_ext', __FILE__)

is never calls but it’s needed when to_yaml use psych engine as default.

UPD.: In my dependency was systemu, which reverting YAML engine to psych after DelayedJobs required with ‘syck’ engine, so yaml_ext works correctly, just my bad with my dependencies:

carrierwave_direct => uuid => macaddr => systemu.