Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Asset compilation issue on Heroku #9

Closed
kjohnston opened this Issue · 13 comments

5 participants

@kjohnston

Upon adding the gem and deploying to Heroku's Cedar stack, asset compilation fails. After a few minutes it times out and leaves behind the following tidbits:

/app/slug-compiler/lib/utils.rb:65:in `block (2 levels) in spawn': command='/app/slug-compiler/lib/../buildpacks/ruby/bin/compile /tmp/build_28buf55d2o6q2 /app/tmp/repo.git/.cache' exit_status=0 out='' at=timeout elapsed=538.774163722992 (Utils::TimeoutError)

...

Heroku push rejected, failed to compile Ruby/rails app
@joliss
Owner

I'm deploying an app to Heroku with jquery-ui-rails myself, and it's working fine for me, so I'd need some more info on how to reproduce it.

Since there are a lot of things that can go wrong with Heroku: Could this be a transient glitch (related to today's outage)? Or if not, are you 100% sure that the only thing you're changing is the one gem 'jquery-ui-rails' line?

If you still think it's jquery-ui-rails, could you try and provide some more info (a) about your app and (b) about the error message (more log output, etc.)?

@kjohnston

Heroku seems to have stopped timing out, instead it just sits there indefinitely now, so this could be related to their outage, but I'm not sure. When I remove the gem it deploys just fine, re-adding the gem breaks every time. Since it doesn't timeout I'm unable to post any additional logging, although it appeared totally useless which is why I omitted it above.

Digging a little deeper, I replicated the gem's vendor/assets content to my app, along with the "all" inclusions in my js and css manifests and was able to reproduce the problem upon pushing to Heroku.

Here's the strange part: I then replaced the contents of vendor/assets/javascripts with a single jquery-ui file from jquery.ui.com and was able to successfully push to Heroku.

This is on the Cedar stack using Ruby 1.9.3.

@joliss
Owner

Weird. I can't reproduce it with my Solitr app on Cedar, even with Ruby 1.9.3. Heroku's precompiling my assets at deploy time too.

Just to make sure, have all the different log types on https://devcenter.heroku.com/articles/logging not returned any helpful error messages at all?

@kjohnston

Sorry for the delay in writing back. I just re-attempted the addition of the gem and it continues to break slug compilation, but Heroku is spitting out the timeout error once again:

    -----> Heroku receiving push
    -----> Ruby/Rails app detected
    -----> Using Ruby version: ruby-1.9.3
    -----> Installing dependencies using Bundler version 1.2.0.pre
           Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
           Fetching gem metadata from http://rubygems.org/......
           Using rake (0.9.2.2)
           Using i18n (0.6.0)
           Using multi_json (1.3.4)
           Using activesupport (3.2.3)
           Using builder (3.0.0)
           Using activemodel (3.2.3)
           Using erubis (2.7.0)
           Using journey (1.0.3)
           Using rack (1.4.1)
           Using rack-cache (1.2)
           Using rack-test (0.6.1)
           Using hike (1.2.1)
           Using tilt (1.3.3)
           Using sprockets (2.1.3)
           Using actionpack (3.2.3)
           Using mime-types (1.18)
           Using polyglot (0.3.3)
           Using treetop (1.4.10)
           Using mail (2.4.4)
           Using actionmailer (3.2.3)
           Using arel (3.0.2)
           Using tzinfo (0.3.33)
           Using activerecord (3.2.3)
           Using activeresource (3.2.3)
           Using bcrypt-ruby (3.0.1)
           Using carmen (0.2.13)
           Using carrierwave (0.6.2)
           Using chronic (0.6.7)
           Using coffee-script-source (1.3.1)
           Using execjs (1.3.2)
           Using coffee-script (2.2.0)
           Using rack-ssl (1.3.2)
           Using json (1.7.1)
           Using rdoc (3.12)
           Using thor (0.14.6)
           Using railties (3.2.3)
           Using coffee-rails (3.2.2)
           Using daemons (1.1.8)
           Using orm_adapter (0.0.7)
           Using warden (1.1.1)
           Using devise (2.0.4)
           Using eventmachine (0.12.10)
           Using exception_notification_rails3 (1.2.0)
           Using excon (0.13.4)
           Using formatador (0.2.3)
           Using jruby-pageant (1.0.2)
           Using net-ssh (2.5.1)
           Using net-scp (1.0.4)
           Using nokogiri (1.5.2)
           Using ruby-hmac (0.4.0)
           Using fog (1.3.1)
           Using friendly_id (4.0.5)
           Using jquery-rails (2.0.2)
           Installing jquery-ui-rails (1.0.0)
           Using modui-rails (0.0.1)
           Using money (5.0.0)
           Using pg (0.13.2)
           Using bundler (1.2.0.pre)
           Using rails (3.2.3)
           Using redcarpet (2.1.1)
           Using remotipart (1.0.2)
           Using rest-client (1.6.7)
           Using rmagick (2.13.1)
           Using sass (3.1.17)
           Using sass-rails (3.2.5)
           Using stripe (1.7.0)
           Using thin (1.3.1)
           Using uglifier (1.2.4)
           Your bundle is complete! It was installed into ./vendor/bundle
           Cleaning up the bundler cache.
    -----> Writing config/database.yml to read from DATABASE_URL
    -----> Preparing app for Rails asset pipeline
           Running: rake assets:precompile
    /app/slug-compiler/lib/utils.rb:65:in `block (2 levels) in spawn': command='/app/slug-compiler/lib/../buildpacks/ruby/bin/compile /tmp/build_tzerze2u2qp1 /app/tmp/repo.git/.cache' exit_status=0 out='' at=timeout elapsed=574.1381464004517 (Utils::TimeoutError)
        from /app/slug-compiler/lib/utils.rb:51:in `loop'
        from /app/slug-compiler/lib/utils.rb:51:in `block in spawn'
        from /app/slug-compiler/lib/utils.rb:47:in `popen'
        from /app/slug-compiler/lib/utils.rb:47:in `spawn'
        from /app/slug-compiler/lib/buildpack.rb:35:in `block in compile'
        from /app/slug-compiler/lib/buildpack.rb:33:in `fork'
        from /app/slug-compiler/lib/buildpack.rb:33:in `compile'
        from /app/slug-compiler/lib/slug.rb:441:in `block in run_buildpack'
        from /app/slug-compiler/lib/utils.rb:120:in `log'
        from /app/slug-compiler/lib/slug.rb:679:in `log'
        from /app/slug-compiler/lib/slug.rb:440:in `run_buildpack'
        from /app/slug-compiler/lib/slug.rb:110:in `block (2 levels) in compile'
        from /app/slug-compiler/lib/utils.rb:101:in `block in timeout'
        from /usr/local/lib/ruby/1.9.1/timeout.rb:58:in `timeout'
        from /app/slug-compiler/lib/utils.rb:101:in `rescue in timeout'
        from /app/slug-compiler/lib/utils.rb:96:in `timeout'
        from /app/slug-compiler/lib/slug.rb:99:in `block in compile'
        from /app/slug-compiler/lib/utils.rb:120:in `log'
        from /app/slug-compiler/lib/slug.rb:679:in `log'
        from /app/slug-compiler/lib/slug.rb:98:in `compile'
        from /app/slug-compiler/bin/slugc:85:in `block in <main>'
        from /app/slug-compiler/lib/slug.rb:449:in `block in lock'
        from /app/slug-compiler/lib/repo_lock.rb:44:in `call'
        from /app/slug-compiler/lib/repo_lock.rb:44:in `run'
        from /app/slug-compiler/lib/slug.rb:449:in `lock'
        from /app/slug-compiler/bin/slugc:66:in `<main>'
     !     Heroku push rejected, failed to compile Ruby/rails app

