heroku-buildpack-jemalloc: jemalloc 5.1.0 causing problems in heroku deploys release phase

Since the change of version of jemalloc, we’ve started getting failures in the release phase of our heroku deploys that look like this

  rake aborted!
  JSON::ParserError: 765: unexpected token at 'node[29]: pthread_create: Invalid argument
  ["ok"]'
  /app/vendor/bundle/ruby/2.5.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:68:in `extract_result'
  /app/vendor/bundle/ruby/2.5.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:39:in `exec'
  /app/vendor/bundle/ruby/2.5.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:14:in `initialize'
  /app/vendor/bundle/ruby/2.5.0/gems/execjs-2.7.0/lib/execjs/runtime.rb:57:in `new'
  /app/vendor/bundle/ruby/2.5.0/gems/execjs-2.7.0/lib/execjs/runtime.rb:57:in `compile'
  /app/vendor/bundle/ruby/2.5.0/gems/execjs-2.7.0/lib/execjs/module.rb:27:in `compile'
  /app/vendor/bundle/ruby/2.5.0/gems/uglifier-4.1.10/lib/uglifier.rb:154:in `initialize'
  /app/config/environments/staging.rb:21:in `new'
  /app/config/environments/staging.rb:21:in `block in <main>'
  /app/vendor/bundle/ruby/2.5.0/gems/railties-5.0.6/lib/rails/railtie.rb:209:in `instance_eval'
  /app/vendor/bundle/ruby/2.5.0/gems/railties-5.0.6/lib/rails/railtie.rb:209:in `configure'
  /app/config/environments/staging.rb:1:in `<main>'
  /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.2.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:19:in `require'
  /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.2.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:19:in `block in require_with_bootsnap_lfi'
  /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.2.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
  /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.2.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:18:in `require_with_bootsnap_lfi'
  /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.2.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:27:in `require'
  /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:293:in `block in require'
  /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:259:in `load_dependency'
  /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:293:in `require'
  /app/vendor/bundle/ruby/2.5.0/gems/railties-5.0.6/lib/rails/engine.rb:600:in `block (2 levels) in <class:Engine>'
  /app/vendor/bundle/ruby/2.5.0/gems/railties-5.0.6/lib/rails/engine.rb:599:in `each'
  /app/vendor/bundle/ruby/2.5.0/gems/railties-5.0.6/lib/rails/engine.rb:599:in `block in <class:Engine>'
  /app/vendor/bundle/ruby/2.5.0/gems/railties-5.0.6/lib/rails/initializable.rb:30:in `instance_exec'
  /app/vendor/bundle/ruby/2.5.0/gems/railties-5.0.6/lib/rails/initializable.rb:30:in `run'
  /app/vendor/bundle/ruby/2.5.0/gems/railties-5.0.6/lib/rails/initializable.rb:55:in `block in run_initializers'
  /app/vendor/bundle/ruby/2.5.0/gems/railties-5.0.6/lib/rails/initializable.rb:44:in `each'
  /app/vendor/bundle/ruby/2.5.0/gems/railties-5.0.6/lib/rails/initializable.rb:44:in `tsort_each_child'
  /app/vendor/bundle/ruby/2.5.0/gems/railties-5.0.6/lib/rails/initializable.rb:54:in `run_initializers'
  /app/vendor/bundle/ruby/2.5.0/gems/railties-5.0.6/lib/rails/application.rb:352:in `initialize!'
  /app/config/environment.rb:5:in `<main>'
  /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.2.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:19:in `require'
  /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.2.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:19:in `block in require_with_bootsnap_lfi'
  /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.2.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
  /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.2.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:18:in `require_with_bootsnap_lfi'
  /app/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.2.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:27:in `require'
  /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:293:in `block in require'
  /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:259:in `load_dependency'
  /app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.0.6/lib/active_support/dependencies.rb:293:in `require'
  /app/vendor/bundle/ruby/2.5.0/gems/railties-5.0.6/lib/rails/application.rb:328:in `require_environment!'
  /app/vendor/bundle/ruby/2.5.0/gems/railties-5.0.6/lib/rails/application.rb:448:in `block in run_tasks_blocks'
  /app/vendor/bundle/ruby/2.5.0/gems/bugsnag-5.0.1/lib/bugsnag/rake.rb:12:in `execute_with_bugsnag'
  Tasks: TOP => db:migrate => environment
  (See full trace by running task with --trace)

The line in question in staging.rb that seems to fail is this one

     config.assets.js_compressor = Uglifier.new(harmony: true)

All our deploys with the jemalloc buildpack removed work just fine. (Figured this because our review apps don’t use jemalloc, but it seemed that we had to run

heroku plugins:install heroku-repo
heroku repo:purge_cache

To get it to work.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 22 (11 by maintainers)

Most upvoted comments

I’m considering reverting the change to make 5.1.0 the default. If you’ve run into this then 👍 this comment and I’ll take that into consideration. I hate to move backwards but I also don’t want to break things for people.

For those who can no longer deploy because of this issue: revert to the previous version

Fork this repo and revert to jemallock 5.0.1

  1. Fork this repo
  2. $ git clone <your fork repo> ; cd heroku-buildpack-jemalloc
  3. $ git reset --hard 08f77c0a
  4. $ git push -f

Use your modified buildpack

  1. open https://dashboard.heroku.com/apps/<your app>/settings ;
  2. scroll down to ‘Buildbacks’
  3. deletehttps://github.com/gaffneyc/heroku-buildpack-jemalloc
  4. add https://github.com/<your-account>/heroku-buildpack-jemalloc

You should be able to set JEMALLOC_VERSION=5.0.1 instead of having to fork the repo. I’m sorry you ran into issues, we had an open issue for about two months before upgrading… of course that requires people to be testing the new version against different environments to find anything. I also missed this since I apparently wasn’t watching my own repo 🤦‍♂️

From your stack trace, the problem is actually coming from NodeJS and not Ruby. There was a note in #2 about NodeJS printing pthread_create: Invalid argument but otherwise working fine. My guess is that execjs is forking a NodeJS process then reading the output from the command and parsing the output as JSON. The problem is that the warning is breaking the parsing.

@concept47 If you’re still in a position to, could you try setting JEMALLOC_VERSION to see if that fixes the issue?