[#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:86255] [Ruby trunk Bug#13239] Bug with "special exceptions" when they are thrown in context of a rescue clause.
From:
Greg.mpls@...
Date:
2018-03-22 16:44:30 UTC
List:
ruby-core #86255
Issue #13239 has been updated by MSP-Greg (Greg L). Obviously, 2.2 changes are soon to be stopped. Recently in Puma, Travis was changed from 2.2.8 to 2.2.9, and in code using a pipe, the "can't modify frozen IOError" occurred. This was not an issue with 2.2.8, which was used in Puma / Travis testing since 2017-09-18. ---------------------------------------- Bug #13239: Bug with "special exceptions" when they are thrown in context of a rescue clause. https://bugs.ruby-lang.org/issues/13239#change-71165 * Author: nvashchenko (Nikolay Vashchenko) * Status: Closed * Priority: Normal * Assignee: * Target version: * ruby -v: 2.4.x, 2.3.x, etc * Backport: 2.2: UNKNOWN, 2.3: DONE, 2.4: DONE ---------------------------------------- I've stumbled upon a case when ruby is supposed to throw "IOError: stream closed"(https://github.com/ruby/ruby/blob/trunk/thread.c#L4823) because there was a retained FD lock by another thread, but I'm was getting this instead of it: ``` RuntimeError: can't modify frozen IOError /home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.2/lib/puma/server.rb:877:in `write' /home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.2/lib/puma/server.rb:877:in `<<' /home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.2/lib/puma/server.rb:877:in `stop' ``` I've done some digging and it appeared to a be a ruby bug with how such exceptions(so called "special exceptions") are handled. This exception is being frozen right after creation: https://github.com/ruby/ruby/blob/trunk/vm.c#L2078 but later, when it's thrown, it's being handled exactly as regular exception that is not frozen, which leads to a problem here: https://github.com/ruby/ruby/blob/trunk/eval.c#L511 - it is an attempt to assign the "#cause" attribute on it when it all happens inside a rescue clause, since the exception itself is frozen. I've created a script to reproduce it: ```ruby rd, wr = IO.pipe Thread.new do IO.select [rd] wr.close end begin raise 'any exception' rescue wr << 'A' end ``` It works with this ruby fork where I've added sleep for couple of seconds to imitate slow system call response, to keep the FD locked for a while and produce initial exception: https://github.com/ruby/ruby/blob/trunk/eval.c#L511 -- 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>