InvalidAddressError: invalid address when testing rollbar setup - ruby-on-rails

I just setup rollbar within my rails app using the rollbar gem, but when running the rake task to test my setup it gives me this error (backtrace appended below).
Started GET "/verify" for at 2017-11-07 01:29:13 +0100
IPAddr::InvalidAddressError: invalid address
Obviously the address is empty and therefore it makes sense, the address is invalid, but i have no clue why this is the case.
The token is correctly set in the environment and within the rollbar dashboard of this project I even see the failed attempt as error.
Further Info: Rails 4.2.4 on ruby 2.2.3
Here is the backtrace, I'd be really happy for any tips!
from /home/user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/ipaddr.rb:559:in `in6_addr'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/ipaddr.rb:496:in `initialize'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/ipaddr.rb:514:in `new'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/ipaddr.rb:514:in `coerce_other'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/ipaddr.rb:170:in `include?'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/web-console-2.3.0/lib/web_console/whitelist.rb:17:in `block in include?'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/web-console-2.3.0/lib/web_console/whitelist.rb:17:in `any?'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/web-console-2.3.0/lib/web_console/whitelist.rb:17:in `include?'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/web-console-2.3.0/lib/web_console/request.rb:16:in `from_whitelited_ip?'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/web-console-2.3.0/lib/web_console/whiny_request.rb:8:in `from_whitelited_ip?'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/web-console-2.3.0/lib/web_console/middleware.rb:20:in `block in call'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/web-console-2.3.0/lib/web_console/middleware.rb:18:in `catch'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/web-console-2.3.0/lib/web_console/middleware.rb:18:in `call'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/rack/logger.rb:38:in `call_app'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/rack/logger.rb:20:in `block in call'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/tagged_logging.rb:68:in `block in tagged'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/tagged_logging.rb:26:in `tagged'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/tagged_logging.rb:68:in `tagged'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/rack/logger.rb:20:in `call'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/request_id.rb:21:in `call'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/methodoverride.rb:22:in `call'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/runtime.rb:18:in `call'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/lock.rb:17:in `call'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/actionpack-4.2.4/lib/action_dispatch/middleware/static.rb:116:in `call'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rack-1.6.5/lib/rack/sendfile.rb:113:in `call'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:518:in `call'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/application.rb:165:in `call'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rollbar-2.15.5/lib/rollbar/rake_tasks.rb:86:in `block (2 levels) in <top (required)>'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `call'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
from /var/www/project/vendor/bundle/ruby/2.2.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
from /var/www/project/vendor/bundle/ruby/2.2.0/bin/rake:23:in `load'
from /var/www/project/vendor/bundle/ruby/2.2.0/bin/rake:23:in `<top (required)>'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/cli/exec.rb:74:in `load'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/cli/exec.rb:74:in `kernel_load'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/cli/exec.rb:27:in `run'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/cli.rb:335:in `exec'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/cli.rb:20:in `dispatch'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/cli.rb:11:in `start'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/exe/bundle:32:in `block in <top (required)>'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
from /home/user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.14.3/exe/bundle:24:in `<top (required)>'
from /home/user/.rbenv/versions/2.2.3/bin/bundle:23:in `load'
from /home/user/.rbenv/versions/2.2.3/bin/bundle:23:in `<main>'

I just ran into this myself. It seems to be a semi-known issue with Rollbar: https://github.com/rollbar/rollbar-gem/issues/541. I can confirm that removing the web-console gem (which I wasn't using anyway) from my Gemfile fixed the problem for me.

Related

Ruby on Rails Application Not Deploying

I'm trying to deploy a Ruby on Rails application using a preconfigured image provided by Digital Ocean for RoR applications. However, I'm getting an error as shown below:
Puma caught this error: uninitialized constant ActionText::Engine::ApplicationController (NameError)
/home/rails/.rvm/gems/ruby-2.6.5/gems/actiontext-6.0.2.1/lib/action_text/engine.rb:43:in `block (2 levels) in <class:Engine>'
/home/rails/.rvm/gems/ruby-2.6.5/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:429:in `instance_exec'
/home/rails/.rvm/gems/ruby-2.6.5/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:429:in `block in make_lambda'
/home/rails/.rvm/gems/ruby-2.6.5/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:201:in `block (2 levels) in halting'
/home/rails/.rvm/gems/ruby-2.6.5/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:607:in `block (2 levels) in default_terminator'
/home/rails/.rvm/gems/ruby-2.6.5/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:606:in `catch'
/home/rails/.rvm/gems/ruby-2.6.5/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:606:in `block in default_terminator'
/home/rails/.rvm/gems/ruby-2.6.5/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:202:in `block in halting'
/home/rails/.rvm/gems/ruby-2.6.5/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:514:in `block in invoke_before'
/home/rails/.rvm/gems/ruby-2.6.5/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:514:in `each'
/home/rails/.rvm/gems/ruby-2.6.5/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:514:in `invoke_before'
/home/rails/.rvm/gems/ruby-2.6.5/gems/activesupport-6.0.2.1/lib/active_support/callbacks.rb:134:in `run_callbacks'
/home/rails/.rvm/gems/ruby-2.6.5/gems/activesupport-6.0.2.1/lib/active_support/execution_wrapper.rb:119:in `complete!'
/home/rails/.rvm/gems/ruby-2.6.5/gems/activesupport-6.0.2.1/lib/active_support/execution_wrapper.rb:76:in `ensure in block in run!'
/home/rails/.rvm/gems/ruby-2.6.5/gems/activesupport-6.0.2.1/lib/active_support/execution_wrapper.rb:76:in `block in run!'
/home/rails/.rvm/gems/ruby-2.6.5/gems/activesupport-6.0.2.1/lib/active_support/execution_wrapper.rb:70:in `tap'
/home/rails/.rvm/gems/ruby-2.6.5/gems/activesupport-6.0.2.1/lib/active_support/execution_wrapper.rb:70:in `run!'
/home/rails/.rvm/gems/ruby-2.6.5/gems/actionpack-6.0.2.1/lib/action_dispatch/middleware/executor.rb:12:in `call'
/home/rails/.rvm/gems/ruby-2.6.5/gems/actionpack-6.0.2.1/lib/action_dispatch/middleware/static.rb:126:in `call'
/home/rails/.rvm/gems/ruby-2.6.5/gems/rack-2.2.2/lib/rack/sendfile.rb:110:in `call'
/home/rails/.rvm/gems/ruby-2.6.5/gems/actionpack-6.0.2.1/lib/action_dispatch/middleware/host_authorization.rb:83:in `call'
/home/rails/.rvm/gems/ruby-2.6.5/gems/webpacker-4.2.2/lib/webpacker/dev_server_proxy.rb:23:in `perform_request'
/home/rails/.rvm/gems/ruby-2.6.5/gems/rack-proxy-0.6.5/lib/rack/proxy.rb:57:in `call'
/home/rails/.rvm/gems/ruby-2.6.5/gems/railties-6.0.2.1/lib/rails/engine.rb:526:in `call'
/home/rails/.rvm/gems/ruby-2.6.5/gems/puma-4.3.3/lib/puma/configuration.rb:228:in `call'
/home/rails/.rvm/gems/ruby-2.6.5/gems/puma-4.3.3/lib/puma/server.rb:682:in `handle_request'
/home/rails/.rvm/gems/ruby-2.6.5/gems/puma-4.3.3/lib/puma/server.rb:472:in `process_client'
/home/rails/.rvm/gems/ruby-2.6.5/gems/puma-4.3.3/lib/puma/server.rb:328:in `block in run'
According to what I've read, the solution is to make sure that the application_controller.rb file exists. However, it does exist.

'delayed_jobs' gem not migrating on heroku

Please see update at bottom
I'm trying to use the 'delayed_jobs' gem in my project. I got everything working in my local environment, however when I moved the project to production on Heroku I was unable to 'rake db:migrate', and am not able to get my server started. Here are the steps I followed.
*Run bundle_install with 'delayed_job' and 'delayed_job_active_record' in my gem file
*I did not run 'ails generate delayed_job:active_record' as the migration file was moved to the server from when I ran 'ails generate delayed_job:active_record' in DEV
*I ran rake db:migrate and it failed with the following error, not sure how to fix. (Note: It appears that the migration is failing due to the table not existing, which is a big issue as I need to run the migration to create the table).
[?25l[?25hUnable to write PID file to /app/tmp/pids/delayed_job.pid
[ActiveJob] Enqueued SquareOrderCleanupJob (Job ID: c364f5c1-a3c3-401a-95a6-a567a2813942) to DelayedJob(default) at 2016-06-04 14:57:56 UTC
[ActiveJob] Mysql2::Error: Table 'heroku_fc2daea183dcdd6.delayed_jobs' doesn't exist: SHOW FULL FIELDS FROM `delayed_jobs`
rake aborted!
ActiveRecord::StatementInvalid: Mysql2::Error: Table 'heroku_fc2daea183dcdd6.delayed_jobs' doesn't exist: SHOW FULL FIELDS FROM `delayed_jobs`
/app/vendor/bundle/ruby/2.2.0/gems/mysql2-0.3.21/lib/mysql2/client.rb:80:in `_query'
/app/vendor/bundle/ruby/2.2.0/gems/mysql2-0.3.21/lib/mysql2/client.rb:80:in `block in query'
/app/vendor/bundle/ruby/2.2.0/gems/mysql2-0.3.21/lib/mysql2/client.rb:79:in `handle_interrupt'
/app/vendor/bundle/ruby/2.2.0/gems/mysql2-0.3.21/lib/mysql2/client.rb:79:in `query'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:305:in `block in execute'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:473:in `block in log'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:467:in `log'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:305:in `execute'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/mysql2_adapter.rb:231:in `execute'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:312:in `execute_and_free'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:457:in `columns'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/schema_cache.rb:43:in `columns'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/attributes.rb:93:in `columns'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/attributes.rb:98:in `columns_hash'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/inheritance.rb:205:in `subclass_from_attributes?'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/inheritance.rb:54:in `new'
/app/vendor/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/backend/base.rb:16:in `enqueue_job'
/app/vendor/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/backend/base.rb:12:in `enqueue'
/app/vendor/bundle/ruby/2.2.0/gems/activejob-4.2.3/lib/active_job/queue_adapters/delayed_job_adapter.rb:22:in `enqueue_at'
/app/vendor/bundle/ruby/2.2.0/gems/activejob-4.2.3/lib/active_job/enqueuing.rb:69:in `block in enqueue'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:115:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:115:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:553:in `block (2 levels) in compile'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:503:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:503:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:496:in `block (2 levels) in around'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:341:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:341:in `block (2 levels) in simple'
/app/vendor/bundle/ruby/2.2.0/gems/activejob-4.2.3/lib/active_job/logging.rb:14:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activejob-4.2.3/lib/active_job/logging.rb:14:in `block (3 levels) in '
/app/vendor/bundle/ruby/2.2.0/gems/activejob-4.2.3/lib/active_job/logging.rb:43:in `block in tag_logger'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `block in tagged'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:26:in `tagged'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `tagged'
/app/vendor/bundle/ruby/2.2.0/gems/activejob-4.2.3/lib/active_job/logging.rb:43:in `tag_logger'
/app/vendor/bundle/ruby/2.2.0/gems/activejob-4.2.3/lib/active_job/logging.rb:13:in `block (2 levels) in '
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:439:in `instance_exec'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:439:in `block in make_lambda'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:340:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:340:in `block in simple'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:495:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:495:in `block in around'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:503:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:503:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:88:in `run_callbacks'
/app/vendor/bundle/ruby/2.2.0/gems/activejob-4.2.3/lib/active_job/enqueuing.rb:67:in `enqueue'
/app/vendor/bundle/ruby/2.2.0/gems/activejob-4.2.3/lib/active_job/configured_job.rb:13:in `perform_later'
/app/config/initializers/schedule_jobs.rb:2:in `'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `block in load'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/engine.rb:652:in `block in load_config_initializer'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/notifications.rb:166:in `instrument'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/engine.rb:651:in `load_config_initializer'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/engine.rb:616:in `block (2 levels) in '
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/engine.rb:615:in `each'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/engine.rb:615:in `block in '
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `instance_exec'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `run'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:44:in `each'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:44:in `tsort_each_child'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:44:in `each'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:44:in `tsort_each_child'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:54:in `run_initializers'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/application.rb:352:in `initialize!'
/app/config/environment.rb:5:in `'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/application.rb:328:in `require_environment!'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/application.rb:457:in `block in run_tasks_blocks'
Mysql2::Error: Table 'heroku_fc2daea183dcdd6.delayed_jobs' doesn't exist
/app/vendor/bundle/ruby/2.2.0/gems/mysql2-0.3.21/lib/mysql2/client.rb:80:in `_query'
/app/vendor/bundle/ruby/2.2.0/gems/mysql2-0.3.21/lib/mysql2/client.rb:80:in `block in query'
/app/vendor/bundle/ruby/2.2.0/gems/mysql2-0.3.21/lib/mysql2/client.rb:79:in `handle_interrupt'
/app/vendor/bundle/ruby/2.2.0/gems/mysql2-0.3.21/lib/mysql2/client.rb:79:in `query'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:305:in `block in execute'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:473:in `block in log'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:467:in `log'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:305:in `execute'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/mysql2_adapter.rb:231:in `execute'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:312:in `execute_and_free'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:457:in `columns'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/schema_cache.rb:43:in `columns'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/attributes.rb:93:in `columns'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/attributes.rb:98:in `columns_hash'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/inheritance.rb:205:in `subclass_from_attributes?'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/inheritance.rb:54:in `new'
/app/vendor/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/backend/base.rb:16:in `enqueue_job'
/app/vendor/bundle/ruby/2.2.0/gems/delayed_job-4.1.2/lib/delayed/backend/base.rb:12:in `enqueue'
/app/vendor/bundle/ruby/2.2.0/gems/activejob-4.2.3/lib/active_job/queue_adapters/delayed_job_adapter.rb:22:in `enqueue_at'
/app/vendor/bundle/ruby/2.2.0/gems/activejob-4.2.3/lib/active_job/enqueuing.rb:69:in `block in enqueue'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:115:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:115:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:553:in `block (2 levels) in compile'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:503:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:503:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:496:in `block (2 levels) in around'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:341:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:341:in `block (2 levels) in simple'
/app/vendor/bundle/ruby/2.2.0/gems/activejob-4.2.3/lib/active_job/logging.rb:14:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activejob-4.2.3/lib/active_job/logging.rb:14:in `block (3 levels) in '
/app/vendor/bundle/ruby/2.2.0/gems/activejob-4.2.3/lib/active_job/logging.rb:43:in `block in tag_logger'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `block in tagged'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:26:in `tagged'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `tagged'
/app/vendor/bundle/ruby/2.2.0/gems/activejob-4.2.3/lib/active_job/logging.rb:43:in `tag_logger'
/app/vendor/bundle/ruby/2.2.0/gems/activejob-4.2.3/lib/active_job/logging.rb:13:in `block (2 levels) in '
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:439:in `instance_exec'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:439:in `block in make_lambda'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:340:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:340:in `block in simple'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:495:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:495:in `block in around'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:503:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:503:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:88:in `run_callbacks'
/app/vendor/bundle/ruby/2.2.0/gems/activejob-4.2.3/lib/active_job/enqueuing.rb:67:in `enqueue'
/app/vendor/bundle/ruby/2.2.0/gems/activejob-4.2.3/lib/active_job/configured_job.rb:13:in `perform_later'
/app/config/initializers/schedule_jobs.rb:2:in `'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `block in load'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/engine.rb:652:in `block in load_config_initializer'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/notifications.rb:166:in `instrument'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/engine.rb:651:in `load_config_initializer'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/engine.rb:616:in `block (2 levels) in '
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/engine.rb:615:in `each'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/engine.rb:615:in `block in '
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `instance_exec'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `run'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:44:in `each'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:44:in `tsort_each_child'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:44:in `each'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:44:in `tsort_each_child'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:54:in `run_initializers'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/application.rb:352:in `initialize!'
/app/config/environment.rb:5:in `'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/application.rb:328:in `require_environment!'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.3/lib/rails/application.rb:457:in `block in run_tasks_blocks'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
[?25h
UPDATE
I figured out the problem was caused by executing the following code at the initialization of my rails app. I was able to get the migration to work by temporarily removing it, and then adding it back in after the migration was complete (the code require the migration to be run before it was run). This is a temporary patch so I am going to work on getting a better solution for future PROD pushes. I'm thinking I can find a way to check if the table exists before running the code, but if anyone knows of a better way please let me know.
system("ruby lib/background_job start")
SquareOrderCleanupJob.set(wait: 10.minute).perform_later()
at_exit do
system("ruby lib/background_job stop")
end
You can check if a table exists, and therefore if migrations have been run:
ActiveRecord::Base.connection.table_exists? 'table_name'
That answer is also in SO here.

Trouble installing Devise

I am using rails for a quick project. I try to run rake:db migrate after rails g devise User on the command line and I get this error log:
Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/devise-3.3.0/lib/devise/rails/routes.rb:457:in `ensure in with_devise_exclusive_scope': undefined method `merge!' for #<ActionDispatch::Routing::Mapper::Scope:0x007fcbe5e766f8> (NoMethodError)
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/devise-3.3.0/lib/devise/rails/routes.rb:457:in `with_devise_exclusive_scope'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/devise-3.3.0/lib/devise/rails/routes.rb:248:in `block (2 levels) in devise_for'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/devise-3.3.0/lib/devise/rails/routes.rb:351:in `block in devise_scope'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/mapper.rb:940:in `block in constraints'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/mapper.rb:816:in `scope'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/mapper.rb:940:in `constraints'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/devise-3.3.0/lib/devise/rails/routes.rb:350:in `devise_scope'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/devise-3.3.0/lib/devise/rails/routes.rb:247:in `block in devise_for'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/devise-3.3.0/lib/devise/rails/routes.rb:223:in `each'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/devise-3.3.0/lib/devise/rails/routes.rb:223:in `devise_for'
from /Users/ashleighalmeida/Rails-Blog/config/routes.rb:3:in `block in <top (required)>'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:432:in `instance_exec'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:432:in `eval_block'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:410:in `draw'
from /Users/ashleighalmeida/Rails-Blog/config/routes.rb:1:in `<top (required)>'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `block in load'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:in `each'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/file_update_checker.rb:75:in `call'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/file_update_checker.rb:75:in `execute'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:7:in `execute'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-4.2.1/lib/rails/application/finisher.rb:81:in `block (2 levels) in <module:Finisher>'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:446:in `instance_exec'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:446:in `block in make_lambda'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:192:in `call'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:192:in `block in simple'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:504:in `call'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:504:in `block in call'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:504:in `each'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:504:in `call'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:92:in `_run_callbacks'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_prepare_callbacks'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/reloader.rb:83:in `prepare!'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/reloader.rb:55:in `prepare!'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/spring-1.3.6/lib/spring/application.rb:153:in `serve'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/spring-1.3.6/lib/spring/application.rb:131:in `block in run'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/spring-1.3.6/lib/spring/application.rb:125:in `loop'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/spring-1.3.6/lib/spring/application.rb:125:in `run'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/spring-1.3.6/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/ashleighalmeida/.rbenv/versions/2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
I configured it in enviornment.rb, added my alerts, what could be the problem?
There is a bug in this version of Devise with Rails. You can update to a newer version.
This should help you to solve the problem.
That's because you hadn't properly installed Devise when you generated the User model.
To resolve this problem, run this command
rails g devise:install

Delayed Jobs failing in production on the server

All my delayed jobs are failing for no apparent reason in production on the server. I tried restarting, removing all previous jobs and again starting the job worker, but nothing worked.
Suspecting it must be a capistrano issue, I manually ran rake jobs:work via ssh on the server but I got the same error:
ubuntu#ip-172-31-35-0:~/apps/instano-api/current$ rake jobs:work
[Worker(host:ip-172-31-35-0 pid:22174)] Starting job worker
[Worker(host:ip-172-31-35-0 pid:22174)] Job InstanoMailer.new_quote (id=73) RUNNING
[Worker(host:ip-172-31-35-0 pid:22174)] Job InstanoMailer.new_quote (id=73) FAILED (3 prior attempts) with NameError: undefined method `error' for class `Class'
I use ExceptionNotifier gem, from which I got the following stack trace (but none of the lines are from my application code):
A NameError occurred in background at 2014-12-17 02:43:21 +0530 :
undefined method `error' for class `Class'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/performable_method.rb:7:in `method'
-------------------------------
Backtrace:
-------------------------------
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/performable_method.rb:7:in `method'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/performable_method.rb:7:in `method'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/backend/base.rb:113:in `hook'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/backend/base.rb:97:in `rescue in block in invoke_job'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/backend/base.rb:101:in `block in invoke_job'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:61:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:61:in `block in initialize'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:66:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:66:in `execute'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/backend/base.rb:91:in `invoke_job'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:199:in `block (2 levels) in run'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/timeout.rb:82:in `block in timeout'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/timeout.rb:70:in `catch'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/timeout.rb:70:in `timeout'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:199:in `block in run'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:198:in `run'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:275:in `block in reserve_and_run_one_job'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:61:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:61:in `block in initialize'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:66:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:66:in `execute'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:275:in `reserve_and_run_one_job'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:182:in `block in work_off'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:181:in `times'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:181:in `work_off'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:146:in `block (4 levels) in start'
/home/ubuntu/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:145:in `block (3 levels) in start'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:61:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:61:in `block in initialize'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:66:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:66:in `execute'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:144:in `block (2 levels) in start'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:143:in `loop'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:143:in `block in start'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/plugins/clear_locks.rb:7:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:79:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:79:in `block (2 levels) in add'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:61:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:61:in `block in initialize'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:79:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:79:in `block in add'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:66:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:66:in `execute'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/worker.rb:142:in `start'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/command.rb:124:in `run'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/command.rb:112:in `block in run_process'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons/application.rb:255:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons/application.rb:255:in `block in start_proc'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons/daemonize.rb:82:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons/daemonize.rb:82:in `call_as_daemon'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons/application.rb:259:in `start_proc'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons/application.rb:296:in `start'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons/controller.rb:70:in `run'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons.rb:197:in `block in run_proc'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons/cmdline.rb:109:in `call'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons/cmdline.rb:109:in `catch_exceptions'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/daemons-1.1.9/lib/daemons.rb:196:in `run_proc'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/command.rb:110:in `run_process'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/command.rb:91:in `block in daemonize'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/command.rb:89:in `times'
/home/ubuntu/.rvm/gems/ruby-2.1.0/gems/delayed_job-4.0.4/lib/delayed/command.rb:89:in `daemonize'
bin/delayed_job:5:in `<main>'
-------------------------------
Data:
-------------------------------
* data: {}
This seems to be a feature limitation in Delayed Job. Errors are not reported properly. The trace and error message is completely incorrect.
I debugged mine by looking at the rails production log. It was hard to find because there was no error while adding the task to delayed job i.e. I was getting a [INFO] tag instead of [ERROR] in logs.
I hope someone points out how to get proper and meaningful stack traces in case of failed Delayed Jobs.
As a footnote, my error was a real specific (and lame) one. My smtp settings in /config/environments/production.rb was incompatible my mailer so I was getting this error only in production.

Dalayed Job execution expired on sending email

I'm using Delayed Job gem to dispatch emails using Amazon SES. However it runs occasionally into execution expired error. Probably some connection issues to SES. I'm wondering how can I catch this exception and re-schedule the email manually? Due to internal reasons Delayed Job is configured to single max attempt
| execution expired
/usr/local/lib/ruby/2.0.0/net/smtp.rb:540:in `initialize'
/usr/local/lib/ruby/2.0.0/net/smtp.rb:540:in `open'
/usr/local/lib/ruby/2.0.0/net/smtp.rb:540:in `tcp_socket'
/usr/local/lib/ruby/2.0.0/net/smtp.rb:550:in `block in do_start'
/usr/local/lib/ruby/2.0.0/net/smtp.rb:549:in `do_start'
/usr/local/lib/ruby/2.0.0/net/smtp.rb:519:in `start'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/mail-2.5.4/lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/mail-2.5.4/lib/mail/message.rb:2129:in `do_delivery'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/mail-2.5.4/lib/mail/message.rb:232:in `block in deliver'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/actionmailer-4.0.0/lib/action_mailer/base.rb:456:in `block in deliver_mail'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `block in instrument'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `instrument'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/actionmailer-4.0.0/lib/action_mailer/base.rb:454:in `deliver_mail'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/mail-2.5.4/lib/mail/message.rb:232:in `deliver'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/performable_mailer.rb:6:in `perform'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/backend/base.rb:105:in `block in invoke_job'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:60:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:60:in `block in initialize'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:65:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:65:in `execute'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/backend/base.rb:102:in `invoke_job'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:206:in `block (2 levels) in run'
/usr/local/lib/ruby/2.0.0/timeout.rb:66:in `timeout'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:206:in `block in run'
/usr/local/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:205:in `run'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:267:in `block in reserve_and_run_one_job'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:60:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:60:in `block in initialize'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:65:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:65:in `execute'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:267:in `reserve_and_run_one_job'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:189:in `block in work_off'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:188:in `times'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:188:in `work_off'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:153:in `block (4 levels) in start'
/usr/local/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:152:in `block (3 levels) in start'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:60:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:60:in `block in initialize'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:65:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:65:in `execute'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:151:in `block (2 levels) in start'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:150:in `loop'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:150:in `block in start'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/plugins/clear_locks.rb:7:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:78:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:78:in `block (2 levels) in add'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:60:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:60:in `block in initialize'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:78:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:78:in `block in add'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:65:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:65:in `execute'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:149:in `start'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/command.rb:104:in `run'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/command.rb:92:in `block in run_process'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/application.rb:255:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/application.rb:255:in `block in start_proc'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/daemonize.rb:82:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/daemonize.rb:82:in `call_as_daemon'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/application.rb:259:in `start_proc'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/application.rb:296:in `start'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/application_group.rb:159:in `block (2 levels) in start_all'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/application_group.rb:158:in `fork'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/application_group.rb:158:in `block in start_all'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/application_group.rb:157:in `each'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/application_group.rb:157:in `start_all'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/controller.rb:80:in `run'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons.rb:197:in `block in run_proc'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/cmdline.rb:109:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/cmdline.rb:109:in `catch_exceptions'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons.rb:196:in `run_proc'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/command.rb:90:in `run_process'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/command.rb:83:in `block in daemonize'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/command.rb:81:in `times'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/command.rb:81:in `daemonize'
/home/ubuntu/www/tf/current/bin/delayed_job:5:in `<main>'
delayed_job provides some hooks, you can use the error hook to rescheduled the task.
def error(job, exception)
# if exception is the one occurring right now for expired execution
# reschedule the job
# be careful to avoid infinite rescheduling
end

Resources