"Failed to execute" error when running on a heroku worker via delayed_job
agbodike opened this issue · 1 comments
agbodike commented
I have a problem that is specific to heroku workers using delayed job.
I'm able to generate PDFs for download with no problem using the existing configuration, but when generating the PDF on a heroku worker I'm getting the following errors:
below are partial stack traces from two different methods being used with delayed jobs
Failed to execute:
["/app/vendor/bundle/ruby/2.3.0/gems/wkhtmltopdf-heroku-2.12.3.0/bin/wkhtmltopdf-linux-amd64", "-q", "file:////tmp/wicked_pdf20161017-3-1inanjm.html", "/tmp/wicked_pdf_generated_file20161017-3-1ezw2jg.pdf"]+
Error: PDF could not be generated!
Command Error:
/app/vendor/bundle/ruby/2.3.0/gems/wicked_pdf-1.1.0/lib/wicked_pdf.rb:91:in `rescue in pdf_from_url'
/app/vendor/bundle/ruby/2.3.0/gems/wicked_pdf-1.1.0/lib/wicked_pdf.rb:94:in `pdf_from_url'
/app/vendor/bundle/ruby/2.3.0/gems/wicked_pdf-1.1.0/lib/wicked_pdf.rb:49:in `pdf_from_html_file'
/app/vendor/bundle/ruby/2.3.0/gems/wicked_pdf-1.1.0/lib/wicked_pdf.rb:60:in `pdf_from_string'
/app/lib/modules/operate_pdf.rb:26:in `block in generate'
/app/lib/modules/operate_pdf.rb:25:in `open'
/app/lib/modules/operate_pdf.rb:25:in `generate'
/app/lib/modules/operate_pdf.rb:39:in `generate_for_participants'
/app/lib/modules/operate_pdf.rb:32:in `generate_and_send_mail_for_participants'
/app/vendor/bundle/ruby/2.3.0/gems/delayed_job-4.0.6/lib/delayed/performable_method.rb:30:in `perform'
/app/vendor/bundle/ruby/2.3.0/gems/delayed_job-4.0.6/lib/delayed/backend/base.rb:94:in `block in invoke_job'
/app/vendor/bundle/ruby/2.3.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:61:in `block in initialize'
/app/vendor/bundle/ruby/2.3.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:66:in `execute'
/app/vendor/bundle/ruby/2.3.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/app/vendor/bundle/ruby/2.3.0/gems/delayed_job-4.0.6/lib/delayed/backend/base.rb:91:in `invoke_job'
/app/vendor/bundle/ruby/2.3.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:204:in `block (2 levels) in run'
/app/vendor/ruby-2.3.1/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'
/app/vendor/ruby-2.3.1/lib/ruby/2.3.0/timeout.rb:101:in `timeout'
/app/vendor/bundle/ruby/2.3.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:204:in `block in run'
/app/vendor/ruby-2.3.1/lib/ruby/2.3.0/benchmark.rb:308:in `realtime'
...
Failed to execute:
["/app/vendor/bundle/ruby/2.3.0/gems/wkhtmltopdf-heroku-2.12.3.0/bin/wkhtmltopdf-linux-amd64", "-q", "file:////tmp/wicked_pdf20161018-3-1uefq57.html", "/tmp/wicked_pdf_generated_file20161018-3-1745hbp.pdf"]+
Error: PDF could not be generated!
Command Error:
/app/vendor/bundle/ruby/2.3.0/gems/wicked_pdf-1.1.0/lib/wicked_pdf.rb:91:in `rescue in pdf_from_url'
/app/vendor/bundle/ruby/2.3.0/gems/wicked_pdf-1.1.0/lib/wicked_pdf.rb:94:in `pdf_from_url'
/app/vendor/bundle/ruby/2.3.0/gems/wicked_pdf-1.1.0/lib/wicked_pdf.rb:49:in `pdf_from_html_file'
/app/vendor/bundle/ruby/2.3.0/gems/wicked_pdf-1.1.0/lib/wicked_pdf.rb:60:in `pdf_from_string'
/app/lib/modules/operate_pdf.rb:46:in `block in generate_for_ats'
/app/lib/modules/operate_pdf.rb:45:in `open'
/app/lib/modules/operate_pdf.rb:45:in `generate_for_ats'
/app/app/models/icims_workflow.rb:29:in `complete'
/app/app/models/participant.rb:196:in `block in notify_ats_completed'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.1.16/lib/active_record/relation/delegation.rb:46:in `each'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.1.16/lib/active_record/relation/delegation.rb:46:in `each'
...
agbodike commented
Turns out is was running out of memory on the dyno. The worker was a lower class than the web dyno, which is why it worked on download attempts.