CARVIEW |
Select Language
HTTP/2 200
cache-control: max-age=0, private, must-revalidate
content-type: text/html; charset=utf-8
etag: W/"91babd7e243f9c7122e9666746605847"
nel: {"report_to":"heroku-nel","response_headers":["Via"],"max_age":3600,"success_fraction":0.01,"failure_fraction":0.1}
referrer-policy: strict-origin-when-cross-origin
report-to: {"group":"heroku-nel","endpoints":[{"url":"https://nel.heroku.com/reports?s=KBeZ4mLJROf%2FZKmcynFBdc%2FLgHlklWzA5ns1bHrp5kY%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1753282982"}],"max_age":3600}
reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=KBeZ4mLJROf%2FZKmcynFBdc%2FLgHlklWzA5ns1bHrp5kY%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1753282982"
server: Heroku
set-cookie: _redmine_session=cUc0OGFBejE2U0hReWFuK2hlNEcyYXRONFo3TEVDYmtaUVEyNGlGUzQ3MXJJWWFVSCtUdWhBUUt2bUNLWnVVZDhDbkxPeTMwVm5XUWVabnB2djRKNll1TmZ6bDZPQ2lFMnY2UDd2RWVUTlBKYmVGZm9YNm5pZW05MSt6SFliMjl1a3FoUUYyVmF4c1k5L3g3ODRTNTd3eUp2QWFFdVVtYk1UclJHQW85QlpZUkhwZWNDeGFBeDNDbUcwcXRnVW10LS1DVWpRVVdwUG5UQWZOOFdxZTJWbzBnPT0%3D--eaa7a09488f35a1d5fc02aa83a9125303458f1b9; path=/; secure; httponly; samesite=lax
strict-transport-security: max-age=63072000; includeSubDomains
vary: Accept
via: 2.0 heroku-router
x-content-type-options: nosniff
x-download-options: noopen
x-frame-options: SAMEORIGIN
x-permitted-cross-domain-policies: none
x-request-id: a8aae638-7fe4-054e-c1b5-4ec9ef912c5d
x-runtime: 0.165747
x-xss-protection: 1; mode=block
content-length: 40822
date: Wed, 23 Jul 2025 15:03:02 GMT
Bug #21339: Namespace: `RubyVM::InstructionSequence.load_iseq` isn't called for the root namespace - Ruby - Ruby Issue Tracking System
[ruby-core:122098]
Project
General
Profile
Tags
Custom queries
Actions
Bug #21339
openNamespace: `RubyVM::InstructionSequence.load_iseq` isn't called for the root namespace
Added by byroot (Jean Boussier) 2 months ago. Updated about 2 months ago.
ruby -v:
ruby 3.5.0dev (2025-05-14T12:41:46Z master b5575a80bc) +PRISM [arm64-darwin24]
Tags:
Description
File.write("/tmp/compile-cache.rb", <<~'RUBY')
class << RubyVM::InstructionSequence
def load_iseq(path)
p [:load_iseq, path]
RubyVM::InstructionSequence.compile_file(path)
end
end
RUBY
File.write("/tmp/test-file.rb", "")
puts "main:"
require "/tmp/compile-cache.rb"
require "/tmp/test-file.rb"
if ENV["RUBY_NAMESPACE"]
puts "namespace:"
ns = Namespace.new
ns.require("/tmp/compile-cache.rb")
ns.require("/tmp/test-file.rb")
end
Expected behavior:
I would expect load_iseq
to be invoked both in the root namespace and the user namespace when RUBY_NAMESPACE=1
.
Actual behavior:
Somehow it's only invoked in the user namespace:
main:
[:compile_cache_setup]
[:load_iseq, "/tmp/test-file.rb"]
main:
[:compile_cache_setup]
namespace:
[:compile_cache_setup]
[:load_iseq, "/tmp/test-file.rb"]
But I don't understand why.
Updated by mame (Yusuke Endoh) 2 months ago
It works as expected with --disable=gems
.
$ RUBY_NAMESPACE=1 ./local/bin/ruby --disable=gems test.rb
./local/bin/ruby: warning: Namespace is experimental, and the behavior may change in the future!
See doc/namespace.md for known issues, etc.
main:
[:load_iseq, "/tmp/test-file.rb"]
namespace:
[:load_iseq, "/tmp/test-file.rb"]
But it does not by default.
$ RUBY_NAMESPACE=1 ./local/bin/ruby test.rb
./local/bin/ruby: warning: Namespace is experimental, and the behavior may change in the future!
See doc/namespace.md for known issues, etc.
main:
namespace:
[:load_iseq, "/tmp/test-file.rb"]
The reason seems to be that rubygems's require monkey patch does not work in sub namespace.
# with RUBY_NAMESPACE=1
puts "main:"
require "csv" #=> OK
if ENV["RUBY_NAMESPACE"]
puts "namespace:"
ns = Namespace.new
# csv is a bundled gem, so rubygems is needed to require it
ns.require("csv") #=> cannot load such file -- csv (LoadError)
end
Thus, there are two problems
- load_iseq does not fire via RubyGems require monkey patch.
- RubyGems require monkey patch does not work in sub namespaces.
Updated by Eregon (Benoit Daloze) 2 months ago
- Related to Bug #21324: Namespace loads RubyGems in root Namespace but it should not added
Updated by Eregon (Benoit Daloze) 2 months ago
Basically dependent or even caused by #21324 then
Actions
Like0
Like0Like0Like0Like0
Powered by Redmine © 2006-2025 Jean-Philippe Lang
Loading...