Created
April 16, 2012 12:42
-
-
Save jasongilman/2398538 to your computer and use it in GitHub Desktop.
JRuby Concurrency Bug in ShellLauncher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rvm use jruby-1.6.7 | |
# export JRUBY_OPTS=--1.9 | |
# jruby jruby_concurrency_bug.rb | |
puts "JRUBY_VERSION: #{JRUBY_VERSION}" | |
puts "JRUBY_OPTS: #{ENV["JRUBY_OPTS"]}" | |
popen_thread = Thread.new do | |
20.times do |n| | |
puts "Sleeping #{n}" | |
IO.popen("sleep 1", :err=>[:child, :out]) do |stdout| | |
stdout.each do |line| | |
puts "Output: #{line}" | |
end | |
end | |
puts "Done sleeping #{n}" | |
end | |
end | |
env_modify_thread = Thread.new do | |
puts "Starting to modify env" | |
50000.times do |n| | |
ENV["var#{n}"] = "value #{n}" | |
end | |
puts "Done modifying env" | |
end | |
env_modify_thread.join | |
popen_thread.join |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JRUBY_VERSION: 1.6.7 | |
JRUBY_OPTS: --1.9 | |
Starting to modify env | |
Sleeping 0 | |
Done sleeping 0 | |
Sleeping 1 | |
Exception in thread "RubyThread-1: jruby_bug.rb:4" java.lang.ArrayIndexOutOfBoundsException: 8495 | |
at org.jruby.util.ShellLauncher.getCurrentEnv(ShellLauncher.java:231) | |
at org.jruby.util.ShellLauncher.popenShared(ShellLauncher.java:712) | |
at org.jruby.util.ShellLauncher.popenShared(ShellLauncher.java:689) | |
at org.jruby.util.ShellLauncher.popenShared(ShellLauncher.java:685) | |
at org.jruby.util.ShellLauncher.popen(ShellLauncher.java:669) | |
at org.jruby.RubyIO.popen19(RubyIO.java:3720) | |
at org.jruby.RubyIO$s$0$1$popen19.call(RubyIO$s$0$1$popen19.gen:65535) | |
at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:219) | |
at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:210) | |
at org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:221) | |
at jruby_bug.block_1$RUBY$__file__(jruby_bug.rb:10) | |
at jruby_bug$block_1$RUBY$__file__.call(jruby_bug$block_1$RUBY$__file__:65535) | |
at org.jruby.runtime.CompiledBlock19.yield(CompiledBlock19.java:139) | |
at org.jruby.runtime.Block.yield(Block.java:130) | |
at org.jruby.RubyFixnum.times(RubyFixnum.java:256) | |
at org.jruby.RubyFixnum$i$0$0$times.call(RubyFixnum$i$0$0$times.gen:65535) | |
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:302) | |
at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:144) | |
at org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:153) | |
at jruby_bug.block_0$RUBY$__file__(jruby_bug.rb:8) | |
at jruby_bug$block_0$RUBY$__file__.call(jruby_bug$block_0$RUBY$__file__:65535) | |
at org.jruby.runtime.CompiledBlock19.yield(CompiledBlock19.java:163) | |
at org.jruby.runtime.CompiledBlock19.call(CompiledBlock19.java:91) | |
at org.jruby.runtime.Block.call(Block.java:89) | |
at org.jruby.RubyProc.call(RubyProc.java:270) | |
at org.jruby.RubyProc.call(RubyProc.java:224) | |
at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:95) | |
at java.lang.Thread.run(Thread.java:680) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
JRuby bug filed as http://jira.codehaus.org/browse/JRUBY-6603