Project

General

Profile

Bug #11567

Updated by hsbt (Hiroshi SHIBATA) about 3 years ago

Running the below code under 2.2.3 results in a segmentation fault. Runs without issue on 2.1.6. Output attached as a text file.

```rb <pre><code class="ruby">
require 'open3'
require 'pp'

data_accessor = Mutex.new
results = {}
threads = []

200.times.each do |i|
threads << Thread.new do
Open3.popen3('ping localhost -c 2') do |_stdin, stdout, stderr, thread|

{ out: stdout, err: stderr }.each do |key, stream|
t = "#{i}-" + key.to_s
data_accessor.synchronize do
results[t] = []
end
Thread.new do
until (line = stream.gets).nil?
data_accessor.synchronize do
results[t].push line
end
end
end
end

thread.join
end
end
end

threads.each(&:join)

pp results
``` </code></pre>

Back