errbit / errbit

The open source error catcher that's Airbrake API compliant
http://errbit.github.com/errbit/
MIT License
4.25k stars 996 forks source link

Libv8 error when deploying errbit to heroku #1494

Open AdrianNowik opened 3 years ago

AdrianNowik commented 3 years ago

Step 3: Describe the problem:

Steps to reproduce:

  1. Follow the official notes how to deploy errbit on the Heroku: https://github.com/errbit/errbit/blob/master/docs/deployment/heroku.md
  2. Use the Deploy to Heroku button provided in the guide: https://heroku.com/deploy?template=https://github.com/errbit/errbit/tree/master
  3. Fill in all required fields in the Create App Heroku form.
  4. Change GEMFILE_RUBY_VERSION to 2.7.2, since 2.5.1 (which is entered by default, is not supported on heroku-20)
  5. Run Deploy App

Observed Results:

I've got an error during the bundle, I won't paste the whole stack trace because it's thousands of lines, so I will only paste bundle output and where it fails.

  -----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
-----> Ruby app detected
-----> Installing bundler 2.2.11
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.7.2
-----> Installing dependencies using bundler 2.2.11
       Running: BUNDLE_WITHOUT='development' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
       Fetching gem metadata from https://rubygems.org/.........
       Fetching rake 13.0.1
       Installing rake 13.0.1
       Fetching concurrent-ruby 1.0.5
       Fetching minitest 5.14.0
       Fetching thread_safe 0.3.6
       Fetching builder 3.2.3
       Installing thread_safe 0.3.6
       Installing builder 3.2.3
       Installing minitest 5.14.0
       Installing concurrent-ruby 1.0.5
       Fetching erubis 2.7.0
       Fetching mini_portile2 2.5.0
       Installing mini_portile2 2.5.0
       Installing erubis 2.7.0
       Fetching racc 1.5.2
       Fetching crass 1.0.6
       Installing racc 1.5.2 with native extensions
       Installing crass 1.0.6
       Fetching rack 1.6.13
       Fetching mini_mime 1.0.1
       Installing mini_mime 1.0.1
       Installing rack 1.6.13
       Fetching addressable 2.4.0
       Installing addressable 2.4.0
       Fetching htmlentities 4.3.4
       Installing htmlentities 4.3.4
       Fetching arel 6.0.4
       Installing arel 6.0.4
       Fetching multi_json 1.13.1
       Installing multi_json 1.13.1
       Fetching ast 2.4.0
       Installing ast 2.4.0
       Fetching bcrypt 3.1.13
       Installing bcrypt 3.1.13 with native extensions
       Fetching bson 4.8.2
       Using bundler 2.2.11
       Installing bson 4.8.2 with native extensions
       Fetching byebug 10.0.2
       Installing byebug 10.0.2 with native extensions
       Fetching campy 1.0.0
       Installing campy 1.0.0
       Fetching regexp_parser 1.3.0
       Installing regexp_parser 1.3.0
       Fetching cliver 0.3.2
       Installing cliver 0.3.2
       Fetching coderay 1.1.2
       Installing coderay 1.1.2
       Fetching json 2.1.0
       Installing json 2.1.0 with native extensions
       Fetching docile 1.3.1
       Installing docile 1.3.1
       Fetching simplecov-html 0.10.2
       Installing simplecov-html 0.10.2
       Fetching tins 1.16.3
       Installing tins 1.16.3
       Fetching thor 0.19.4
       Installing thor 0.19.4
       Fetching orm_adapter 0.5.0
       Installing orm_adapter 0.5.0
       Fetching diff-lcs 1.3
       Installing diff-lcs 1.3
       Fetching unf_ext 0.0.7.5
       Installing unf_ext 0.0.7.5 with native extensions
       Fetching dotenv 2.5.0
       Installing dotenv 2.5.0
       Fetching request_store 1.1.0
       Installing request_store 1.1.0
       Fetching errbit_plugin 0.6.0
       Installing errbit_plugin 0.6.0
       Fetching multipart-post 2.0.0
       Installing multipart-post 2.0.0
       Fetching execjs 2.7.0
       Installing execjs 2.7.0
       Fetching fabrication 2.20.1
       Installing fabrication 2.20.1
       Fetching ffi 1.9.25
       Installing ffi 1.9.25 with native extensions
       Fetching mime-types-data 3.2016.0521
       Installing mime-types-data 3.2016.0521
       Fetching multi_xml 0.6.0
       Installing multi_xml 0.6.0
       Fetching temple 0.8.2
       Installing temple 0.8.2
       Fetching tilt 2.0.10
       Installing tilt 2.0.10
       Fetching hashie 4.1.0
       Installing hashie 4.1.0
       Fetching mimemagic 0.3.2
       Installing mimemagic 0.3.2
       Fetching jaro_winkler 1.5.1
       Installing jaro_winkler 1.5.1 with native extensions
       Fetching jwt 2.1.0
       Installing jwt 2.1.0
       Fetching kaminari-core 1.1.1
       Installing kaminari-core 1.1.1
       Fetching origin 2.3.1
       Installing origin 2.3.1
       Fetching libv8 3.16.14.19
       Installing libv8 3.16.14.19 with native extensions
       Fetching method_source 0.9.2
       Installing method_source 0.9.2
       Fetching rspec-support 3.8.0
       Installing rspec-support 3.8.0
       Fetching netrc 0.11.0
       Installing netrc 0.11.0
       Fetching nio4r 2.5.2
       Installing nio4r 2.5.2 with native extensions
       Fetching parallel 1.12.1
       Installing parallel 1.12.1
       Fetching phantomjs 2.1.1.0
       Installing phantomjs 2.1.1.0
       Fetching websocket-extensions 0.1.3
       Installing websocket-extensions 0.1.3
       Fetching powerpack 0.1.2
       Installing powerpack 0.1.2
       Fetching rack-ssl-enforcer 0.2.9
       Installing rack-ssl-enforcer 0.2.9
       Fetching rails_serve_static_assets 0.0.4
       Installing rails_serve_static_assets 0.0.4
       Fetching rails_stdout_logging 0.0.3
       Installing rails_stdout_logging 0.0.3
       Fetching rainbow 3.0.0
       Installing rainbow 3.0.0
       Fetching rb-fsevent 0.10.3
       Installing rb-fsevent 0.10.3
       Fetching ref 2.0.0
       Installing ref 2.0.0
       Fetching ri_cal 0.8.8
       Installing ri_cal 0.8.8
       Fetching rinku 2.0.6
       Installing rinku 2.0.6 with native extensions
       Fetching ruby-progressbar 1.9.0
       Installing ruby-progressbar 1.9.0
       Fetching unicode-display_width 1.4.0
       Installing unicode-display_width 1.4.0
       Fetching timecop 0.9.1
       Installing timecop 0.9.1
       Fetching underscore-rails 1.8.3
       Installing underscore-rails 1.8.3
       Fetching useragent 0.16.10
       Installing useragent 0.16.10
       Fetching xmpp4r 0.5.6
       Installing xmpp4r 0.5.6
       Fetching yajl-ruby 1.4.1
       Installing yajl-ruby 1.4.1 with native extensions
       Fetching tzinfo 1.2.5
       Installing tzinfo 1.2.5
       Fetching i18n 0.9.5
       Installing i18n 0.9.5
       Fetching sucker_punch 2.1.1
       Installing sucker_punch 2.1.1
       Fetching mail 2.7.1
       Installing mail 2.7.1
       Fetching css_parser 1.6.0
       Installing css_parser 1.6.0
       Fetching launchy 2.4.3
       Installing launchy 2.4.3
       Fetching rack-test 0.6.3
       Installing rack-test 0.6.3
       Fetching warden 1.2.7
       Installing warden 1.2.7
       Fetching rack-ssl 1.4.1
       Installing rack-ssl 1.4.1
       Fetching sprockets 3.7.2
       Installing sprockets 3.7.2
       Fetching airbrake 4.3.8
       Installing airbrake 4.3.8
       Fetching parser 2.5.1.2
       Fetching nokogiri 1.11.1
       Installing parser 2.5.1.2
       Fetching term-ansicolor 1.6.0
       Installing term-ansicolor 1.6.0
       Fetching faraday 0.9.2
       Installing faraday 0.9.2
       Fetching uglifier 4.1.20
       Installing nokogiri 1.11.1 with native extensions
       Fetching mongo 2.11.3
       Installing uglifier 4.1.20
       Installing mongo 2.11.3
       Fetching mime-types 3.1
       Installing mime-types 3.1
       Fetching haml 5.1.2
       Installing haml 5.1.2
       Fetching omniauth 1.9.1
       Installing omniauth 1.9.1
       Fetching unf 0.1.4
       Installing unf 0.1.4
       Fetching rb-inotify 0.9.10
       Installing rb-inotify 0.9.10
       Fetching pry 0.12.2
       Installing pry 0.12.2
       Fetching rspec-core 3.8.0
       Installing rspec-core 3.8.0
       Fetching rspec-expectations 3.8.2
       Installing rspec-expectations 3.8.2
       Fetching rspec-mocks 3.8.0
       Installing rspec-mocks 3.8.0
       Fetching websocket-driver 0.7.0
       Installing websocket-driver 0.7.0 with native extensions
       Fetching rails_12factor 0.0.3
       Installing rails_12factor 0.0.3
       Fetching puma 4.3.3
       Installing puma 4.3.3 with native extensions
       Fetching activesupport 4.2.11.1
       Installing activesupport 4.2.11.1
       Fetching premailer 1.11.1
       Installing premailer 1.11.1
       Fetching email_spec 1.6.0
       Installing email_spec 1.6.0
       Fetching simplecov 0.16.1
       Installing simplecov 0.16.1
       Fetching sawyer 0.8.2
       Installing sawyer 0.8.2
       Fetching oauth2 1.4.1
       Installing oauth2 1.4.1
       Fetching rubocop 0.58.2
       Installing rubocop 0.58.2
       Fetching httparty 0.16.3
       Installing httparty 0.16.3
       Fetching domain_name 0.5.20180417
       Installing domain_name 0.5.20180417
       Fetching sass-listen 4.0.0
       Installing sass-listen 4.0.0
       Fetching pry-byebug 3.6.0
       Installing pry-byebug 3.6.0
       Fetching pry-rails 0.3.9
       Installing pry-rails 0.3.9
       Fetching rspec 3.8.0
       Installing rspec 3.8.0
       Fetching rails-deprecated_sanitizer 1.0.3
       Installing rails-deprecated_sanitizer 1.0.3
       Fetching globalid 0.4.2
       Installing globalid 0.4.2
       Fetching activemodel 4.2.11.1
       Installing activemodel 4.2.11.1
       Fetching decent_exposure 3.0.2
       Installing decent_exposure 3.0.2
       Fetching hoptoad_notifier 2.4.11
       Installing hoptoad_notifier 2.4.11
       Fetching coveralls 0.8.22
       Installing coveralls 0.8.22
       Fetching octokit 4.16.0
       Installing octokit 4.16.0
       Fetching omniauth-oauth2 1.5.0
       Installing omniauth-oauth2 1.5.0
       Fetching flowdock 0.7.1
       Installing flowdock 0.7.1
       Fetching hipchat 1.6.0
       Installing hipchat 1.6.0
       Fetching hoi 0.0.7
       Installing hoi 0.0.7
       Fetching http-cookie 1.0.3
       Installing http-cookie 1.0.3
       Fetching sass 3.5.6
       Installing sass 3.5.6
       Fetching activejob 4.2.11.1
       Installing activejob 4.2.11.1
       Fetching activerecord 4.2.11.1
       Installing activerecord 4.2.11.1
       Fetching mongoid 5.4.1
       Installing mongoid 5.4.1
       Fetching rspec-activemodel-mocks 1.1.0
       Installing rspec-activemodel-mocks 1.1.0
       Fetching errbit_github_plugin 0.3.0
       Installing errbit_github_plugin 0.3.0
       Fetching omniauth-github 1.4.0
       Installing omniauth-github 1.4.0
       Fetching omniauth-google-oauth2 0.7.0
       Installing omniauth-google-oauth2 0.7.0
       Fetching rest-client 2.0.2
       Installing rest-client 2.0.2
       Fetching kaminari-activerecord 1.1.1
       Installing kaminari-activerecord 1.1.1
       Fetching kaminari-mongoid 1.0.1
       Installing kaminari-mongoid 1.0.1
       Fetching mongoid-rspec 3.0.0
       Installing mongoid-rspec 3.0.0
       Fetching rushover 0.3.0
       Installing rushover 0.3.0
       Fetching rails-dom-testing 1.0.9
       Fetching loofah 2.4.0
       Installing rails-dom-testing 1.0.9
       Installing loofah 2.4.0
       Fetching xpath 3.2.0
       Installing xpath 3.2.0
       Fetching capybara 3.12.0
       Fetching rails-html-sanitizer 1.3.0
       Installing rails-html-sanitizer 1.3.0
       Fetching actionview 4.2.11.1
       Installing actionview 4.2.11.1
       Installing capybara 3.12.0
       Fetching kaminari-actionview 1.1.1
       Fetching actionpack 4.2.11.1
       Installing kaminari-actionview 1.1.1
       Installing actionpack 4.2.11.1
       Fetching kaminari 1.1.1
       Installing kaminari 1.1.1
       Fetching poltergeist 1.18.1
       Installing poltergeist 1.18.1
       Fetching actionmailer 4.2.11.1
       Fetching railties 4.2.11.1
       Installing actionmailer 4.2.11.1
       Installing railties 4.2.11.1
       Fetching draper 2.1.0
       Fetching sprockets-rails 3.2.1
       Installing sprockets-rails 3.2.1
       Installing draper 2.1.0
       Fetching actionmailer_inline_css 1.6.0
       Installing actionmailer_inline_css 1.6.0
       Fetching responders 2.4.1
       Fetching dotenv-rails 2.5.0
       Fetching font-awesome-rails 4.2.0.0
       Installing responders 2.4.1
       Installing dotenv-rails 2.5.0
       Fetching jquery-rails 4.3.3
       Fetching quiet_assets 1.1.0
       Installing quiet_assets 1.1.0
       Installing font-awesome-rails 4.2.0.0
       Installing jquery-rails 4.3.3
       Fetching rspec-rails 3.8.1
       Installing rspec-rails 3.8.1
       Fetching sass-rails 5.0.7
       Fetching devise 4.7.1
       Installing sass-rails 5.0.7
       Installing devise 4.7.1
       Fetching pjax_rails 0.4.0
       Installing pjax_rails 0.4.0
       Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

       current directory:
       /tmp/build_5f14f06b/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19/ext/libv8
       /tmp/build_5f14f06b/vendor/ruby-2.7.2/bin/ruby -I
       /tmp/build_5f14f06b/vendor/ruby-2.7.2/lib/ruby/2.7.0 -r
       ./siteconf20210317-294-149nj38.rb extconf.rb
       creating Makefile
       Applying
       /tmp/build_5f14f06b/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19/patches/disable-building-tests.patch
       Applying
       /tmp/build_5f14f06b/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19/patches/disable-werror-on-osx.patch
       Applying
       /tmp/build_5f14f06b/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19/patches/disable-xcode-debugging.patch
       Applying
       /tmp/build_5f14f06b/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19/patches/do-not-imply-vfp3-and-armv7.patch
       Applying
       /tmp/build_5f14f06b/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19/patches/do-not-use-MAP_NORESERVE-on-freebsd.patch
       Applying
       /tmp/build_5f14f06b/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19/patches/do-not-use-vfp2.patch
       Applying
       /tmp/build_5f14f06b/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19/patches/fPIC-for-static.patch
       Compiling v8 for x64
       Using python 2.7.18
       Using compiler: c++ (GCC version 9.3.0)
       Beginning compilation. This will take some time.
       Building v8 with env CXX=c++ LINK=c++  /usr/bin/make x64.release
       ARFLAGS.target=crs werror=no
       GYP_GENERATORS=make \
       build/gyp/gyp --generator-output="out" build/all.gyp \
                     -Ibuild/standalone.gypi --depth=. \
                     -Dv8_target_arch=x64 \
       -S.x64  -Dv8_enable_backtrace=1
       -Dv8_can_use_vfp2_instructions=true -Darm_fpu=vfpv2
       -Dv8_can_use_vfp3_instructions=true -Darm_fpu=vfpv3 -Dwerror=''
       make[1]: Entering directory
       '/tmp/build_5f14f06b/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19/vendor/v8/out'
       CXX(target)
       /tmp/build_5f14f06b/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/preparser_lib/src/allocation.o
       CXX(target)
       /tmp/build_5f14f06b/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/preparser_lib/src/atomicops_internals_x86_gcc.o
       CXX(target)
       /tmp/build_5f14f06b/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum.o
       CXX(target)
       /tmp/build_5f14f06b/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/preparser_lib/src/bignum-dtoa.o
       CXX(target)
       /tmp/build_5f14f06b/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/preparser_lib/src/cached-powers.o
       CXX(target)
       /tmp/build_5f14f06b/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19/vendor/v8/out/x64.release/obj.target/preparser_lib/src/conversions.o
       In file included from ../src/utils.h:36,
                        from ../src/conversions.h:31,
                        from ../src/conversions-inl.h:40,
                        from ../src/conversions.cc:32:
       ../src/scanner.h: In member function ‘void v8::internal::Scanner::Init()’:
       ../src/checks.h:251:22: warning: typedef ‘__StaticAssertTypedef__444’ locally
       defined but not used [-Wunused-local-typedefs]
         251 |     SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__)
             |                      ^~~~~~~~~~~~~~~~~~~~~~~
 ...
 ...
 ...             
 ...            
 3.16.14.19/ext/libv8/location.rb:26:in
       `install!'
        from extconf.rb:7:in `<main>'

       extconf failed, exit code 1

       Gem files will remain installed in
       /tmp/build_5f14f06b/vendor/bundle/ruby/2.7.0/gems/libv8-3.16.14.19 for
       inspection.
       Results logged to
       /tmp/build_5f14f06b/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/libv8-3.16.14.19/gem_make.out

       An error occurred while installing libv8 (3.16.14.19), and Bundler cannot
       continue.
       Make sure that `gem install libv8 -v '3.16.14.19' --source
       'https://rubygems.org/'` succeeds before bundling.

       In Gemfile:
         therubyracer was resolved to 0.12.3, which depends on
           libv8
 !
 !     Failed to install gems via Bundler.
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed

