Heroku app crash : heroku[router]: at=error code=H10 - heroku

I just started a new app on heroku, I used git clone from a running application. I pushed everything up, migrated the db, and restarted heroku. The app still crashes.
heroku logs gives me:
2014-02-27T01:18:25.726069+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=********.herokuapp.com request_id=1ded5a34-7d01-440b-9fb4-0041fdc64715 fwd="75.149.130.1" dyno= connect= service= status=503 bytes=
code=H10 is an "app or dyno crash". The app is running on Thin if that helps.
How do I restart dynos? What can I do to get some more diagnostic info on this?
edit: (more info)
I ran heroku restart thin and immediately ran heroku logs which uncovered this:
ruby: symbol lookup error: /app/vendor/bundle/ruby/2.0.0/gems/eventmachine-1.0.0/lib/rubyeventmachine.so: undefined symbol: rb_enable_interrupt
The app is built on ruby 1.9.2 and rails 3.0.10 so I would assume there is some kind of version issue going on here, but I don't understand it.
This article mentions the same problem with Thin, and recomends not using it. But I have the EXACT same app running fine as another heroku app, and all I've ever used is thin, I really have no idea why this isn't working.
edit 2:
It looks like although my app is built with ruby 1.9.2, heroku is trying to deploy it with ruby 2.0.0. How do I tell it to use 1.9.2? Something in set-up or in my gem/config files?
edit 3: (I think I'm on to something)
running ruby -v yields 1.9.2
running `heroku run "ruby -v" yields 2.0.0
This article says it can be declared in the gemfile. I have a feeling this will fix my problem.

The Heroku ruby buildpack will install the ruby version specified in your Gemfile. Ruby 2.0.0 is the current default ruby.
To configure Ruby 1.9.2 as the version needed for your app, add the following to the top of your Gemfile:
ruby '1.9.2'

Related

What to do if "git push heroku master" failed?

I have a working Rails app on my local Windows XP machine. I want to upload it on Heroku. I follow this tutorial https://devcenter.heroku.com/articles/rails3.
When I ran git push heroku master, it failed:
-----> Ruby/Rails app detected
-----> WARNING: Removing `Gemfile.lock` because it was generated on Windows.
Bundler will do a full resolve so native gems are handled properly.
This may result in unexpected gem versions being used in your app.
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Received disconnect from 50.19.85.132: 10: user closed connection
fatal: The remote end hung up unexpectedly
What do I have to do now?
I saw the log, there are some issues like these ones:
2013-04-28T21:18:03.384881+00:00 app[web.1]: /app/app/assets/images/cards/resize.rb:23:in `open': No such file or directory -
C:\sbox\ruby\cards2 (Errno::ENOENT)
2013-04-28T21:18:03.385662+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:304:in
`wrapped_app'
2013-04-28T21:18:04.689716+00:00 heroku[web.1]: State changed from starting to crashed
2013-04-28T21:18:05.596424+00:00 heroku[web.1]: Process exited with status 1
2013-04-28T21:28:27.556270+00:00 heroku[web.1]: State changed from crashed to starting
2013-04-28T21:28:29.459229+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 3598`
2013-04-28T21:18:03.385424+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/con
figurable.rb:30:in `method_missing'
2013-04-28T21:28:34.613321+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/con
figurable.rb:30:in `method_missing'
I removed resize.rb:23 file. It is for re-sizing images, app doesn't use, I just left it there on development and forgot to delete when uploaded my app on Heroku. On my local machine it is not run by itself, but Heroku for some reason started it. There was a function call to C:\sbox\ruby\cards2 location and that's why the error happened, I thought. Ok, I removed the file. Do not know, though, about other issues.
But what do I need to do now? How to start the process again? I ran git push heroku master again but got:
C:\sbox\ruby\Sites\Heroku\Cards>git push heroku master
Everything up-to-date
Nothing works but Heroku says that everything is up-to-date.
Is there a way to see all my app files on Heroku server the way you can see your files on shared hosting?
Try adding a commit with some small change, like a Readme change or something. It should force heroku to re-deploy your app.

Heroku Rails app R11 error

I'm deploying a Rails 3.2.11 app on Heroku with Thin as my server. When I push to Heroku, it boots Thin just fine, but then it seems to also try to boot WEBrick.
My Procfile is as follows:
web: bundle exec rails server -p $PORT thin -e $RACK_ENV
And my Heroku logs:
2013-04-11T14:52:28.276634+00:00 heroku[api]: Release v21 created by XXXXXX#gmail.com
2013-04-11T14:52:28.331285+00:00 heroku[api]: Deploy 6f63ed4 by XXXXXX#gmail.com
2013-04-11T14:52:28.432372+00:00 heroku[web.1]: State changed from crashed to starting
2013-04-11T14:52:28.965697+00:00 heroku[slugc]: Slug compilation finished
2013-04-11T14:52:30.218480+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 9009 thin -e $RACK_ENV`
2013-04-11T14:52:32.898285+00:00 app[web.1]: DEPRECATION WARNING: 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)
2013-04-11T14:52:32.897830+00:00 app[web.1]: DEPRECATION WARNING: 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)
2013-04-11T14:52:34.350938+00:00 app[web.1]: [2013-04-11 14:52:34] INFO WEBrick::HTTPServer#start: pid=2 port=2010
2013-04-11T14:52:34.350132+00:00 app[web.1]: [2013-04-11 14:52:34] INFO WEBrick 1.3.1
2013-04-11T14:52:34.350707+00:00 app[web.1]: [2013-04-11 14:52:34] WARN TCPServer Error: Address already in use - bind(2)
2013-04-11T14:52:34.350132+00:00 app[web.1]: [2013-04-11 14:52:34] INFO ruby 1.9.2 (2011-07-09) [x86_64-linux]
2013-04-11T14:52:34.407830+00:00 heroku[web.1]: Stopping process with SIGKILL
2013-04-11T14:52:34.407675+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 2010, should be 9009 (see environment variable PORT)
2013-04-11T14:52:35.572955+00:00 heroku[web.1]: State changed from starting to crashed
2013-04-11T14:52:35.560772+00:00 heroku[web.1]: Process exited with status 137
Why is it doing this? What am I missing?
Try using Thin instead of WEBrick. You can do this by simply adding this to your gemfile:
gem 'thin'
Then run bundle install, commit the new Gemfile and Gemfile.lock, then push to Heroku.
WEBrick is not meant for production use.
It turns out that a plugin I was using, SyntaxHighlighter, had some files in its test directory that started WEBrick. I just removed those, committed, pushed, and it worked fine.

Jekyll on Heroku: bundler: command not found: thin

Working from a tutorial at http://mwmanning.com/2011/11/29/Run-Your-Jekyll-Site-On-Heroku.html. When I try to push to heroku I get a "build failed" message in the output.
Heroku logs shows
2013-01-30T05:29:54+00:00 heroku[slugc]: Slug compilation started
2013-01-30T05:31:36+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rack app
2013-01-30T05:31:38+00:00 heroku[web.1]: State changed from crashed to starting
2013-01-30T05:31:51+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -p 14276 -e $RACK_ENV`
2013-01-30T05:31:53+00:00 app[web.1]: bundler: command not found: thin
2013-01-30T05:31:53+00:00 app[web.1]: Install missing gem executables with `bundle install`
2013-01-30T05:31:54+00:00 heroku[web.1]: Process exited with status 1272013-01-30T05:31:54+00:00 heroku[web.1]: State changed from starting to crashed
Gemfile and Gemfile.lock both show that thin is installed.
source :rubygems
gem 'jekyll'
gem 'rdiscount'
gem 'rack-jekyll'
gem 'thin'
gem 'RedCloth'
Command bundle exec thin start works locally and bundle show thin shows that thin is installed specifically for the current gemset.
I can't understand why heroku still says that thin is missing?
For me a local bundle update fixed that problem.
Sorry, not a direct answer. But this method worked for me.
http://chriscontinanza.com/2011/06/15/Jekyll-to-heroku.html

Bundle and Gem Errors when deploying Sinatra app to heroku

UPDATE
I did the following and this is the callstack I am still getting in the logs:
2012-08-06T12:30:57+00:00 heroku[slugc]: Slug compilation finished
2012-08-06T12:30:58+00:00 heroku[web.1]: Starting process with command `bundle exec thin start -R config.ru -e $RACK_ENV -p 56970`
2012-08-06T12:30:59+00:00 app[web.1]: bash: bundle: command not found
2012-08-06T12:31:00+00:00 heroku[web.1]: Process exited with status 127
2012-08-06T12:31:00+00:00 heroku[web.1]: State changed from starting to crashed
2012-08-06T12:31:08+00:00 heroku[router]: Error H10 (App crashed) -> GET arcane-garden-1058.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2012-08-06T12:31:08+00:00 heroku[router]: Error H10 (App crashed) -> GET arcane-garden-1058.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=
2012-08-06T12:31:09+00:00 heroku[router]: Error H10 (App crashed) -> GET arcane-garden-1058.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2012-08-06T12:31:10+00:00 heroku[router]: Error H10 (App crashed) -> GET arcane-garden-1058.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes=
My Procfile file now looks like this:
root: = ::File.dirname(__FILE__)
require: ::File.join( root, 'app' )
web: bundle exec thin start -R config.ru -e $RACK_ENV -p $PORT
run: WPL.new
Gemfile looks like this:
source :rubygems
gem 'thin'
gem 'sinatra'
gem 'shotgun'
gem 'sinatra'
gem 'mongo'
gem 'json'
My app.rb looks like this now:
require 'shotgun'
require 'sinatra'
require 'mongo'
require 'json/pure'
class WPL < Sinatra::Application
db = Mongo::Connection.new.db('docs')
get '/' do
File.read(File.join('public', 'index.html'))
end
end
And config.ru looks like this:
require './app'
run WPL.new
So I'm trying to deploy my app and I've run into several issues. Everything works fine locally. I push the app to heroku and everything seems to be ok but when I check the logs it says it cant find command 'bundle'.
This is what my Procfile looks like.
web: bundle exec ruby app.rb -p $PORT
I tried removing bundle exec and just went with ruby app.rb -p $POST got further in the process but more errors.
The next set of errors I get are all gem related. It simply can't find any of the gems that are required. This is what my app.rb looks like.
require 'shotgun'
require 'sinatra'
require 'mongo'
require 'json/pure'
db = Mongo::Connection.new.db('docs')
get '/' do
File.read(File.join('public', 'index.html'))
end
My Gemfile looks like this.
source :rubygems
gem 'sinatra'
gem 'shotgun'
gem 'sinatra'
gem 'mongo'
gem 'json'
My config.ru looks like this.
require './app'
run Sinatra::Application
Running heroku run console also results in this error bundle: command not found
What am I missing?
Your Procfile is not using your config.ru.
For a Sinatra application, I would use a Procfile that looks something like this:
web: bundle exec thin start -R config.ru -e $RACK_ENV -p $PORT
This similar question might be some help too.
Not sure what happened but I just deleted my app on heroku and created a new one. Then it worked. I think when I created the app originally, heroku thought the app was a node app because I was missing my Procfile.

How to deploy JRuby Rails 3.1.x on Heroku?

I want to be able to deply a jruby rails 3.1 app to Heroku.
Heroku now suports Java: http://blog.heroku.com/archives/2011/08/25/java/
Supposedly, it should be possible to deploy a JRuby rails application.
There's a tutorial here for plain java: http://devcenter.heroku.com/articles/java and another here: http://devcenter.heroku.com/articles/spring-mvc-hibernate
Here's a tutorial for a JRuby Sinatra app on Heroku: http://chris.chowie.net/2011/08/28/Sinatra-with-JRuby-on-Heroku/
In order to get this to work, I had use non-jruby ruby when running heroku, as heroku crashes if rvm uses jruby.
In order to run the command
mvn package
I had to run this:
bundle --gemfile=/home/justin/github/sinatra-jruby-heroku/Jemfile install temple
bundle --gemfile=/home/justin/github/sinatra-jruby-heroku/Jemfile update
I created the app:
heroku create jg1-sinatra --stack cedar
I pushed the file to heroku, but when the app started, it crashed. :(
Any advice? I'm guessing that it won't be long before Heroku has a tutorial on this.
Log file from Heroku:
2011-11-21T08:30:40+00:00 heroku[slugc]: Slug compilation started
2011-11-21T08:31:17+00:00 heroku[api]: Deploy 3bccec5 by justin.gordon#gmail.com
2011-11-21T08:31:17+00:00 heroku[api]: Release v7 created by justin.gordon#gmail.com
2011-11-21T08:31:18+00:00 heroku[web.1]: State changed from crashed to created
2011-11-21T08:31:18+00:00 heroku[slugc]: Slug compilation finished
2011-11-21T08:31:20+00:00 heroku[web.1]: Starting process with command `sh script/jruby -S trinidad -p 17687`
2011-11-21T08:31:20+00:00 app[web.1]: Classpath is: :/app/etc:/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar
2011-11-21T08:31:20+00:00 app[web.1]: Exception in thread "main" java.lang.NoClassDefFoundError: org/jruby/Main
2011-11-21T08:31:20+00:00 app[web.1]: Caused by: java.lang.ClassNotFoundException: org.jruby.Main
2011-11-21T08:31:20+00:00 app[web.1]: at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
2011-11-21T08:31:20+00:00 app[web.1]: at java.security.AccessController.doPrivileged(Native Method)
2011-11-21T08:31:20+00:00 app[web.1]: at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
2011-11-21T08:31:20+00:00 app[web.1]: at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
2011-11-21T08:31:20+00:00 app[web.1]: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
2011-11-21T08:31:20+00:00 app[web.1]: at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
2011-11-21T08:31:20+00:00 app[web.1]: Could not find the main class: org.jruby.Main. Program will exit.
2011-11-21T08:31:20+00:00 heroku[web.1]: Process exited
2011-11-21T08:31:21+00:00 heroku[web.1]: State changed from starting to crashed
As of Bundler 1.2 you are now able to specify the Ruby implementation and version in your Gemfile. The nice thing about this is that Heroku will understand these settings and prepare the your Heroku application for your environment.
Take this Gemfile for example:
source "https://rubygems.org"
ruby "1.9.3"
gem "rails"
gem "puma"
What's cool about this is that by default Celadon Cedar uses Ruby 1.9.2. However, when you specify ruby "1.9.3" in the Gemfile it'll actually compile Ruby 1.9.3 for your Heroku environment.
Now, if you want to add a different Ruby implementation to your Heroku environment, you can do so like this:
source "https://rubygems.org"
ruby "1.9.3", :engine => "jruby", :engine_version => "1.7.0.preview1"
gem "rails"
gem "puma"
Now it'll install and use JRuby 1.7.0.preview1 in Ruby 1.9 mode for your Heroku application upon deployment. It'll also even define the proper JVM options in the Heroku environment variables.
Best of all is that this comes with the official Heroku buildpack, so there is no need to switch to a 3rd party buildpack to get the JRuby/JVM going on Heroku. Although I haven't gotten it to work yet, this should also work with Rubinius, but I believe it's currently bugged. Either that, or I'm doing it wrong.
This is in my opinion an awesome and scalable feature. Just define the Ruby implementation/version/mode you're using in your Gemfile along with your other dependencies and Heroku will ensure the environment is prepared.
You have this line :
Classpath is: :/app/etc:/.m2/repository/org/jruby/jruby-complete/1.6.3/jruby-complete-1.6.3.jar
Seams you have reference to your locale repository somewhere and Heroku of corse don't have it.
I dunno so much about packaging, but may be this reference appear here ?
Check all ref and see packaging options could be a good start ...
Previous hacks for getting JRuby and other non-supported runtimes on Heroku are now obsolete with the availability of third-party buildpacks:
https://devcenter.heroku.com/articles/buildpacks
https://github.com/jruby/heroku-buildpack-jruby

Resources