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

rb_gv_get implicitly defines global variables #2748

Closed
nirvdrum opened this issue Sep 30, 2022 · 1 comment · Fixed by #2752
Closed

rb_gv_get implicitly defines global variables #2748

nirvdrum opened this issue Sep 30, 2022 · 1 comment · Fixed by #2752
Assignees
Labels

Comments

@nirvdrum
Copy link
Collaborator

The memcached gem calls rb_gv_get on with a variable name before calling rb_define_readonly_variable. Our implementation of rb_gv_get implicitly declares that global variable, causing the subsequent rb_define_readonly_variable call to fail:

<internal:core> core/truffle/kernel_operations.rb:34:in `define_hooked_variable_with_is_defined': Global variable $$swig_runtime_data_type_pointer4 is already defined (ArgumentError)
	from <internal:core> core/truffle/kernel_operations.rb:34:in `define_hooked_variable'
	from /Users/nirvdrum/dev/workspaces/truffleruby-ws/graal/sdk/mxbuild/darwin-aarch64/GRAALVM_A33290E019_JAVA11/graalvm-a33290e019-java11-23.0.0-dev/Contents/Home/languages/ruby/lib/truffle/truffle/cext.rb:1836:in `rb_define_hooked_variable'
	from globals.c:32:in `rb_define_readonly_variable'
	from /Users/nirvdrum/.gem/truffleruby/3.0.3/bundler/gems/memcached-bc704e00ad20/ext/rlibmemcached/rlibmemcached_wrap.c:1772:in `Init_rlibmemcached'
	from <internal:core> core/kernel.rb:226:in `gem_original_require'
	from /Users/nirvdrum/.gem/truffleruby/3.0.3/bundler/gems/memcached-bc704e00ad20/lib/memcached.rb:19:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from /Users/nirvdrum/.gem/truffleruby/3.0.3/gems/bundler-2.3.22/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
	from /Users/nirvdrum/.gem/truffleruby/3.0.3/gems/bundler-2.3.22/lib/bundler/runtime.rb:55:in `each'
	from /Users/nirvdrum/.gem/truffleruby/3.0.3/gems/bundler-2.3.22/lib/bundler/runtime.rb:55:in `block in require'
	from /Users/nirvdrum/.gem/truffleruby/3.0.3/gems/bundler-2.3.22/lib/bundler/runtime.rb:44:in `each'
	from /Users/nirvdrum/.gem/truffleruby/3.0.3/gems/bundler-2.3.22/lib/bundler/runtime.rb:44:in `require'
	from /Users/nirvdrum/.gem/truffleruby/3.0.3/gems/bundler-2.3.22/lib/bundler.rb:187:in `require'
	from /Users/nirvdrum/dev/workspaces/shopify_metrics/spec/dummy/config/application.rb:22:in `<top (required)>'
	from <internal:core> core/kernel.rb:293:in `require_relative'
	from /Users/nirvdrum/dev/workspaces/shopify_metrics/spec/dummy/config/environment.rb:4:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from <internal:/Users/nirvdrum/dev/workspaces/truffleruby-ws/graal/sdk/mxbuild/darwin-aarch64/GRAALVM_A33290E019_JAVA11/graalvm-a33290e019-java11-23.0.0-dev/Contents/Home/languages/ruby/lib/mri/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /Users/nirvdrum/dev/workspaces/shopify_metrics/spec/spec_helper.rb:4:in `<top (required)>'
	from <internal:core> core/kernel.rb:234:in `gem_original_require'
	from <internal:/Users/nirvdrum/dev/workspaces/truffleruby-ws/graal/sdk/mxbuild/darwin-aarch64/GRAALVM_A33290E019_JAVA11/graalvm-a33290e019-java11-23.0.0-dev/Contents/Home/languages/ruby/lib/mri/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from spec/statsd_subscribers_spec.rb:3:in `<main>'
@nirvdrum nirvdrum added the cexts label Sep 30, 2022
@nirvdrum nirvdrum self-assigned this Sep 30, 2022
@eregon eregon mentioned this issue Oct 4, 2022
@nirvdrum
Copy link
Collaborator Author

Fixed by cb44f1b.

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

Successfully merging a pull request may close this issue.

2 participants