Expected Results:

I am not sure what's wrong here, I've changed the ruby version from the default 2.5.1 to the 2.7.2 but I've tried to bundle it on my local machine and it seems that bundle finished without errors for ruby 2.7.2. Also, I was wondering if someone has tried to deploy Errbit to Heroku using the Heroku-20 stack.

stevecrozz commented 3 years ago

Thanks for the report. I have to admit here that Errbit has fallen pretty far behind in the heroku deployment area and that's probably going to continue to be the state of things unless someone picks up the torch. It is possible that it could be easier to use the docker container to deploy to heroku now because of the self-contained nature of containers. I'm going to mark this issue 'help wanted' in case anyone out there can help.

AdrianNowik commented 3 years ago

Thanks for your response, appreciate it. I will try the docker way for sure, it didn't come to my mind so thanks for the advice

2called-chaos commented 3 years ago

I recently upgraded our errbit host from Ubuntu 18.04 to 20.04 after which I couldn't build libv8 anymore (good I still had it compiled).

It's probably related to this version of v8 being quite a bit out of date. I have hardly checked but I suppose we only use it for asset compilation (with therubyracer)? In other projects we switched to mini_racer as therubyracer is dead (last release 2017).

I just tried replacing therubyracer with mini_racer and so far it seems to work just fine (but I have no clue about Heroku). Just be aware that you probably have to use bundler < 2.2 due to a bug. bundle _2.1.2_ install for example (requires that version of bundler to be installed obviously). That then will also require to be started this way bundle _2.1.2_ exec puma... or just don't install bundler 2.2 and you don't have to do any of that. To actually fix that issue we would just need to rebuild the Gemfile.lock but since there are no version restrictions currently for most gems I didn't felt quite lucky enough to try rn.