Unfortunately, the only relevant logging provides no detail:

    2012-06-20T21:03:28+00:00 heroku[slugc]: Slug compilation started
    2012-06-20T21:13:36+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app
@icostan

It is happening to me as well in few projects coz of too many assets files to precompile and heroku timeouts.

While it is not directly related to jquery-ui-rails I got it working by fork-ing the gem and removing all datepicker i18n files.
If you dont need internationalization in your project, give it a try.

@joliss
Owner

Hm, that's interesting. Let's leave this issue open for now so people with similar problems will find it.

I wonder if we can somehow make the precompiler take less time on the unused i18n files.

For what it's worth, I ended up finding the precompiling on Heroku to be too tricky and unreliable (e.g. having to set config.assets.initialize_on_precompile), so I just have a local deploy script that copies my app, precompiles the assets locally, checks everything (including public/assets) into a throwaway repo and pushes it to Heroku. But still it would certainly be desirable for jquery-ui-rails not to cause issues when you go the "regular" precompile route.

@jimishjoban

I faced a similar issue where all the assets files were pre-compiled which took as long as 15 to 20 minutes in production. (none of the files were called from application.js)

Removing the jquery-ui-rails gem from application brought back pre-compilation time to under a minute...

@dgilperez

+1, we're experiencing the same issue here. Any hints or should we go by @iuliancostan?

@joliss joliss referenced this issue from a commit
@joliss Do not require datepicker in datepicker i18n files
Let's see if this solves #9.
2b32d52
@joliss
Owner

I just committed a possible fix to master. Can you see if it solves your problem and report back here, please?

group :assets do
  gem 'jquery-ui-rails', :git => 'https://github.com/joliss/jquery-ui-rails'
end
@dgilperez

It worked for me like a charm, thanks !

@joliss
Owner

Glad it's fixed for you! I still can't reproduce the problem myself. Heroku precompilation works just as fast with or without the fix.

@kjohnston @iuliancostan @jimishjoban @franciscoj Can you guys try this too and see if it fixes the precompilation slowness/timeouts for you?

group :assets do
  gem 'jquery-ui-rails', :git => 'https://github.com/joliss/jquery-ui-rails'
end
@icostan

It works for me. Thank you.

@joliss
Owner

Thanks for letting me know. I just pushed version 2.0.0 then.

@joliss joliss closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.