[#85940] [Ruby trunk Bug#14578] Forking a child process inside of a mutex crashes the ruby interpreter — ben.govero@...
Issue #14578 has been reported by bengovero (Ben Govero).
3 messages
2018/03/05
[#86205] [Ruby trunk Feature#14618] Add display width method to String for CLI — aycabta@...
Issue #14618 has been reported by aycabta (aycabta .).
3 messages
2018/03/19
[#86366] Re: [ruby-cvs:70102] usa:r63008 (trunk): get rid of test error/failure on Windows introduced at r62955 — Eric Wong <normalperson@...>
usa@ruby-lang.org wrote:
3 messages
2018/03/28
[ruby-core:86211] [Ruby trunk Bug#14578] Forking a child process inside of a mutex crashes the ruby interpreter
From:
naruse@...
Date:
2018-03-20 02:08:35 UTC
List:
ruby-core #86211
Issue #14578 has been updated by naruse (Yui NARUSE).
Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: REQUIRED to 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: DONE
ruby_2_5 r62852 merged revision(s) 62668.
----------------------------------------
Bug #14578: Forking a child process inside of a mutex crashes the ruby interpreter
https://bugs.ruby-lang.org/issues/14578#change-71106
* Author: bengovero (Ben Govero)
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.5.0
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: DONE
----------------------------------------
OS: Mac OS X 10.13.3 (High Sierra)
Affects ruby versions 2.5.0 and 2.6.0preview1
Issue **not** present in 2.4.1
Consider the following script. I contrived it as an experiment for a more complicated project. We have a resource that we want to synchronize access to, but we want to fork the process when actually using the resource. This script works in 2.4.1, but not in 2.5.0 or beyond.
```
class Synchronizer
def initialize
@mutex = Mutex.new
end
def use(&block)
@mutex.synchronize do
Process.fork do
block.call
end
Process.wait
end
end
end
@s = Synchronizer.new
5.times do |i|
Thread.new do
@s.use do
puts "block #{i}"
end
end
end
sleep 10
```
The error I get when the interpreter crashes is: `[BUG] unexpected THREAD_KILLED`
Is this a crazy implementation? Or a real bug?
---Files--------------------------------
ruby_2018-03-05-133827-1_bens-mac.crash (36.3 KB)
ruby_2018-03-05-133827_bens-mac.crash (36.3 KB)
ruby_2018-03-05-133827-2_bens-mac.crash (36.3 KB)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>