If it weren't for things I personally don't like (like haml and mongo) I would probably invest some time to give errbit a refresh. Maybe I still do but currently it does the job for us quite well.

This could also be a potential solution for #1492

AdrianNowik commented 3 years ago

Hey, thanks for your reply. Actually, advice from 2called-chaos helped me to get it working on Heroku. But worth taking note, that it's only for my needs and maybe I would try to resolve the issue in a different way if it would be for production usage.

So actually I've changed the therubyracer to mini_racer as 2called-chaos suggested. I've set up the ruby version to 2.6.6 since I've read that 2.6.x version is the last version that works fine with rails 4.2. Also, I've used Heroku buildpack that is using bundler 2.1.4, this one: Using buildpack: https://github.com/heroku/heroku-buildpack-ruby.git#v219 and it seems like it's working now, but I didn't manage to set up it with the rails app yet.

simon0191 commented 3 years ago

I managed to deploy it with Docker. I just had to create the following heroku.yml file and add the container stack with heroku stack:set container

build:
  docker:
    web: Dockerfile
run:
  web: bundle exec puma -C config/puma.default.rb
espen commented 3 years ago

@simon0191 great, but I think errbit should be able to run on Heroku without Docker. Hopefully mini_racer will solve this.

2called-chaos commented 3 years ago

Can someone test with current master? I'm not really in the Heroku game but I guess it should work. With Bundler 2.2 we might need to add another platform to the lock file (not quite sure what they use for a system stack)

bryanus commented 3 years ago

Can someone test with current master? I'm not really in the Heroku game but I guess it should work. With Bundler 2.2 we might need to add another platform to the lock file (not quite sure what they use for a system stack)

FWIW, I just tried to deploy with the current master and it failed using bundler 2.2. Downgraded to bundler 2.1.4 using the build pack 'https://github.com/heroku/heroku-buildpack-ruby.git#v219', with ruby 2.5.1 for Heroku-18 stack and rails 4.2.10 and managed to get through to the full deploy.