fly-apps/dockerfile-rails

Unable to load Jemalloc in compose

louim opened this issue · 8 comments

louim commented

Hey! I bumped the gem to the latest version and I started seeing:

ERROR: ld.so: object '/usr/lib/x86_64-linux-gnu/libjemalloc.so.2' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

in my docker compose logs. A wild guess is that it's related to the newly added security lockdown features, but I thought i'd ask before digging in.

rubys commented

Are you running off of main, or the released gem? I ask because the security lockdown feature has yet to be released.

louim commented

Sorry, you're right. I'm running from the released gem. I'll try to create a reproducible case.

I don't have any meaningful to add, just wanted to report that I encountered this after completing the fly.io Rails deployment wizard.

I might have found something: Using dockerfile-rails 1.2.5, it seems like the base image doesn't include the jemalloc portion when calling bin/rails g dockerfile --jemalloc --no-prepare --yjit.

This is the output:
FROM ruby:$RUBY_VERSION-slim as base, but it should be FROM ruby:$RUBY_VERSION-jemalloc-slim as base (referring to https://github.com/rubys/dockerfile-rails/blob/main/lib/generators/templates/Dockerfile.erb#L11), right?

Edit: Disregard. I just noticed that jemalloc requires fullstaq, which I wasn't aware of

Disregard. I just noticed that jemalloc requires fullstaq, which I wasn't aware of

I also discovered this the hard way. I assume that's not the long term plan?

rubys commented

Jemalloc should be usable without fullstaq. See https://github.com/rubys/dockerfile-rails/blob/main/test/results/jemalloc/Dockerfile

What problems are you seeing?

@rubys the Dockerfile looks fine, and a deploy (Fly machines) works fine.

But then I get a bunch of these in the logs:

ERROR: ld.so: object '/usr/lib/aarch64-linux-gnu/libjemalloc.so.2' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

Which makes me think jemalloc (libjemalloc2?) isn't in the image.