Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Bootsnap loads bundler from gems/ even though version in site_ruby/ is already activated #134
Starting with rubygems 2.7.5, Bundler is pre-installed in the
You can still
Bootsnap can get confused in this scenario, leading it to load bundler again when it has already been loaded. We get lots of warnings about redeclared constants and then Bundler blows up with an error:
Steps to reproduce
Ensure you are running rubygems 2.7.5+
Make a new Gemfile with
Run the following ruby script (e.g. in
require "bundler/setup" # ← this loads from site_ruby/ env = ENV["RAILS_ENV"] || "development" require "bootsnap" Bootsnap.setup( cache_dir: ".", development_mode: env == "development", load_path_cache: true, autoload_paths_cache: false, disable_trace: false, compile_cache_iseq: true, compile_cache_yaml: true ) require "bundler" # ← this erroneously loads again, from gems/
This reliably produces:
referenced this issue
Feb 20, 2018
@ojab unfortunately no, that did not work. I tried your fork and cleared out the bootsnap cache, and I still get the same error:
I've experienced this issue a bunch. However, I'm able to reproduce it even if I haven't ever issued
I've got two Dockerfiles in that repro: one issues
If I change my
@cjlarose the ruby-2.3.6-alpine Docker image has two copies of bundler in it. You can see it does a
So I think both of your Dockerfiles are actually testing the same scenario.
But in any case, that's a really great repro! It shows that anyone using the official Ruby docker image is going to run into this bug.
@mattbrictson Ah, that makes sense. I looked in
on that "single-bundler" image.
My load path contains both directories
This explains why removing
I've also been seeing this crash on my CI jobs. I fixed it by not loading bootsnap in the CI environment:
This works fine for now, but I just realized that I could add the
Hi guys. I was hoping this would fix this issue but it didn't
I'm still getting this with rake tasks
From the thread linked above, it seems its a bootsnap issue with a relative require somehere?