From: shibata.hiroshi@... Date: 2016-05-07T00:56:51+00:00 Subject: [ruby-core:75401] [Ruby trunk Bug#11567][Feedback] Segmentation fault CFUNC :gets Issue #11567 has been updated by Hiroshi SHIBATA. Description updated Status changed from Open to Feedback I couldn't reproduce this with latest versions of 2.1-2.4. Please try with 2.2.5 or 2.3.1. ---------------------------------------- Bug #11567: Segmentation fault CFUNC :gets https://bugs.ruby-lang.org/issues/11567#change-58524 * Author: D R * Status: Feedback * Priority: Normal * Assignee: * ruby -v: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- 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 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 ``` ---Files-------------------------------- gets bug.txt (30.7 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: