Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors with LD_PRELOAD version #20

Open
gbatterbee opened this issue Jul 29, 2019 · 4 comments
Open

Errors with LD_PRELOAD version #20

gbatterbee opened this issue Jul 29, 2019 · 4 comments

Comments

@gbatterbee
Copy link

gbatterbee commented Jul 29, 2019

Hi, thanks for setting up this build pack.

I'm not sure if there is a problem or not, though I would log it here.
We're running
Ruby 2.37
Rails 4.2.0

  "stack": "heroku-16",
  "buildpacks": [
    {
      "url": "heroku/nodejs"
    },
    {
      "url": "heroku/ruby"
    },
    {
      "url": "https://github.com/.../heroku-buildpack-libjpeg62"
    },
    {
      "url": "https://github.com/.../buildpack-ruby-rake-deploy-tasks"
    },
    {
      "url": "https://github.com/mojodna/heroku-buildpack-jemalloc.git"
    }
  ],

As per docs I added Env Var LD_PRELOAD=/app/vendor/jemalloc/lib/libjemalloc.so.1

But this errored with

Jul 29 09:02:37 ...-app-preprod-pr-5439 app/web.1: ERROR: ld.so: object '=/app/vendor/jemalloc/lib/libjemalloc.so.1' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.   

If I run these in bash,

~ $ ldd /app/vendor/jemalloc/lib/libjemalloc.so.1
	linux-vdso.so.1 =>  (0x00007ffcc78ba000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1853734000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f185336a000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f1853b91000)
~ $ 

So then I checked this

~ $ ls /app/vendor/jemalloc/lib
libjemalloc.a  libjemalloc_pic.a  libjemalloc.so  libjemalloc.so.1
~ $

And changed
LD_PRELOAD to /app/vendor/jemalloc/lib/libjemalloc.so

I then pushed a new change and got a build error.
JSON::ParserError: 784: unexpected token at 'ERROR: ld.so: object '/app/vendor/jemalloc/lib/libjemalloc.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.

So I removed LD_PRELOAD and used
web: jemalloc.sh bundle exec puma -C config/puma.rb

I can push a change through, but querying ~ $ ruby -r rbconfig -e "puts RbConfig::CONFIG['LIBS']"

Gives me -lpthread -lgmp -ldl -lcrypt -lm

So I don't know if this is what is expected or if it is working properly?
If you could confirm if this is correct, or if there is an error here?

Many thanks!

@nateberkopec
Copy link
Collaborator

I'm not sure jemalloc is supposed to showup in RbConfig::Config['LIBS'].

Somebody asked me about this before, "how do I know if Jemalloc is actually being used when using LD_PRELOAD", and I don't think there's a great solution.

@gbatterbee
Copy link
Author

I had a feeling you were going to say that.
Thanks for the response.

As for the other errors, I guess these never got resolved?
I guess there isn't a know resolution for not being able to use jemalloc.so.1 or for being able to use the LD_PRELOAD env var?

@gaffneyc
Copy link
Collaborator

gaffneyc commented Aug 6, 2019

@gbatterbee To see if jemalloc is enabled you can use the trick mentioned in this comment: gaffneyc#5 (comment)

If you're having trouble getting it set up I would recommend taking a look at my fork which should be easier to get started with.

@gbatterbee
Copy link
Author

Ah, nice, thanks - I'll take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants