Skip to content

Multiple Array#concat calls for single-element array throws ConcurrencyError #5141

@ghost

Description

Environment

$ jruby -v
jruby 9.1.16.0 (2.3.3) 2018-02-21 8f3f95a Java HotSpot(TM) 64-Bit Server VM 25.121-b13 on 1.8.0_121-b13 +jit [linux-x86_64]
$ uname -a
Linux localhost.localdomain 2.6.32-642.6.1.el6.x86_64 #1 SMP Wed Oct 5 00:36:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Expected Behavior

  • Initialise an array with a single element, x
  • concat that array to itself twice
  • The array should now contain four elements with value x
irb(main):001:0> a = [1]
=> [1]
irb(main):002:0> a.concat(a)
=> [1, 1]
irb(main):003:0> a.concat(a)
=> [1, 1, 1, 1]
irb(main):004:0> 

Actual Behavior

irb(main):001:0> a = [1]
=> [1]
irb(main):002:0> a.concat(a)
=> [1, 1]
irb(main):003:0> a.concat(a)
ConcurrencyError: Detected invalid array contents due to unsynchronized modifications with concurrent users
	from org/jruby/RubyArray.java:1580:in `concat'
	from (irb):3:in `<eval>'
	from org/jruby/RubyKernel.java:995:in `eval'
	from org/jruby/RubyKernel.java:1316:in `loop'
	from org/jruby/RubyKernel.java:1138:in `catch'
	from org/jruby/RubyKernel.java:1138:in `catch'
	from /home/user/.rbenv/versions/jruby-9.1.16.0/bin/irb:13:in `<main>'
irb(main):004:0> 

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions