glitch-soc / mastodon

A glitchy but lovable microblogging server

Home Page:https://glitch-soc.github.io/docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`cannot allocate memory in static TLS block` on bundle exec rails db:migrate

neilzone opened this issue · comments

Steps to reproduce the problem

I am trying to fix 2592.

When I pull the latest code, the .ruby-version is now 3.2.3.

I installed rbenv 3.2.3, and then ran through the upgrade steps.

When I run RAILS_ENV=production SKIP_POST_DEPLOYMENT_MIGRATIONS=true bundle exec rails db:migrate, I get the error:

<internal:/home/mastodon/.rbenv/versions/3.2.3/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require': /lib/x86_64-linux-gnu/libjemalloc.so.2: cannot allocate memory in static TLS block - /home/mastodon/live/vendor/bundle/ruby/3.2.0/gems/msgpack-1.7.2/lib/msgpack/msgpack.so (LoadError)
	from <internal:/home/mastodon/.rbenv/versions/3.2.3/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
	from /home/mastodon/live/vendor/bundle/ruby/3.2.0/gems/msgpack-1.7.2/lib/msgpack.rb:7:in `<top (required)>'
	from <internal:/home/mastodon/.rbenv/versions/3.2.3/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
	from <internal:/home/mastodon/.rbenv/versions/3.2.3/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
	from /home/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.17.1/lib/bootsnap/load_path_cache/store.rb:5:in `block in <top (required)>'
	from /home/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.17.1/lib/bootsnap/explicit_require.rb:45:in `rescue in with_gems'
	from /home/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.17.1/lib/bootsnap/explicit_require.rb:41:in `with_gems'
	from /home/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.17.1/lib/bootsnap/load_path_cache/store.rb:5:in `<top (required)>'
	from /home/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.17.1/lib/bootsnap/load_path_cache.rb:77:in `require_relative'
	from /home/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.17.1/lib/bootsnap/load_path_cache.rb:77:in `<top (required)>'
	from /home/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.17.1/lib/bootsnap.rb:5:in `require_relative'
	from /home/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.17.1/lib/bootsnap.rb:5:in `<top (required)>'
	from /home/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.17.1/lib/bootsnap/setup.rb:3:in `require_relative'
	from /home/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bootsnap-1.17.1/lib/bootsnap/setup.rb:3:in `<top (required)>'
	from <internal:/home/mastodon/.rbenv/versions/3.2.3/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
	from <internal:/home/mastodon/.rbenv/versions/3.2.3/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:38:in `require'
	from /home/mastodon/live/config/boot.rb:11:in `<top (required)>'
	from bin/rails:3:in `require_relative'
	from bin/rails:3:in `<main>'

Looking around, it looks like this is to do with the way in which libjemalloc was compiled, but it is not obvious if there is a fix I can use.

Expected behaviour

RAILS_ENV=production SKIP_POST_DEPLOYMENT_MIGRATIONS=true bundle exec rails db:migrate should have completed correctly

Actual behaviour

RAILS_ENV=production SKIP_POST_DEPLOYMENT_MIGRATIONS=true bundle exec rails db:migrate did not complete

Detailed description

As above

Mastodon instance

mastodon.neilzone.co.uk

Mastodon version

Not sure; latest glitch-soc code

Browser name and version

Firefox 122

Operating system

Debian 12

Technical details

No response

Hi! It seems like you're mixing jemalloc and malloc. Try rebuilding ruby with RUBY_CONFIGURE_OPTS=--with-jemalloc

Thank you! That was it.

For anyone in a similar position, what fixed it was:

RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 3.2.3