-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Labels
Milestone
Description
Environment Information
Tested on JRuby 9.4.2.0 & 9.4.3.0 from the official docker images (running on OS X 12.6.5). Bug doesn't occur in JRuby 9.3.x nor MRI 2.6/3.1 with equivalent code.
Issue
The bug was first seen while working with the Sequel database library. When pulling a JSONB record out via Sequel, trying to clone Sequel::Postgres::JSONBHash records results in the following error:
SQL
# create table test_table ( jsonb_data jsonb );
# insert into test_table (jsonb_data) values ('{"key1":{"nested_key":"value"}, "key2":"value2"}');
jirb
> irb(main)> db_conn = <initialize connection>
> irb(main)> db_conn["SELECT jsonb_data from test_table limit 1"].first[:jsonb_data].clone
/opt/jruby/lib/ruby/stdlib/delegate.rb:226:in `initialize_clone': `clone': wrong number of arguments (given 1, expected 0) (ArgumentError)
from org/jruby/RubyKernel.java:2202:in `clone'
from (irb):43:in `evaluate'
from org/jruby/RubyKernel.java:1159:in `eval'
from org/jruby/RubyKernel.java:1601:in `loop'
from org/jruby/RubyKernel.java:1308:in `catch'
from org/jruby/RubyKernel.java:1308:in `catch'
from /opt/jruby/lib/ruby/gems/shared/gems/irb-1.4.2/exe/irb:11:in `<main>'
from org/jruby/RubyKernel.java:1105:in `load'
from /opt/jruby/bin/irb:23:in `<main>'
from org/jruby/RubyKernel.java:1105:in `load'
from /opt/jruby/lib/ruby/gems/shared/gems/bundler-2.4.14/lib/bundler/cli/exec.rb:58:in `kernel_load'
from /opt/jruby/lib/ruby/gems/shared/gems/bundler-2.4.14/lib/bundler/cli/exec.rb:23:in `run'
from /opt/jruby/lib/ruby/gems/shared/gems/bundler-2.4.14/lib/bundler/cli.rb:492:in `exec'
from /opt/jruby/lib/ruby/gems/shared/gems/bundler-2.4.14/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /opt/jruby/lib/ruby/gems/shared/gems/bundler-2.4.14/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /opt/jruby/lib/ruby/gems/shared/gems/bundler-2.4.14/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
@jeremyevans took a look and thinks that this is a bug in JRuby 9.4. He provided a minimal example in the original issue ticket (here):
require 'delegate'
DelegateClass(Hash).new({}).clone
Reactions are currently unavailable