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

LOADED_FEATURES internal index not working correctly #5590

Closed
headius opened this issue Feb 6, 2019 · 2 comments
Closed

LOADED_FEATURES internal index not working correctly #5590

headius opened this issue Feb 6, 2019 · 2 comments
Milestone

Comments

@headius
Copy link
Member

headius commented Feb 6, 2019

As part of work on eliminating all builtin libraries (so Shopify/bootsnap can cache require paths and lookups across runs) I ran into an issue with our logic to "provide" loaded features.

In MRI, rb_provide adds entries to the loaded features cache such that a simple require of the same name will be short-circuited.

We have similar logic, but it appears that the index where we store the short names either doesn't work properly or is getting wiped out.

This manifested in errors attempting to load the internal (provided) enumerator.rb, thread.rb, complex,rb, and rational.rb similar to the failures seen here: https://travis-ci.org/jruby/jruby/builds/489301097

Basically, because the loaded features cache didn't work right, it attempted to actually load those files. Since they don't exist, it produced an error.

I tracked one breakage down to the following lines in test/jruby/test_file.rb:

      with_load_path("file:" + File.expand_path("test/jruby/dir with spaces/test_jar.jar") + "!/abc") do
        assert require('foo')
        assert $LOADED_FEATURES.pop =~ /foo\.rb$/
      end

Either the LOAD_PATH or the LOADED_FEATURES manipulation here prevents JRuby from seeing that enumerator.rb is already provided, and a later test fails when it tries to require 'enumerator'.

@headius
Copy link
Member Author

headius commented Feb 6, 2019

This also affects the non-existent (boot-loaded) jruby/util.

@headius
Copy link
Member Author

headius commented Jun 24, 2019

This has been fixed on the new load_service_redux branch by having a proper implementation of loaded features. The stubs were removed in 586b07c.

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

2 participants