meh / ruby-tesseract-ocr

A Ruby wrapper library to the tesseract-ocr API.
629 stars 74 forks source link

I am having an issue using it on heroku #10

Open henrylily120 opened 12 years ago

henrylily120 commented 12 years ago

It works just fine locally, but when I deployed it on heroku, it gave me this error. Any assistance is appreciated.

-11-06T08:47:19+00:00 app[web.1]: [2012-11-06 08:47:19] ERROR SignalException: SIGTERM
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:29:in `<top (required)>'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/tesseract-ocr-0.1.5/lib/tesseract/api.rb:26:in `require'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/tesseract-ocr-0.1.5/lib/tesseract/api.rb:26:in `<top (required)>'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/tesseract-ocr-0.1.5/lib/tesseract-ocr.rb:35:in `require'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/tesseract-ocr-0.1.5/lib/tesseract-ocr.rb:35:in `<top (required)>'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `require'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `each'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `block in require'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `each'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `require'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/bundler-1.2.1/lib/bundler.rb:128:in `require'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/config/application.rb:7:in `<top (required)>'
2012-11-06T08:47:22+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/ffi-inline-0.0.4/lib/ffi/inline/compilers/gcc.rb:29:in `compile': compile error: see logs at /tmp/.ffi-inline-16878/85aad7364f11885370e58c4391df70e29ef22bbe.log (CompilationError)
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:53:in `require'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:53:in `block in <top (required)>'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/ffi-inline-0.0.4/lib/ffi/inline/builders/c.rb:114:in `shared_object'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/ffi-inline-0.0.4/lib/ffi/inline/builders.rb:90:in `block in build'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/ffi-inline-0.0.4/lib/ffi/inline/builders.rb:87:in `instance_eval'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/ffi-inline-0.0.4/lib/ffi/inline/builders.rb:87:in `build'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/ffi-inline-0.0.4/lib/ffi/inline/inline.rb:54:in `singleton_inline'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/ffi-inline-0.0.4/lib/ffi/inline/inline.rb:39:in `inline'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:34:in `<module:C>'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/tesseract-ocr-0.1.5/lib/tesseract/c.rb:31:in `<module:Tesseract>'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:50:in `tap'
2012-11-06T08:47:22+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:50:in `<top (required)>'
2012-11-06T08:47:22+00:00 app[web.1]:   from script/rails:6:in `require'
2012-11-06T08:47:22+00:00 app[web.1]:   from script/rails:6:in `<main>'
2012-11-06T08:47:23+00:00 heroku[web.1]: Process exited with status 1
2012-11-06T08:47:23+00:00 heroku[web.1]: State changed from starting to crashed
2012-11-06T08:47:23+00:00 heroku[web.1]: State changed from crashed to starting
2012-11-06T08:47:29+00:00 heroku[web.1]: Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM
2012-11-06T08:47:29+00:00 heroku[web.1]: Stopping remaining processes with SIGKILL
2012-11-06T08:47:30+00:00 heroku[web.1]: Process exited with status 137
2012-11-06T08:48:30+00:00 heroku[web.1]: State changed from starting to crashed
2012-11-06T08:48:33+00:00 heroku[router]: Error H10 (App crashed) -> GET stark-ocean-3271.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2012-11-06T08:48:34+00:00 heroku[router]: Error H10 (App crashed) -> GET stark-ocean-3271.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=
meh commented 12 years ago

It needs GCC and to compile stuff, I think you can't do that on Heroku.

meh commented 12 years ago

Now that I think of it, it could be an issue with writing to /tmp.

Do you know where you can write temporary files on Heroku?

henrylily120 commented 12 years ago

I tried writing a file to /tmp and it seemed to work fine. Chutikas-MacBook-Pro:think_dirty_rails numnym$ heroku run "cp config.ru /tmp/config.ru | cat /tmp/config.ru" Running cp config.ru /tmp/config.ru | cat /tmp/config.ru attached to terminal... up, run.1

This file is used by Rack-based servers to start the application.

require ::File.expand_path('../config/environment', FILE) run ThinkDirtyRails::Application

GCC is also available on Heroku as well. Chutikas-MacBook-Pro:think_dirty_rails numnym$ heroku run gcc Running gcc attached to terminal... up, run.1 gcc: no input files

I also saw this error message.... You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5

meh commented 12 years ago

It looks like the process has been killed by a supervisor, it could have used too much processor or something like that, you should contact Heroku and ask for clarification.

henrylily120 commented 12 years ago

Have you got any experiences deploying it to another platform like AWS?

meh commented 12 years ago

No, sorry.

henrylily120 commented 12 years ago

Can you please let me know which platforms you had luck with?

Eunoia commented 11 years ago

@henrylily120 Heroku will not let a request run longer than a 30 seconds. You can get around this by pushing your OCR task off a queue like Resque or SideKiq. I ran into a similar issue with running some AI code on Heroku.

Feel free to ask any questions about how to use workers on Heroku.

leoromanovsky commented 10 years ago

@henrylily120 How were you able to get it to run on Heroku?

Eunoia commented 10 years ago

@leoromanovsky Heroku wont let you use tesseract on a web dyno. You will need to use tesseract in a worker dyno.

leoromanovsky commented 10 years ago

@Eunoia Hey yep, I got that part and am ready to use Sidekiq. I'm actually having trouble and running into a compilation error during the deploy. Any guidance there?

Eunoia commented 10 years ago

I sent you an email, lets remember to share the results here.

leoromanovsky commented 10 years ago

@Eunoia and I chatted offline. We tried going back to ffi-inline version 1.9.0 without any luck. The take-away was to try and get my sidekiq workers running on EC2 instead of Heroku.