Due to Mastodon fixing a critical security update,"for operational safety, I also just attempted to update the currently running Mastodon version from v4.2 to v4.2.5.
My system environment is Ubuntu 20.04.6 LTS. Following the upgrade guide, I updated Ruby to 3.2.3, and encountered an error during the final precompilation step.
cannot allocate memory in static TLS block – /home/mastodon/live/vendor/bundle/ruby/3.2.0/gems/msgpack-1.7.1/lib/msgpack/msgpack.so (LoadError)
The issue was causing the upgrade to be unable to proceed. After researching some information, I found that the same problem also occurred in Debian 11. I resolved this issue with the following command.
echo /usr/lib/x86_64-linux-gnu/libjemalloc.so > /etc/ld.so.preload
You can also try two other potentially effective fixes.
export LD_PRELOAD=/path/to/libjemalloc.so.2
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install