Ruby Issue Tracking System: Issueshttps://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112024-03-28T14:27:26ZRuby Issue Tracking System
Redmine Ruby master - Bug #20399 (Open): Ripper doesn't respect implicit -xhttps://redmine.ruby-lang.org/issues/203992024-03-28T14:27:26Zkddnewton (Kevin Newton)kddnewton@gmail.com
<p>For the given script:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="c1">#!/bin/sh</span>
<span class="c1"># -*- ruby -*-</span>
<span class="nb">exec</span> <span class="s2">"${RUBY-ruby}"</span> <span class="s2">"-x"</span> <span class="s2">"$0"</span> <span class="s2">"$@"</span> <span class="o">&&</span> <span class="p">[</span> <span class="p">]</span> <span class="k">if</span> <span class="kp">false</span>
<span class="c1">#!ruby</span>
<span class="c1"># This needs ruby 2.0, Subversion and Git.</span>
<span class="c1"># As a Ruby committer, run this in an SVN repository</span>
<span class="c1"># to commit a change.</span>
<span class="nb">require</span> <span class="s1">'tempfile'</span>
<span class="nb">require</span> <span class="s1">'net/http'</span>
</code></pre>
<p>I would expect all of the various Ripper APIs (<code>lex</code>, <code>sexp</code>, <code>sexp_raw</code>, <code>new.parse</code>, etc.) to start parsing on line 4, because that's what the parser does. Instead, it starts parsing on line 1.</p> Ruby master - Bug #20397 (Open): The nkf license in LEGAL file seems to be obsoletehttps://redmine.ruby-lang.org/issues/203972024-03-27T17:22:36Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<p>The LEGAL file seems to contain <a href="https://github.com/ruby/ruby/blob/a69f0047cb489c136001937442c1d2ffd8ea1dd7/LEGAL?plain=1#L730-L746" class="external">obsolete information</a> about nkf license.</p>
<p>It seems that nkf indeed use such license, but in upstream, it was first changed to <a href="https://github.com/nurse/nkf/commit/c12280757bfb275d6f9e6b0bf6293a28b060e77b" class="external">MIT</a> and then immediately to <a href="https://github.com/nurse/nkf/commit/2ed3e1c270f1deb9487f7bc7d7586030fe7dabc5" class="external">zlib</a> license.</p>
<p>Ruby has picked up that change with <a class="changeset" title="* ext/nkf/nkf-utf8/nkf.c: Update nkf to 2.0.9. revert -s meaning as Shift_JIS, etc. git-svn-id..." href="https://redmine.ruby-lang.org/projects/ruby-master/repository/git/revisions/13313688b243882aff7815598ddd9fcbae69bc17">git|13313688b243882aff7815598ddd9fcbae69bc17</a></p>
<p>Maybe <a class="user active user-mention" href="https://redmine.ruby-lang.org/users/5">@naruse (Yui NARUSE)</a> can comment about this.</p> Ruby master - Bug #20342 (Open): Top level `public`, `private` and `ruby2_keywords` do not work i...https://redmine.ruby-lang.org/issues/203422024-03-16T10:21:57Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<p>With this file:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="c1"># load.rb</span>
<span class="kp">public</span> <span class="k">def</span> <span class="nf">f</span> <span class="o">=</span> <span class="ss">:ok</span>
</code></pre>
<p>It is OK when <code>require</code>d.</p>
<pre><code data-language="sh-session">$ ruby -r ./load.rb -e 'p f'
:ok
</code></pre>
<p>Simple <code>load</code> is OK too.</p>
<pre><code data-language="sh-session">$ ruby -e 'load ARGV[0]; p f' load.rb
:ok
</code></pre>
<p>Wrapped <code>load</code> fails.</p>
<pre><code data-language="sh-session">$ ruby -e 'load ARGV[0], true' load.rb
load.rb:1:in 'public': undefined method 'f' for class 'Object' (NameError)
public def f = :ok
^^^^^^
from load.rb:1:in '<top (required)>'
from -e:1:in 'Kernel#load'
from -e:1:in '<main>'
</code></pre> Ruby master - Bug #20319 (Open): Singleton class is being frozen lazily in some caseshttps://redmine.ruby-lang.org/issues/203192024-03-01T11:52:12Zandrykonchin (Andrew Konchin)
<p>I've noticed suspicious behaviour (it doesn't affect anything in practice for me though) when an object becomes frozen only its own singleton class becomes frozen immediately.</p>
<p>A singleton class of the object immediate singleton class becomes frozen lazily after <code>#singleton_class</code> method call:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">o</span> <span class="o">=</span> <span class="no">Object</span><span class="p">.</span><span class="nf">new</span>
<span class="n">klass</span> <span class="o">=</span> <span class="n">o</span><span class="p">.</span><span class="nf">singleton_class</span><span class="p">.</span><span class="nf">singleton_class</span>
<span class="n">o</span><span class="p">.</span><span class="nf">freeze</span>
<span class="nb">puts</span> <span class="n">klass</span><span class="p">.</span><span class="nf">frozen?</span> <span class="c1"># false <== here we expect true</span>
<span class="nb">puts</span> <span class="n">o</span><span class="p">.</span><span class="nf">singleton_class</span><span class="p">.</span><span class="nf">singleton_class</span><span class="p">.</span><span class="nf">frozen?</span> <span class="c1"># true</span>
<span class="nb">puts</span> <span class="n">klass</span><span class="p">.</span><span class="nf">frozen?</span> <span class="c1"># true</span>
</code></pre>
<p>I would expect all created (and visible to user) singleton classes in an object singleton classes chain to become frozen immediately when the object gets frozen.</p> Ruby master - Bug #20316 (Open): Regexp quantifier behavior changes in different syntactic context.https://redmine.ruby-lang.org/issues/203162024-02-29T17:21:18Zjirkamarsik (Jirka Marsik)
<p>In the example below, adding a vertical bar to the end of a regular expression changes what is being matched by the preceding regular expression.</p>
<pre><code>irb(main):001:0> /(|a){3}b/.match("aab")
=> #<MatchData "aab" 1:"">
irb(main):002:0> /(|a){3}b|/.match("aab")
=> #<MatchData "aab" 1:"a">
</code></pre>
<p>This is because the <code>{3}</code> quantifier is compiled into a <code>repeat</code> loop which uses the <code>OP_NULL_CHECK_END_MEMST</code> operation to perform a capture-group sensitive null-check after every loop iteration. The logic behind the <code>OP_NULL_CHECK_END_MEMST</code> operation is implemented using the <code>STACK_NULL_CHECK_MEMST</code> macro in <code>regexec.c</code>. The <code>STACK_NULL_CHECK_MEMST</code> macro checks whether any capture groups have been updated inside the last loop iteration and it does so by searching the stack for <code>STK_MEM_START</code> entries. However, such entries are not used for all capture groups. They are only used by capture groups which are listed in <code>bt_mem_start</code>. A capture group is marked as needing such bookkeeping only when it is either referenced by a back-reference or it appears in certain syntactic contexts (see e.g. around line 4096 of <code>regcomp.c</code>). This looks like an optimization that tries to avoid polluting the stack with <code>STK_MEM_START</code> entries in cases in which they are not needed. However, in this case, not putting <code>STK_MEM_START</code> entries on the stack leads to a different match result.</p>
<p>In the example above, by adding a vertical bar to the end of the regexp, we have placed the group <code>(|a)</code> inside an alternation. This means that a different operation for tracking the state of the capture group is emitted in the compiled bytecode and this leads to a different result. Incidentally, this result should be the correct result, as the null-check ends up respecting the state of capture groups, as it tries to do in Ruby.</p>
<p>This is the compilation and execution of <code>/(|a){3}b/.match("aab")</code> with ONIG_DEBUG_PARSE_TREE, ONIG_DEBUG_COMPILE and ONIG_DEBUG_MATCH. Note that <code>mem-start:1</code> is used for tracking the state of capture group 1.</p>
<pre><code>PATTERN: /(|a){3}b/ (US-ASCII)
<list:55db929991f0>
<quantifier:55db92999230>{3,3}
<enclose:55db92999330> memory:1
<alt:55db929991b0>
<string:55db929992f0>
<string:55db929992b0>a
<string:55db929993b0>b
optimize: EXACT
anchor: []
sub anchor: []
exact: [b]: length: 1
code length: 37
0:[repeat:0:27] 7:[null-check-start:0] 10:[mem-start:1] 13:[push:(+5)] 18:[jump:(+2)]
23:[exact1:a] 25:[mem-end:1] 28:[null-check-end-memst:0] 31:[repeat-inc:0] 34:[exact1:b]
36:[end]
match_at: str: 139809364021904 (0x7f27e77a9290), end: 139809364021906 (0x7f27e77a9292), start: 139809364021904 (0x7f27e77a9290), sprev: 0 ((nil))
size: 2, start offset: 0
ofs> str stk:type addr:opcode
0> "ab" 0:Alt 0:[repeat:0:27]
0> "ab" 1:Rep 7:[null-check-start:0]
0> "ab" 2:NulChS 10:[mem-start:1]
0> "ab" 2:NulChS 13:[push:(+5)]
0> "ab" 3:Alt 18:[jump:(+2)]
0> "ab" 3:Alt 25:[mem-end:1]
0> "ab" 3:Alt 28:[null-check-end-memst:0]
NULL_CHECK_END_MEMST: skip id:0, s:139809364021904 (0x7f27e77a9290)
0> "ab" 3:Alt 34:[exact1:b]
0> "ab" 2:NulChS 23:[exact1:a]
1> "b" 2:NulChS 25:[mem-end:1]
1> "b" 2:NulChS 28:[null-check-end-memst:0]
1> "b" 2:NulChS 31:[repeat-inc:0]
1> "b" 3:RepInc 7:[null-check-start:0]
1> "b" 4:NulChS 10:[mem-start:1]
1> "b" 4:NulChS 13:[push:(+5)]
1> "b" 5:Alt 18:[jump:(+2)]
1> "b" 5:Alt 25:[mem-end:1]
1> "b" 5:Alt 28:[null-check-end-memst:0]
NULL_CHECK_END_MEMST: skip id:0, s:139809364021905 (0x7f27e77a9291)
1> "b" 5:Alt 34:[exact1:b]
2> "" 5:Alt 36:[end]
</code></pre>
<p>This is the compilation and execution of <code>/(|a){3}b|/.match("aab")</code> (where the group <code>(|a)</code> appears inside an alternation) with ONIG_DEBUG_PARSE_TREE, ONIG_DEBUG_COMPILE and ONIG_DEBUG_MATCH. Note that <code>mem-start-push:1</code> is used for tracking the state of capture group 1, not <code>mem-start:1</code>.</p>
<pre><code>PATTERN: /(|a){3}b|/ (US-ASCII)
<alt:55d9a91cc3c0>
<list:55d9a91cc200>
<quantifier:55d9a91cc240>{3,3}
<enclose:55d9a91cc340> memory:1
<alt:55d9a91cc1c0>
<string:55d9a91cc300>
<string:55d9a91cc2c0>a
<string:55d9a91cc480>b
<string:55d9a91cc400>
optimize: NONE
anchor: []
code length: 47
0:[push:(+41)] 5:[repeat:0:27] 12:[null-check-start:0] 15:[mem-start-push:1] 18:[push:(+5)]
23:[jump:(+2)] 28:[exact1:a] 30:[mem-end:1] 33:[null-check-end-memst:0] 36:[repeat-inc:0]
39:[exact1:b] 41:[jump:(+0)] 46:[end]
match_at: str: 140072854131304 (0x7f6540b69268), end: 140072854131306 (0x7f6540b6926a), start: 140072854131304 (0x7f6540b69268), sprev: 0 ((nil))
size: 2, start offset: 0
ofs> str stk:type addr:opcode
0> "ab" 0:Alt 0:[push:(+41)]
0> "ab" 1:Alt 5:[repeat:0:27]
0> "ab" 2:Rep 12:[null-check-start:0]
0> "ab" 3:NulChS 15:[mem-start-push:1]
0> "ab" 4:MemS 18:[push:(+5)]
0> "ab" 5:Alt 23:[jump:(+2)]
0> "ab" 5:Alt 30:[mem-end:1]
0> "ab" 5:Alt 33:[null-check-end-memst:0]
0> "ab" 5:Alt 36:[repeat-inc:0]
0> "ab" 6:RepInc 12:[null-check-start:0]
0> "ab" 7:NulChS 15:[mem-start-push:1]
0> "ab" 8:MemS 18:[push:(+5)]
0> "ab" 9:Alt 23:[jump:(+2)]
0> "ab" 9:Alt 30:[mem-end:1]
0> "ab" 9:Alt 33:[null-check-end-memst:0]
NULL_CHECK_END_MEMST: skip id:0, s:140072854131304 (0x7f6540b69268)
0> "ab" 9:Alt 39:[exact1:b]
0> "ab" 8:MemS 28:[exact1:a]
1> "b" 8:MemS 30:[mem-end:1]
1> "b" 8:MemS 33:[null-check-end-memst:0]
1> "b" 8:MemS 36:[repeat-inc:0]
1> "b" 9:RepInc 12:[null-check-start:0]
1> "b" 10:NulChS 15:[mem-start-push:1]
1> "b" 11:MemS 18:[push:(+5)]
1> "b" 12:Alt 23:[jump:(+2)]
1> "b" 12:Alt 30:[mem-end:1]
1> "b" 12:Alt 33:[null-check-end-memst:0]
1> "b" 12:Alt 36:[repeat-inc:0]
1> "b" 13:RepInc 39:[exact1:b]
2> "" 13:RepInc 41:[jump:(+0)]
2> "" 13:RepInc 46:[end]
</code></pre> Ruby master - Bug #20314 (Open): Simultaneous Timeout expires may raise an exception after the blockhttps://redmine.ruby-lang.org/issues/203142024-02-29T06:25:26Zmame (Yusuke Endoh)mame@ruby-lang.org
<p>Launchable reports <code>TestTimeout#test_nested_timeout</code> as a flaky test, and I reproduced it as follows.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="s2">"timeout"</span>
<span class="k">class</span> <span class="nc">A</span> <span class="o"><</span> <span class="no">Exception</span>
<span class="k">end</span>
<span class="k">class</span> <span class="nc">B</span> <span class="o"><</span> <span class="no">Exception</span>
<span class="k">end</span>
<span class="k">begin</span>
<span class="no">Timeout</span><span class="p">.</span><span class="nf">timeout</span><span class="p">(</span><span class="mf">0.1</span><span class="p">,</span> <span class="no">A</span><span class="p">)</span> <span class="k">do</span>
<span class="no">Timeout</span><span class="p">.</span><span class="nf">timeout</span><span class="p">(</span><span class="mf">0.1</span><span class="p">,</span> <span class="no">B</span><span class="p">)</span> <span class="k">do</span>
<span class="kp">nil</span> <span class="k">while</span> <span class="kp">true</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">rescue</span> <span class="no">A</span><span class="p">,</span> <span class="no">B</span>
<span class="nb">p</span> <span class="vg">$!</span> <span class="c1">#=> #<A: execution expired></span>
<span class="c1"># Exception B is raised after the above call returns</span>
<span class="c1">#=> test.rb:16:in `p': execution expired (B)</span>
<span class="nb">p</span> <span class="ss">:end</span> <span class="c1"># not reach</span>
<span class="k">end</span>
</code></pre>
<p>This is because the timer thread performs two consecutive <code>Thread#raise</code> to the target thread.</p>
<p>I have discussed this with <a class="user active user-mention" href="https://redmine.ruby-lang.org/users/17">@ko1 (Koichi Sasada)</a> and have come up with three solutions.</p>
<a name="Solution-1"></a>
<h3 >Solution 1<a href="#Solution-1" class="wiki-anchor">¶</a></h3>
<p>When multiple nested Timeouts expire simultaneously, raise an exception for the outer-most Timeout and let the inner Timeouts expire without throwing an exception. In the above example, it would only raise A.</p>
<p>The problem with this approach is that if you are rescuing A in the inner block, it may never ends:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">Timeout</span><span class="p">.</span><span class="nf">timeout</span><span class="p">(</span><span class="mf">0.1</span><span class="p">,</span> <span class="no">A</span><span class="p">)</span> <span class="k">do</span>
<span class="no">Timeout</span><span class="p">.</span><span class="nf">timeout</span><span class="p">(</span><span class="mf">0.1</span><span class="p">,</span> <span class="no">B</span><span class="p">)</span> <span class="k">do</span>
<span class="k">begin</span>
<span class="nb">sleep</span>
<span class="k">rescue</span> <span class="no">A</span>
<span class="nb">sleep</span> <span class="c1"># The exception A is caught. The inner Timeout is already expired, so the code (may) never end.</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span>
</code></pre>
<p>Note that, if A and B did not occur at the same time, it would raise B. This is a race condition.</p>
<a name="Solution-2"></a>
<h3 >Solution 2<a href="#Solution-2" class="wiki-anchor">¶</a></h3>
<p>When multiple nested Timeouts expire simultaneously, raise an exception for the inner-most Timeout and let the outer Timeouts wait until the inner-most Timeout returns. In the above example, it would raise either A or B, not both.</p>
<p>The problem with this approach is that if you are rescuing B in the inner block, it never ends:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">Timeout</span><span class="p">.</span><span class="nf">timeout</span><span class="p">(</span><span class="mf">0.1</span><span class="p">,</span> <span class="no">A</span><span class="p">)</span> <span class="k">do</span>
<span class="no">Timeout</span><span class="p">.</span><span class="nf">timeout</span><span class="p">(</span><span class="mf">0.1</span><span class="p">,</span> <span class="no">B</span><span class="p">)</span> <span class="k">do</span>
<span class="k">begin</span>
<span class="nb">sleep</span>
<span class="k">rescue</span> <span class="no">B</span>
<span class="nb">sleep</span> <span class="c1"># The outer Timeout waits for the inner timeout, and the inner Timeout never return. So this code never ends.</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span>
</code></pre>
<a name="Solution-3"></a>
<h3 >Solution 3<a href="#Solution-3" class="wiki-anchor">¶</a></h3>
<p>Make thread interrupt queue one length. If the target thread has already been <code>Thread#raise(A)</code>, the new <code>Thread#raise(B)</code> blocks until the target thread processes A.</p>
<p>Since there will be no more simultaneous Thread#raise, there will be no more exceptions after the end of the block. The timeout timer thread should be changed in consideration that <code>Thread#raise</code> may block.</p> Ruby master - Bug #20301 (Open): `Set#add?` does two hash look-upshttps://redmine.ruby-lang.org/issues/203012024-02-26T02:42:35ZAMomchilov (Alexander Momchilov)
<p>A common usage of <code>Set</code>s is to keep track of seen objects, and do something different whenever an object is seen for the first time, e.g.:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">SEEN_VALUES</span> <span class="o">=</span> <span class="no">Set</span><span class="p">.</span><span class="nf">new</span>
<span class="k">def</span> <span class="nf">receive_value</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
<span class="k">if</span> <span class="no">SEEN_VALUES</span><span class="p">.</span><span class="nf">add?</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
<span class="nb">puts</span> <span class="s2">"Saw </span><span class="si">#{</span><span class="n">value</span><span class="si">}</span><span class="s2"> for the first time."</span>
<span class="k">else</span>
<span class="nb">puts</span> <span class="s2">"Already seen </span><span class="si">#{</span><span class="n">value</span><span class="si">}</span><span class="s2">, ignoring."</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="n">receive_value</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="c1"># Saw 1 for the first time.</span>
<span class="n">receive_value</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="c1"># Saw 2 for the first time.</span>
<span class="n">receive_value</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="c1"># Saw 3 for the first time.</span>
<span class="n">receive_value</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="c1"># Already seen 1, ignoring.</span>
</code></pre>
<p>Readers might reasonably assume that <code>add?</code> is only looking up into the set a single time, but it's actually doing two separate look-ups! (<a href="https://github.com/ruby/ruby/blob/c976cb5/lib/set.rb#L517-L525" class="external">source</a>)</p>
<pre><code class="rb syntaxhl" data-language="rb"><span class="k">class</span> <span class="nc">Set</span>
<span class="k">def</span> <span class="nf">add?</span><span class="p">(</span><span class="n">o</span>
<span class="c1"># 1. `include?(o)` looks up into `@hash`</span>
<span class="c1"># 2. if the value isn't there, `add(o)` does a second look-up into `@hash`</span>
<span class="n">add</span><span class="p">(</span><span class="n">o</span><span class="p">)</span> <span class="k">unless</span> <span class="kp">include</span><span class="p">?(</span><span class="n">o</span><span class="p">)</span>
<span class="k">end</span>
<span class="k">end</span>
</code></pre>
<p>This gets especially expensive if the values are large hash/arrays/objects, whose <code>#hash</code> is expensive to compute.</p>
<p>We can optimize this if it was possible to set a value in hash, <em>and</em> retrieve the value that was already there, in a single go. I propose adding <code>Hash#exchange_value</code> to do exactly that. If that existed, we can re-implement <code>#add?</code> as:</p>
<pre><code class="rb syntaxhl" data-language="rb"><span class="k">class</span> <span class="nc">Set</span>
<span class="k">def</span> <span class="nf">add?</span><span class="p">(</span><span class="n">o</span><span class="p">)</span>
<span class="c1"># Only requires a single look-up into `@hash`!</span>
<span class="nb">self</span> <span class="k">unless</span> <span class="vi">@hash</span><span class="p">.</span><span class="nf">exchange_value</span><span class="p">(</span><span class="n">o</span><span class="p">,</span> <span class="kp">true</span><span class="p">)</span>
<span class="k">end</span>
</code></pre>
<p>Here's a proof-of-concept implementation: <a href="https://github.com/ruby/ruby/pull/10093" class="external">https://github.com/ruby/ruby/pull/10093</a></p>
<a name="Theory"></a>
<h1 >Theory<a href="#Theory" class="wiki-anchor">¶</a></h1>
<p>How much of a benefit this has depends on 2 factors:</p>
<ol>
<li>How much <code>#hash</code> is called, which depends on how many <strong>new</strong> objects are added to the set.
<ul>
<li>If every object is new, then <code>#hash</code> used to be called twice on every <code>#add?</code>.
<ul>
<li>This is where this improvement makes the biggest (2x!) change.</li>
</ul>
</li>
<li>If every object has already been seen, then <code>#hash</code> was never being called twice before anyway, so there would be no improvement.
<ul>
<li>It's important to not regress in this case, because many use cases of sets don't deal with many distinct objects, but just need to do quick checks against an existing set.</li>
</ul>
</li>
<li>Every other case lies somewhere in between those two, depending on the % of objects which are new.</li>
</ul>
</li>
<li>How slow <code>#hash</code> is to compute for the key
<ul>
<li>If the hash is slow to compute, this change will make a bigger improvement</li>
<li>If the hash value is fast to compute, then it won't matter as much. Even if we called it half as much, it's a minority of the total time, so it won't have much net impact.</li>
</ul>
</li>
</ol>
<a name="Benchmark-summary"></a>
<h1 >Benchmark summary<a href="#Benchmark-summary" class="wiki-anchor">¶</a></h1>
<table>
<thead>
<tr>
<th></th>
<th align="right">All objects are new</th>
<th align="right">All objects are preexisting</th>
</tr>
</thead>
<tbody>
<tr>
<td>objects with slow <code>#hash</code>
</td>
<td align="right">100.0%</td>
<td align="right">~0.0%</td>
</tr>
<tr>
<td>objects with fast <code>#hash</code>
</td>
<td align="right">24.5%</td>
<td align="right">4.6%</td>
</tr>
</tbody>
</table>
<p>As we see, this change makes a huge improvement the cases where it helps, and crucially, doesn't slow down the cases where it can't.</p>
<p>For the complete benchmark source code and results, see the PR: <a href="https://github.com/ruby/ruby/pull/10093" class="external">https://github.com/ruby/ruby/pull/10093</a></p> Ruby master - Bug #20299 (Open): Tracepoint staying enable after a disablehttps://redmine.ruby-lang.org/issues/202992024-02-26T01:06:28ZMaxLap (Maxime Lapointe)hunter_spawn@hotmail.com
<p>Problem is present in Ruby 3.2.2, 3.2.3, 3.3.0. Didn't check before.</p>
<p>It seems that TracePoint can sometime be "stuck" enabled after using disabled once on it.</p>
<p>Here is a reproduction step using a "check speed" method that just does some work and print out how long it takes. This makes it pretty clear when TracePoint was on.</p>
<p>Put this in a Ruby file:</p>
<pre><code>def check_speed(msg)
t1 = Time.now.to_f
a = 0
1000000.times { |i|
a += 10
}
t2 = Time.now.to_f
puts "#{t2-t1} - #{msg}"
end
check_speed("before") # fast
trace = TracePoint.new(:line) {}
trace.enable
check_speed("after enable") # slow
trace.enable {
check_speed("in block enable") # slow
}
check_speed("after block enable") # slow
trace.disable
check_speed("after disable") # slow !!!!
trace.disable
check_speed("after disable again") # fast !!!!
# And yet, using enable multiple time doesn't have a "counter" or similar
trace.enable
trace.enable
trace.enable
check_speed("after triple enable") # slow
trace.disable
check_speed("after single disable") # fast
</code></pre>
<p>Running the file, we get this:</p>
<pre><code>$ ruby -v
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux]
$ ruby local.rb
0.03473854064941406 - before
0.18935227394104004 - after enable
0.17757630348205566 - in block enable
0.18320131301879883 - after block enable
0.1818866729736328 - after disable
0.03412747383117676 - after disable again
0.18405628204345703 - after triple enable
0.033496856689453125 - after single disable
</code></pre>
<p>The first "after disable" should probably have been fast. If it's possible to have multiple nested enable/disable, then one would instead assume that after the last "single disable", things would still be slow.</p>
<p>Note: This code patterns comes directly for a ruby/spec: ctrl+f for "enables trace object on calling with a block if it was already enabled"</p>
<p>I note that in Ruby 3.2, the timing are a lot less similar. I don't know why. It would seem like TracePoint got slower in Ruby 3.3.0. Is that worth checking out / making a distincct bug for?</p>
<pre><code>$ rvm use 3.2.3
Using /home/max/.rvm/gems/ruby-3.2.3
$ ruby local.rb
0.03246927261352539 - before
0.07910513877868652 - after enable
0.10309600830078125 - in block enable
0.12397646903991699 - after block enable
0.07114601135253906 - after disable
0.028218746185302734 - after disable again
0.12534689903259277 - after triple enable
0.02810525894165039 - after single disable
</code></pre> Ruby master - Bug #20285 (Assigned): Stale inline method caches when refinement modules are reopenedhttps://redmine.ruby-lang.org/issues/202852024-02-21T02:44:55Zjhawthorn (John Hawthorn)
<p>This is essentially the same issue as <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: refinement (Closed)" href="https://redmine.ruby-lang.org/issues/11672">#11672</a>, but for inline method caches rather than class caches.</p>
<p>In Ruby 3.3 we started using inline caches for refinements. However, we weren't clearing inline caches when defined on a reopened refinement module.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">class</span> <span class="nc">C</span>
<span class="k">end</span>
<span class="k">module</span> <span class="nn">R</span>
<span class="n">refine</span> <span class="no">C</span> <span class="k">do</span>
<span class="k">def</span> <span class="nf">m</span>
<span class="ss">:foo</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="n">using</span> <span class="no">R</span>
<span class="k">def</span> <span class="nf">m</span>
<span class="no">C</span><span class="p">.</span><span class="nf">new</span><span class="p">.</span><span class="nf">m</span>
<span class="k">end</span>
<span class="k">raise</span> <span class="k">unless</span> <span class="ss">:foo</span> <span class="o">==</span> <span class="n">m</span><span class="p">()</span>
<span class="k">module</span> <span class="nn">R</span>
<span class="n">refine</span> <span class="no">C</span> <span class="k">do</span>
<span class="k">alias</span> <span class="n">m</span> <span class="n">m</span>
<span class="k">def</span> <span class="nf">m</span>
<span class="ss">:bar</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="n">v</span> <span class="o">=</span> <span class="n">m</span><span class="p">()</span>
<span class="k">raise</span> <span class="s2">"expected :bar, got </span><span class="si">#{</span><span class="n">v</span><span class="p">.</span><span class="nf">inspect</span><span class="si">}</span><span class="s2">"</span> <span class="k">unless</span> <span class="ss">:bar</span> <span class="o">==</span> <span class="n">v</span>
</code></pre>
<p>This will raise in Ruby 3.3 as the inline cache finds a stale refinement, but passes in previous versions.</p> Ruby master - Bug #20237 (Assigned): Unable to unshare(CLONE_NEWUSER) in Linux because of timer t...https://redmine.ruby-lang.org/issues/202372024-02-05T04:59:20Zhanazuki (Kasumi Hanazuki)
<a name="Backgrounds"></a>
<h2 >Backgrounds<a href="#Backgrounds" class="wiki-anchor">¶</a></h2>
<p><a href="https://man7.org/linux/man-pages/man2/unshare.2.html" class="external">unshare(2)</a> is a syscall in Linux to move the calling process into a fresh execution context. With <code>unshare(CLONE_NEWUSER)</code> you can move a process into a new <a href="https://man7.org/linux/man-pages/man7/user_namespaces.7.html" class="external">user_namespace(7)</a>, where the process gains the full capability on the resources within the namespace. This is fundamental for Linux containers to achieve privilege separation. <code>unshare(CLONE_NEWUSER)</code> requires the calling process to be single-threaded (or no background threads are running). So, it is often invoked after <code>fork(2)</code> as forking propagates only the calling thread to the child process.</p>
<a name="Problem"></a>
<h2 >Problem<a href="#Problem" class="wiki-anchor">¶</a></h2>
<p>It becomes a problem that Ruby 3.3 on Linux uses timer threads even for a single-<code>Thread</code>ed application. Because <code>Kernel#fork</code> spawns a thread in the child process before the control returns to the user code, there is no chance to call <code>unshare(CLONE_NEWUSER)</code> in Ruby.</p>
<p>The following snippet is a reproducer of this problem. This program first forks and then shows the user namespace to which the process belongs before and after calling unshare(2). It also shows the threads of the child process after forking.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">p</span><span class="p">(</span><span class="no">RUBY_DESCRIPTION</span><span class="p">:)</span>
<span class="nb">require</span> <span class="s1">'fiddle/import'</span>
<span class="k">module</span> <span class="nn">C</span>
<span class="kp">extend</span> <span class="no">Fiddle</span><span class="o">::</span><span class="no">Importer</span>
<span class="n">dlload</span> <span class="s1">'libc.so.6'</span>
<span class="n">extern</span> <span class="s1">'int unshare(int flags)'</span>
<span class="no">CLONE_NEWUSER</span> <span class="o">=</span> <span class="mh">0x10000000</span>
<span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">raise_system_call_error</span>
<span class="k">raise</span> <span class="no">SystemCallError</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="no">Fiddle</span><span class="p">.</span><span class="nf">last_error</span><span class="p">)</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="n">pid</span> <span class="o">=</span> <span class="nb">fork</span> <span class="k">do</span>
<span class="nb">system</span><span class="p">(</span><span class="s2">"ps -O tid -T -p #$$"</span><span class="p">)</span>
<span class="nb">system</span><span class="p">(</span><span class="s2">"ls -l /proc/self/ns/user"</span><span class="p">)</span>
<span class="k">if</span> <span class="no">C</span><span class="p">.</span><span class="nf">unshare</span><span class="p">(</span><span class="no">C</span><span class="o">::</span><span class="no">CLONE_NEWUSER</span><span class="p">)</span> <span class="o">!=</span> <span class="mi">0</span>
<span class="no">C</span><span class="p">.</span><span class="nf">raise_system_call_error</span> <span class="c1"># => EINVAL with Ruby 3.3</span>
<span class="k">end</span>
<span class="nb">system</span><span class="p">(</span><span class="s2">"ls -l /proc/self/ns/user"</span><span class="p">)</span>
<span class="k">end</span>
<span class="nb">p</span> <span class="no">Process</span><span class="p">.</span><span class="nf">wait2</span><span class="p">(</span><span class="n">pid</span><span class="p">)</span>
</code></pre>
<p>The program successfully changes the user namespace with Ruby 3.2, but it raises EINVAL with Ruby 3.3. You can see Ruby 3.3 has two threads running after forking.</p>
<pre><code>% rbenv shell 3.2 && ruby ./test.rb
{:RUBY_DESCRIPTION=>"ruby 3.2.3 (2024-01-18 revision 52bb2ac0a6) [x86_64-linux]"}
PID TID S TTY TIME COMMAND
1585787 1585787 S pts/12 00:00:00 ruby ./test.rb
lrwxrwxrwx 1 kasumi kasumi 0 Feb 5 02:25 /proc/self/ns/user -> 'user:[4026531837]'
lrwxrwxrwx 1 nobody nogroup 0 Feb 5 02:25 /proc/self/ns/user -> 'user:[4026532675]'
[1585787, #<Process::Status: pid 1585787 exit 0>]
% rbenv shell 3.3 && ruby ./test.rb
{:RUBY_DESCRIPTION=>"ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux]"}
PID TID S TTY TIME COMMAND
1585849 1585849 S pts/12 00:00:00 ruby ./test.rb
1585849 1585851 S pts/12 00:00:00 ruby ./test.rb
lrwxrwxrwx 1 kasumi kasumi 0 Feb 5 02:25 /proc/self/ns/user -> 'user:[4026531837]'
./test.rb:10:in `raise_system_call_error': Invalid argument (Errno::EINVAL)
from ./test.rb:24:in `block in <main>'
from ./test.rb:19:in `fork'
from ./test.rb:19:in `<main>'
[1585849, #<Process::Status: pid 1585849 exit 1>]
% rbenv shell master && ruby ./test.rb
{:RUBY_DESCRIPTION=>"ruby 3.4.0dev (2024-02-04T16:05:02Z master 8bc6fff322) [x86_64-linux]"}
PID TID S TTY TIME COMMAND
1585965 1585965 S pts/12 00:00:00 ruby ./test.rb
1585965 1585967 S pts/12 00:00:00 ruby ./test.rb
lrwxrwxrwx 1 kasumi kasumi 0 Feb 5 02:25 /proc/self/ns/user -> 'user:[4026531837]'
./test.rb:10:in `raise_system_call_error': Invalid argument (Errno::EINVAL)
from ./test.rb:24:in `block in <main>'
from ./test.rb:19:in `fork'
from ./test.rb:19:in `<main>'
[1585965, #<Process::Status: pid 1585965 exit 1>]
</code></pre>
<a name="Workaround"></a>
<h2 >Workaround<a href="#Workaround" class="wiki-anchor">¶</a></h2>
<p>My workaround is to rebuild ruby with <code>rb_thread_stop_timer_thread</code> and <code>rb_thread_start_timer_thread</code> exported, and use a C-ext that stops the timer thread before calling <code>unshare</code>. This seems not robust because the process cannot know when the terminated thread is reclaimed by the kernel, after which the process is considered single-threaded.</p>
<pre><code class="c syntaxhl" data-language="c"><span class="cp">#define _GNU_SOURCE 1
#include</span> <span class="cpf"><sched.h></span><span class="cp">
#include</span> <span class="cpf"><ruby/ruby.h></span><span class="cp">
</span>
<span class="k">static</span> <span class="n">VALUE</span> <span class="nf">Unshare_s_unshare</span><span class="p">(</span><span class="n">VALUE</span> <span class="n">_self</span><span class="p">,</span> <span class="n">VALUE</span> <span class="n">rflags</span><span class="p">)</span> <span class="p">{</span>
<span class="kt">int</span> <span class="k">const</span> <span class="n">flags</span> <span class="o">=</span> <span class="n">NUM2INT</span><span class="p">(</span><span class="n">rflags</span><span class="p">);</span>
<span class="n">rb_thread_stop_timer_thread</span><span class="p">();</span>
<span class="n">usleep</span><span class="p">(</span><span class="mi">1000</span><span class="p">);</span> <span class="c1">// FIXME: It takes some time for the kernel to remove the stopped thread?</span>
<span class="kt">int</span> <span class="k">const</span> <span class="n">ret</span> <span class="o">=</span> <span class="n">unshare</span><span class="p">(</span><span class="n">flags</span><span class="p">);</span>
<span class="n">rb_thread_start_timer_thread</span><span class="p">();</span>
<span class="k">if</span><span class="p">(</span><span class="n">ret</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">)</span> <span class="n">rb_sys_fail_str</span><span class="p">(</span><span class="n">rb_sprintf</span><span class="p">(</span><span class="s">"unshare(%#x)"</span><span class="p">,</span> <span class="n">flags</span><span class="p">));</span>
<span class="k">return</span> <span class="n">Qnil</span><span class="p">;</span>
<span class="p">}</span>
<span class="n">RUBY_FUNC_EXPORTED</span> <span class="kt">void</span>
<span class="nf">Init_unshare</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span> <span class="p">{</span>
<span class="n">VALUE</span> <span class="n">rb_mUnshare</span> <span class="o">=</span> <span class="n">rb_define_module</span><span class="p">(</span><span class="s">"Unshare"</span><span class="p">);</span>
<span class="n">rb_define_singleton_method</span><span class="p">(</span><span class="n">rb_mUnshare</span><span class="p">,</span> <span class="s">"unshare"</span><span class="p">,</span> <span class="n">Unshare_s_unshare</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
<span class="n">rb_define_const</span><span class="p">(</span><span class="n">rb_mUnshare</span><span class="p">,</span> <span class="s">"CLONE_NEWUSER"</span><span class="p">,</span> <span class="n">INT2FIX</span><span class="p">(</span><span class="n">CLONE_NEWUSER</span><span class="p">));</span>
<span class="p">}</span>
</code></pre>
<a name="Questions"></a>
<h2 >Questions<a href="#Questions" class="wiki-anchor">¶</a></h2>
<ul>
<li>Is this a limitation of Ruby?</li>
<li>Is it safe (or even possible) to stop the timer thread during execution?
<ul>
<li>If so, can we export it as the public API?</li>
<li>But it may not so useful for this problem as explained in the workaround.</li>
</ul>
</li>
<li>Is it guaranteed that no other threads are running after forks?</li>
<li>Are there any better ways to solve this issue?
<ul>
<li>Can we somehow delay the start of the timer thread after forking, or hook into <code>fork</code> to run some code in the child process immediately after it spawns.</li>
<li>Can they be Ruby API instead of C API?</li>
</ul>
</li>
</ul> Ruby master - Bug #20203 (Open): `TestEnumerable` test failures with GCC 14https://redmine.ruby-lang.org/issues/202032024-01-22T17:10:42Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<p>There is ongoing mass rebuild in Fedora and that is first time GCC 14 is used and we observe test failures in <code>TestEnumerable</code>. Here are a few examples:</p>
<pre><code>[ 3000/26419] TestEnumerable#test_transient_heap_sort_bymalloc_consolidate(): unaligned fastbin chunk detected
</code></pre>
<pre><code>[ 2455/26535] TestEnumerable#test_transient_heap_sort_bycorrupted size vs. prev_size in fastbins
</code></pre>
<pre><code>[ 9716/26532] TestEnumerable#test_any_with_unused_blockdouble free or corruption (fasttop)
</code></pre>
<p>The full logs are accessible <a href="https://koji.fedoraproject.org/koji/taskinfo?taskID=112176941" class="external">here</a>. Please drill through <code>Descendants</code> and <code>build.log</code></p> Ruby master - Bug #20186 (Open): Ripper does not generate AST for some keywords in Ruby 3.3https://redmine.ruby-lang.org/issues/201862024-01-16T06:39:52Zkzkn (Kazuki Nishikawa)
<p>Ripper does not generate AST for the below keyword:</p>
<ul>
<li>break</li>
<li>next</li>
<li>redo</li>
<li>retry</li>
<li>yield</li>
</ul>
<p>Ruby 3.2</p>
<pre><code>$ ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
$ ruby -rripper -e "p Ripper.sexp('break')"
[:program, [[:break, []]]]
$ ruby -rripper -e "p Ripper.sexp('next')"
[:program, [[:next, []]]]
$ ruby -rripper -e "p Ripper.sexp('redo')"
[:program, [[:redo]]]
$ ruby -rripper -e "p Ripper.sexp('retry')"
[:program, [[:retry]]]
$ ruby -rripper -e "p Ripper.sexp('yield')"
[:program, [[:yield0]]]
</code></pre>
<p>Ruby 3.3</p>
<pre><code>$ ruby -v
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux]
$ ruby -rripper -e "p Ripper.sexp('break')"
nil
$ ruby -rripper -e "p Ripper.sexp('next')"
nil
$ ruby -rripper -e "p Ripper.sexp('redo')"
nil
$ ruby -rripper -e "p Ripper.sexp('retry')"
nil
$ ruby -rripper -e "p Ripper.sexp('yield')"
nil
</code></pre>
<p>EDIT)<br>
Here is a case of real-world problem: <a href="https://github.com/ruby-formatter/rufo/issues/319" class="external">https://github.com/ruby-formatter/rufo/issues/319</a></p> Ruby master - Bug #20179 (Open): `--with-ruby-version` configure option is not correctly applied ...https://redmine.ruby-lang.org/issues/201792024-01-12T13:18:55Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<p>I am trying to configure ruby using <code>--with-ruby-version=ruby3.3</code>. Here is the configure output:</p>
<pre><code>$ /builddir/build/BUILD/ruby-3.3.0/configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --runstatedir=/run --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-compress-debug-sections=no --disable-rpath --enable-mkmf-verbose --enable-shared --with-ruby-version=ruby3.3 --enable-yjit
... snip ...
---
Configuration summary for ruby version 3.3.0
* Installation prefix: /usr
* exec prefix: /usr
* arch: x86_64-linux
* site arch: ${arch}
* RUBY_BASE_NAME: ruby
* enable shared: yes
* ruby lib prefix: ${libdir}/${RUBY_BASE_NAME}
* site libraries path: ${rubylibprefix}/${sitearch}
* vendor path: ${rubylibprefix}/vendor_ruby
* target OS: linux
* compiler: gcc
* with thread: pthread
* with coroutine: amd64
* enable shared libs: yes
* dynamic library ext: so
* CFLAGS: ${optflags} ${debugflags} ${warnflags}
* LDFLAGS: -L. -Wl,-z,relro -Wl,--as-needed \
-Wl,-z,pack-relative-relocs -Wl,-z,now \
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld \
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 \
-Wl,--build-id=sha1 -fstack-protector-strong \
-rdynamic -Wl,-export-dynamic -Wl,--no-as-needed
* DLDFLAGS: -Wl,-z,relro -Wl,--as-needed \
-Wl,-z,pack-relative-relocs -Wl,-z,now \
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld \
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 \
-Wl,--build-id=sha1
* optflags: -O3 -fno-fast-math
* debugflags: -ggdb3
* warnflags: -Wall -Wextra -Wdeprecated-declarations \
-Wdiv-by-zero -Wduplicated-cond \
-Wimplicit-function-declaration -Wimplicit-int \
-Wpointer-arith -Wwrite-strings \
-Wold-style-definition -Wimplicit-fallthrough=0 \
-Wmissing-noreturn -Wno-cast-function-type \
-Wno-constant-logical-operand -Wno-long-long \
-Wno-missing-field-initializers \
-Wno-overlength-strings \
-Wno-packed-bitfield-compat \
-Wno-parentheses-equality -Wno-self-assign \
-Wno-tautological-compare -Wno-unused-parameter \
-Wno-unused-value -Wsuggest-attribute=format \
-Wsuggest-attribute=noreturn -Wunused-variable \
-Wmisleading-indentation -Wundef
* strip command: strip -S -x
* install doc: rdoc
* YJIT support: yes
* RJIT support: yes
* man page type: doc
---
</code></pre>
<p>However, the option is not applied consistently, especially the <code>rubyhdrdir</code> stands out:</p>
<pre><code>$ find . -name \*ruby3.3\*
./usr/lib64/ruby/ruby3.3
./usr/lib64/ruby/site_ruby/ruby3.3
./usr/lib64/ruby/vendor_ruby/ruby3.3
./usr/lib64/ruby/gems/ruby3.3
./usr/lib64/ruby/gems/ruby3.3/extensions/x86_64-linux/ruby3.3
./usr/include/ruby-ruby3.3
./usr/share/ri/ruby3.3
</code></pre>
<p>The correct path should be IMHO <code>./usr/include/ruby3.3</code>. I can likely workaround it by <code>--with-rubyhdrdir</code>, but I think this should behave consistently.</p> Ruby master - Bug #20171 (Open): ri -i ruby interactive pressing tab does not autocompletehttps://redmine.ruby-lang.org/issues/201712024-01-09T17:45:34ZMystorium (Josh Goldfarb)
<p>When typing a Object or Object with a method, the tab button does not pull up autocomplete options.</p>
<p>This issue is not present in ruby 3.2.2</p>
<p>Ex</p>
<p>Type</p>
<ul>
<li>
<p>ri - i</p>
</li>
<li>
<p>String.cap</p>
</li>
</ul>
<p>Press.</p>
<ul>
<li>"Tab"</li>
</ul>
<p>What is expected</p>
<ul>
<li>autocomplete options to populate</li>
</ul>
<p>What is happening</p>
<ul>
<li>Nothing Happens when pressing tab.</li>
</ul> Ruby master - Bug #20155 (Assigned): Using value of rb_fiber_scheduler_current() crashes Rubyhttps://redmine.ruby-lang.org/issues/201552024-01-05T22:14:24Zpaddor (Patrik Wenger)paddor@gmail.com
<p>While trying to manually block/unblock fibers from an extension using the Fiber Scheduler,<br>
I noticed that using the return value of <code>rb_fiber_scheduler_current()</code> crashes Ruby.</p>
<p>I've created a minimal extension gem called "fiber_blocker". Its test suite shows the behavior. See <a href="https://github.com/paddor/fiber_blocker" class="external">https://github.com/paddor/fiber_blocker</a>, especially the lines containing <code>FIXME</code>.</p>
<p>Passing <code>Fiber.scheduler</code> to the extension functions works. But letting it get the current scheduler itself does not seem to work.</p>
<p>Is <code>rb_fiber_scheduler_current()</code>(within a non-blocking Fiber) not the equivalent to <code>Fiber.scheduler</code>?<br>
Even just printing the its return value with <code>#p</code> will crash Ruby.</p>
<p>Ruby either crashes like this:</p>
<pre><code># Running:
T1 BEGIN
T2 BEGIN
T1 END
..T1 BEGIN
ext: blocking fiber
passed scheduler = #<Scheduler:0x00007fc5f22d39e8 @readable={}, @writable={}, @waiting={}, @closed=false, @lock=#<Thread::Mutex:0x00007fc5f22ec8d0>, @blocking={}, @ready=[], @urgent=[#<IO:fd 5>, #<IO:fd 6>]>
T2 BEGIN
ext: unblocking fiber
T1 END
.E
Finished in 1.007014s, 3.9721 runs/s, 2.9791 assertions/s.
1) Error:
TestFiberBlocker#test_fiber_blocker_current_fiber:
fatal: machine stack overflow in critical region
No backtrace
</code></pre>
<p>Or with a segfault:</p>
<pre><code># Running:
FiberBlocker.test works.
.T1 BEGIN
T2 BEGIN
T1 END
.T1 BEGIN
ext: blocking fiber
/home/user/dev/oss/async_ruby_test/rbnng/fiber_blocker/test/test_fiber_blocker.rb:40: [BUG] Segmentation fault at 0x00000000390d8f98
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0003 p:---- s:0012 e:000011 CFUNC :block_fiber
c:0002 p:0014 s:0006 e:000005 BLOCK /home/user/dev/oss/async_ruby_test/rbnng/fiber_blocker/test/test_fiber_blocker.rb:40 [FINISH]
c:0001 p:---- s:0003 e:000002 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
/home/user/dev/oss/async_ruby_test/rbnng/fiber_blocker/test/test_fiber_blocker.rb:40:in `block in test_fiber_blocking_in_ext'
/home/user/dev/oss/async_ruby_test/rbnng/fiber_blocker/test/test_fiber_blocker.rb:40:in `block_fiber'
-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 4
-- Machine register context ------------------------------------------------
RIP: 0x00007f1554f17ad8 RBP: 0x00000000390d8f90 RSP: 0x00007f153a79e280
RAX: 0x00007f1554addba8 RBX: 0x00007f153a79eab0 RCX: 0x0000000000000000
RDX: 0x00007f1554ade600 RDI: 0x00007f15551e8788 RSI: 0x0000000000000ae1
R8: 0x000000000000002b R9: 0x00007f153a79f038 R10: 0x00007f1554c0b9b0
R11: 0x00007f153a79e490 R12: 0x0000000000000ae1 R13: 0x0000000000000000
R14: 0x0000000000000000 R15: 0x000055ab732d7df0 EFL: 0x0000000000010206
-- C level backtrace information -------------------------------------------
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(rb_print_backtrace+0x14) [0x7f1554f24961] /home/user/src/ruby-3.3.0/vm_dump.c:820
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(rb_vm_bugreport) /home/user/src/ruby-3.3.0/vm_dump.c:1151
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(rb_bug_for_fatal_signal+0x104) [0x7f1554d1c214] /home/user/src/ruby-3.3.0/error.c:1065
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(sigsegv+0x4f) [0x7f1554e700df] /home/user/src/ruby-3.3.0/signal.c:926
/lib/x86_64-linux-gnu/libc.so.6(0x7f1554842520) [0x7f1554842520]
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(RBASIC_CLASS+0x0) [0x7f1554f17ad8] ./include/ruby/internal/globals.h:178
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(gccct_method_search) /home/user/src/ruby-3.3.0/vm_eval.c:475
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(rb_funcallv_scope) /home/user/src/ruby-3.3.0/vm_eval.c:1063
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(rb_funcallv) /home/user/src/ruby-3.3.0/vm_eval.c:1084
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(rb_inspect+0x19) [0x7f1554dc1569] /home/user/src/ruby-3.3.0/object.c:697
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(ruby__sfvextra+0x11a) [0x7f1554e7223a] /home/user/src/ruby-3.3.0/sprintf.c:1119
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(BSD_vfprintf+0xa69) [0x7f1554e73059] /home/user/src/ruby-3.3.0/vsnprintf.c:830
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(RBASIC_SET_CLASS_RAW+0x0) [0x7f1554e75b56] /home/user/src/ruby-3.3.0/sprintf.c:1168
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(ruby_vsprintf0) /home/user/src/ruby-3.3.0/sprintf.c:1169
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(rb_enc_vsprintf+0x5d) [0x7f1554e75ecd] /home/user/src/ruby-3.3.0/sprintf.c:1195
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(rb_sprintf+0x9d) [0x7f1554e7607d] /home/user/src/ruby-3.3.0/sprintf.c:1225
/home/user/dev/oss/async_ruby_test/rbnng/fiber_blocker/lib/fiber_blocker/fiber_blocker.so(block_fiber+0x4a) [0x7f1554ad430a] ../../../../ext/fiber_blocker/fiber_blocker.c:29
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(vm_cfp_consistent_p+0x0) [0x7f1554ef64b4] /home/user/src/ruby-3.3.0/vm_insnhelper.c:3490
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(vm_call_cfunc_with_frame_) /home/user/src/ruby-3.3.0/vm_insnhelper.c:3492
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(vm_call_cfunc_with_frame) /home/user/src/ruby-3.3.0/vm_insnhelper.c:3518
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(vm_call_cfunc_other) /home/user/src/ruby-3.3.0/vm_insnhelper.c:3544
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(vm_sendish+0x9e) [0x7f1554f06f87] /home/user/src/ruby-3.3.0/vm_insnhelper.c:5581
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(vm_exec_core) /home/user/src/ruby-3.3.0/insns.def:834
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(rb_vm_exec+0x19a) [0x7f1554f0d1fa] /home/user/src/ruby-3.3.0/vm.c:2486
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(rb_vm_invoke_proc+0x5f) [0x7f1554f12e0f] /home/user/src/ruby-3.3.0/vm.c:1728
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(rb_fiber_start+0x1ba) [0x7f1554cf098a] /home/user/src/ruby-3.3.0/cont.c:2536
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(fiber_entry+0x20) [0x7f1554cf0d00] /home/user/src/ruby-3.3.0/cont.c:847
/home/user/.rubies/ruby-3.3.0/lib/libruby.so.3.3(rb_threadptr_root_fiber_setup) (null):0
</code></pre>
<p>This happens with the Async scheduler as well as with Ruby’s test scheduler. My minimal extension uses Ruby’s.</p>
<p>I hope I'm not missing something obvious. My C isn't very good.</p> Ruby master - Bug #20097 (Open): Regexp#match? with empty capture group repeat is inconsistenthttps://redmine.ruby-lang.org/issues/200972023-12-27T10:56:46Ztompng (tomoya ishida)tomoyapenguin@gmail.com
<p>It sometimes matches and sometimes does not, depend on repeat quantifier number.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="c1"># empty capture group repeat</span>
<span class="nb">p</span> <span class="sr">/(a(){1,4}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> true</span>
<span class="nb">p</span> <span class="sr">/(a(){1,5}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> false</span>
<span class="c1"># repeat of capture group that match to empty string</span>
<span class="nb">p</span> <span class="sr">/(a(|){1,2}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> true</span>
<span class="nb">p</span> <span class="sr">/(a(|){1,3}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> false</span>
<span class="nb">p</span> <span class="sr">/(a(x?y?|z){1,2}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> false</span>
</code></pre>
<p>non-capturing group seems ok.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">p</span> <span class="sr">/(a(?:){1,4}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> true</span>
<span class="nb">p</span> <span class="sr">/(a(?:){1,5}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> true</span>
<span class="nb">p</span> <span class="sr">/(a(?:|){1,2}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> true</span>
<span class="nb">p</span> <span class="sr">/(a(?:|){1,3}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> true</span>
<span class="nb">p</span> <span class="sr">/(a(?:x?y?|z){1,2}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> true</span>
</code></pre>
<p>Same behavior in ruby 3.0, 3.1, 3.2</p> Ruby master - Bug #20088 (Open): Ruby 3.3.0 does not cross-complie on arm64-darwinhttps://redmine.ruby-lang.org/issues/200882023-12-26T15:33:49Zstanhu (Stan Hu)
<p>To reproduce:</p>
<pre><code class="shell syntaxhl" data-language="shell">docker run <span class="nt">-it</span> ghcr.io/rake-compiler/rake-compiler-dock-image:1.4.0.rc2-mri-arm64-darwin bash
<span class="nb">cd</span> /tmp
<span class="nb">export </span><span class="nv">CPPFLAGS</span><span class="o">=</span><span class="s1">''</span>
<span class="nb">export </span><span class="nv">CFLAGS</span><span class="o">=</span><span class="s1">'-O1 -fno-omit-frame-pointer -fno-fast-math -fstack-protector-strong '</span>
<span class="nb">export </span><span class="nv">LDFLAGS</span><span class="o">=</span><span class="s1">'-pipe '</span>
<span class="nb">export </span><span class="nv">CC</span><span class="o">=</span>aarch64-apple-darwin-clang
<span class="nb">export </span><span class="nv">MAKE</span><span class="o">=</span><span class="s1">'make V=1'</span>
rake-compiler cross-ruby <span class="nv">VERSION</span><span class="o">=</span>3.3.0 <span class="nv">HOST</span><span class="o">=</span>aarch64-apple-darwin
</code></pre>
<p>This errors out with:</p>
<pre><code class="shell syntaxhl" data-language="shell">aarch64-apple-darwin-clang <span class="nt">-O1</span> <span class="nt">-fno-omit-frame-pointer</span> <span class="nt">-fno-fast-math</span> <span class="nt">-fstack-protector-strong</span> <span class="nt">-fdeclspec</span> <span class="nt">-O3</span> <span class="nt">-fno-fast-math</span> <span class="nt">-ggdb3</span> <span class="nt">-Wall</span> <span class="nt">-Wextra</span> <span class="nt">-Wextra-tokens</span> <span class="nt">-Wdeprecated-declarations</span> <span class="nt">-Wdivision-by-zero</span> <span class="nt">-Wdiv-by-zero</span> <span class="nt">-Wimplicit-function-declaration</span> <span class="nt">-Wimplicit-int</span> <span class="nt">-Wpointer-arith</span> <span class="nt">-Wshorten-64-to-32</span> <span class="nt">-Wwrite-strings</span> <span class="nt">-Wold-style-definition</span> <span class="nt">-Wmissing-noreturn</span> <span class="nt">-Wno-constant-logical-operand</span> <span class="nt">-Wno-long-long</span> <span class="nt">-Wno-missing-field-initializers</span> <span class="nt">-Wno-overlength-strings</span> <span class="nt">-Wno-parentheses-equality</span> <span class="nt">-Wno-self-assign</span> <span class="nt">-Wno-tautological-compare</span> <span class="nt">-Wno-unused-parameter</span> <span class="nt">-Wno-unused-value</span> <span class="nt">-Wunused-variable</span> <span class="nt">-Wmisleading-indentation</span> <span class="nt">-Wundef</span> <span class="nt">-pipe</span> <span class="nt">-march</span><span class="o">=</span>arm64 <span class="nt">-U_FORTIFY_SOURCE</span> <span class="nt">-D_FORTIFY_SOURCE</span><span class="o">=</span>2 <span class="nt">-fstack-protector-strong</span> <span class="nt">-fno-strict-overflow</span> <span class="nt">-fvisibility</span><span class="o">=</span>hidden <span class="nt">-DRUBY_EXPORT</span> <span class="nt">-fPIE</span> <span class="nt">-I</span><span class="nb">.</span> <span class="nt">-I</span>.ext/include/arm64-darwin <span class="nt">-I</span>/usr/local/rake-compiler/sources/ruby-3.3.0/include <span class="nt">-I</span>/usr/local/rake-compiler/sources/ruby-3.3.0 <span class="nt">-I</span>/usr/local/rake-compiler/sources/ruby-3.3.0/prism <span class="nt">-I</span>/usr/local/rake-compiler/sources/ruby-3.3.0/enc/unicode/15.0.0 <span class="nt">-D_XOPEN_SOURCE</span> <span class="nt">-D_DARWIN_C_SOURCE</span> <span class="nt">-D_DARWIN_UNLIMITED_SELECT</span> <span class="nt">-D_REENTRANT</span> <span class="nt">-o</span> main.o <span class="nt">-c</span> /usr/local/rake-compiler/sources/ruby-3.3.0/main.c
clang: error: the clang compiler does not support <span class="s1">'-march=arm64'</span>
make: <span class="k">***</span> <span class="o">[</span>uncommon.mk:1291: main.o] Error 1
</code></pre>
<p>This appears to be a regression due to <a href="https://github.com/ruby/ruby/pull/9250" class="external">https://github.com/ruby/ruby/pull/9250</a>. <code>RUBY_DEFAULT_ARCH("$target_cpu")</code> is called, and this <code>case</code> statement is hit:</p>
<pre><code data-language="ac">AS_CASE([$build_os],
[darwin*], [ARCH_FLAG="-arch "$1],
[ARCH_FLAG=-march=$1]
</code></pre>
<p>I'm not sure this test is correct, since <code>$build_os</code> appears to be <code>linux-gnu</code>. This results in <code>-march=arm64</code> being used, which is not a valid option even in <code>clang</code> 15.0.0.</p>
<p>Should <code>$target_cpu</code> and <code>$target_os</code> be considered instead?</p>
<p>The <code>configure</code> output shows:</p>
<pre><code>Configuration summary for ruby version 3.3.0
* Installation prefix: /usr/local/rake-compiler/ruby/aarch64-apple-darwin/ruby-3.3.0
* exec prefix: ${prefix}
* arch: arm64-darwin
* site arch: ${arch}
* RUBY_BASE_NAME: ruby
* enable shared: no
* ruby lib prefix: ${libdir}/${RUBY_BASE_NAME}
* site libraries path: ${rubylibprefix}/${sitearch}
* vendor path: ${rubylibprefix}/vendor_ruby
* target OS: darwin
* compiler: aarch64-apple-darwin-clang
* with thread: pthread
* with coroutine: arm64
* enable shared libs: no
* dynamic library ext: bundle
* CFLAGS: -fdeclspec ${optflags} ${debugflags} ${warnflags}
* LDFLAGS: -L. -pipe -fstack-protector-strong
* DLDFLAGS: -pipe -Wl,-multiply_defined,suppress -Wl,-undefined,dynamic_lookup
* optflags: -O3 -fno-fast-math
* debugflags: -ggdb3
* warnflags: -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition \
-Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter \
-Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef
* strip command: aarch64-apple-darwin-strip -A -n
* install doc: no
* YJIT support: no
* RJIT support: no
* man page type: man
* BASERUBY -v: ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux]
</code></pre>
<p>The <code>configure</code> statement for reference:</p>
<pre><code>./configure --host=aarch64-apple-darwin --target=aarch64-apple-darwin --build=x86_64-pc-linux-gnu --enable-install-static-library --disable-jit-support --disable-install-doc --with-ext= --enable-static --disable-shared --prefix=/usr/local/rake-compiler/ruby/aarch64-apple-darwin/ruby-3.3.0
</code></pre>
<p>This was first reported in a CI failure in <a href="https://github.com/rake-compiler/rake-compiler-dock/pull/112#issuecomment-1869367367" class="external">https://github.com/rake-compiler/rake-compiler-dock/pull/112#issuecomment-1869367367</a>.</p> Ruby master - Bug #20081 (Open): Transfered Fiber doesn't return to Fiber that started ithttps://redmine.ruby-lang.org/issues/200812023-12-23T17:44:10Zrmosolgo (Robert Mosolgo)rdmosolgo@gmail.com
<p>Hi! I'm trying to figure out how to make sure that Fibers started with <code>.transfer</code> end up <em>terminated</em>, not just suspended. (If they're suspended, Rails thinks they're still alive, and they continue to hold onto database connections, see: <a href="https://github.com/rmosolgo/graphql-ruby/issues/4739#issuecomment-1866930914" class="external">https://github.com/rmosolgo/graphql-ruby/issues/4739#issuecomment-1866930914</a>.)</p>
<p>So, I'm looking for way to make sure that any Fiber I start with <code>.transfer</code> will be properly terminated. But what I noticed is that when a transfer-based Fiber terminates, it gives control back to the top-most Fiber, not the Fiber which transfered to it. Is this intended? Here's a script to replicate the issue:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">manager</span> <span class="o">=</span> <span class="no">Fiber</span><span class="p">.</span><span class="nf">new</span> <span class="k">do</span>
<span class="n">parent</span> <span class="o">=</span> <span class="no">Fiber</span><span class="p">.</span><span class="nf">current</span>
<span class="n">worker</span> <span class="o">=</span> <span class="no">Fiber</span><span class="p">.</span><span class="nf">new</span> <span class="k">do</span>
<span class="nb">puts</span> <span class="s2">"2. Begin Worker"</span>
<span class="n">parent</span><span class="p">.</span><span class="nf">transfer</span>
<span class="nb">puts</span> <span class="s2">"4. End Worker"</span>
<span class="k">end</span>
<span class="nb">puts</span> <span class="s2">"1. Transfer 1"</span>
<span class="n">worker</span><span class="p">.</span><span class="nf">transfer</span>
<span class="nb">puts</span> <span class="s2">"3. Transfer 2"</span>
<span class="n">worker</span><span class="p">.</span><span class="nf">transfer</span>
<span class="nb">puts</span> <span class="s2">"5. Finished manager"</span>
<span class="k">end</span>
<span class="n">manager</span><span class="p">.</span><span class="nf">transfer</span>
<span class="nb">puts</span> <span class="s2">"6. Finished script"</span>
</code></pre>
<p>I expect the steps to print in order:</p>
<pre><code>1. Transfer 1
2. Begin Worker
3. Transfer 2
4. End Worker
5. Finished manager
6. Finished script
</code></pre>
<p>But instead, <code>5. ...</code> is skipped:</p>
<pre><code>1. Transfer 1
2. Begin Worker
3. Transfer 2
4. End Worker
6. Finished script
</code></pre>
<p>I think that's because my <code>worker</code> fiber terminates and passes control back to the top-level Fiber.</p>
<p>Should it have passed control back to the <code>manager</code>? Or is there another way to make sure <code>worker</code> is terminated, and <code>manager</code> gets control?</p> Ruby master - Bug #20045 (Assigned): `TestDir#test_home` fails on i686https://redmine.ruby-lang.org/issues/200452023-12-07T09:28:07Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<p>This is followup to <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: `TestFileExhaustive#test_expand_path_for_existent_username` and `TestDir#test_home` fails on i686 (Closed)" href="https://redmine.ruby-lang.org/issues/19147">#19147</a>. Testing on Fedora 38 and Fedora Rawhide, we are facing this test failure:</p>
<pre><code>$ tar xf build/SOURCES/ruby-3.2.2.tar.xz
$ cd ruby-3.2.2/
$ ./configure && make
... snip ...
---
Configuration summary for ruby version 3.2.2
* Installation prefix: /usr/local
* exec prefix: ${prefix}
* arch: i686-linux
* site arch: ${arch}
* RUBY_BASE_NAME: ruby
* ruby lib prefix: ${libdir}/${RUBY_BASE_NAME}
* site libraries path: ${rubylibprefix}/${sitearch}
* vendor path: ${rubylibprefix}/vendor_ruby
* target OS: linux
* compiler: gcc
* with thread: pthread
* with coroutine: x86
* enable shared libs: no
* dynamic library ext: so
* CFLAGS: ${optflags} ${debugflags} ${warnflags}
* LDFLAGS: -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic
* DLDFLAGS: -Wl,--compress-debug-sections=zlib
* optflags: -O3 -fno-fast-math
* debugflags: -ggdb3
* warnflags: -Wall -Wextra -Wdeprecated-declarations -Wdiv-by-zero -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wold-style-definition \
-Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat \
-Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wundef
* strip command: strip -S -x
* install doc: rdoc
* MJIT support: yes
* YJIT support: no
* man page type: doc
---
... snip ...
$ LANG=C make test-all 'TESTS=-v -n /TestDir#test_home/'
config.status: creating ruby-runner.h
making mjit_build_dir.so
generating i686-linux-fake.rb
i686-linux-fake.rb updated
Run options:
--seed=10517
"--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems"
--excludes-dir=./test/excludes
--name=!/memory_leak/
-v
-n
/TestDir#test_home/
# Running tests:
[1/0] TestDir#test_home = 0.00 s
1) Error:
TestDir#test_home:
RuntimeError: can't set length of shared string
/builddir/ruby-3.2.2/test/ruby/test_dir.rb:557:in `expand_path'
/builddir/ruby-3.2.2/test/ruby/test_dir.rb:557:in `block in test_home'
Finished tests in 4.164691s, 0.2401 tests/s, 1.6808 assertions/s.
1 tests, 7 assertions, 0 failures, 1 errors, 0 skips
ruby -v: ruby 3.2.2 (2023-03-30 revision e51014f9c0) [i686-linux]
make: *** [uncommon.mk:855: yes-test-all] Error 1
</code></pre>
<p>Please note that having the <code>C</code> locale is essential. The test passes just fine with e.g. <code>C.UTF-8</code> locale.</p>
<p>We were able to reduce the test case to the following:</p>
<pre><code>$ whoami
mockbuild
$ echo 'File.expand_path("~mockbuild")' > test.rb
$ LANG=C RUBYLIB=/builddir/ruby-3.2.2/.ext/i686-linux LD_LIBRARY_PATH=. ./ruby --disable-gems test.rb
test.rb:1:in `expand_path': can't set length of shared string (RuntimeError)
from test.rb:1:in `<main>'
</code></pre>
<p>As I said earlier, the <code>LANG=C</code> is essential as well as the <code>RUBYLIB=/builddir/ruby-3.2.2/.ext/i386-linux</code>. Adding the path to <code>RUBYLIB</code> enables Ruby to load the following libraries:</p>
<pre><code>/builddir/ruby-3.2.2/.ext/i686-linux/enc/encdb.so
/builddir/ruby-3.2.2/.ext/i686-linux/enc/trans/transdb.so
</code></pre>
<p>And that makes the difference. Also, the <code>File.expand_path("~mockbuild")</code> must be in some file, replacing this by <code>-e 'File.expand_path("~mockbuild")'</code> does not reproduce the issue.</p>
<p>We also believe that this was introduced by <a href="https://github.com/ruby/ruby/pull/6699" class="external">https://github.com/ruby/ruby/pull/6699</a>, specifically by <a class="changeset" title="Transition shape when object's capacity changes This commit adds a `capacity` field to shapes, a..." href="https://redmine.ruby-lang.org/projects/ruby-master/repository/git/revisions/5246f4027ec574e77809845e1b1f7822cc2a5cef">git|5246f4027ec574e77809845e1b1f7822cc2a5cef</a> and fixed in master by <a class="changeset" title="Enable 5 size pools on 32 bit systems This commit will allow 32 bit systems to take advantage of..." href="https://redmine.ruby-lang.org/projects/ruby-master/repository/git/revisions/b4571097df4a6bd848f1195026d82a92f3a7f9d8">git|b4571097df4a6bd848f1195026d82a92f3a7f9d8</a>.</p>
<p>Unfortunately, we were not able to discover what is the mechanism behind this, why this depends on locale, why the test must be in file, why the string is shared etc. But I hope we have provided enough details for someone else more knowledgeable.</p>
<p>Some background for this issue is also available here:</p>
<p><a href="https://src.fedoraproject.org/rpms/ruby/pull-request/164" class="external">https://src.fedoraproject.org/rpms/ruby/pull-request/164</a></p> Ruby master - Bug #20020 (Open): Segfault running regexp match?https://redmine.ruby-lang.org/issues/200202023-11-23T16:58:15Zandrea.salicetti@gmail.com (Andrea Salicetti)
<p><strong>Ruby version</strong> : ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-darwin23]</p>
<p>From <code>irb</code>, trying to call <code>match?</code> on this regular expression causes a segmentation falut:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">irb</span><span class="p">(</span><span class="n">main</span><span class="p">):</span><span class="mo">001</span><span class="p">:</span><span class="mi">0</span><span class="o">></span> <span class="sr">/^((a|c)|\s?){1,3}$/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'abc'</span><span class="p">)</span>
<span class="o">=></span> <span class="kp">false</span>
<span class="n">irb</span><span class="p">(</span><span class="n">main</span><span class="p">):</span><span class="mo">002</span><span class="p">:</span><span class="mi">0</span><span class="o">></span> <span class="sr">/^((a|c)|\s?){1,3}$/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'abc'</span><span class="p">)</span>
<span class="p">(</span><span class="n">irb</span><span class="p">):</span><span class="mi">2</span><span class="p">:</span> <span class="p">[</span><span class="no">BUG</span><span class="p">]</span> <span class="no">Segmentation</span> <span class="n">fault</span> <span class="n">at</span> <span class="mh">0x000000061ba998e8</span>
<span class="n">ruby</span> <span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span> <span class="p">(</span><span class="mi">2023</span><span class="o">-</span><span class="mo">03</span><span class="o">-</span><span class="mi">30</span> <span class="n">revision</span> <span class="n">e51014f9c0</span><span class="p">)</span> <span class="p">[</span><span class="n">x86_64</span><span class="o">-</span><span class="n">darwin23</span><span class="p">]</span>
<span class="o">--</span> <span class="no">Crash</span> <span class="no">Report</span> <span class="n">log</span> <span class="n">information</span> <span class="o">--------------------------------------------</span>
<span class="no">See</span> <span class="no">Crash</span> <span class="no">Report</span> <span class="n">log</span> <span class="n">file</span> <span class="k">in</span> <span class="n">one</span> <span class="n">of</span> <span class="n">the</span> <span class="n">following</span> <span class="ss">locations:
</span><span class="o">*</span> <span class="o">~</span><span class="sr">/Library/</span><span class="no">Logs</span><span class="o">/</span><span class="no">DiagnosticReports</span>
<span class="o">*</span> <span class="sr">/Library/</span><span class="no">Logs</span><span class="o">/</span><span class="no">DiagnosticReports</span>
<span class="k">for</span> <span class="n">more</span> <span class="n">details</span><span class="o">.</span>
<span class="no">Don</span><span class="err">'</span><span class="n">t</span> <span class="n">forget</span> <span class="n">to</span> <span class="kp">include</span> <span class="n">the</span> <span class="n">above</span> <span class="no">Crash</span> <span class="no">Report</span> <span class="n">log</span> <span class="n">file</span> <span class="k">in</span> <span class="n">bug</span> <span class="n">reports</span><span class="p">.</span>
<span class="nf">-</span><span class="o">-</span> <span class="no">Control</span> <span class="n">frame</span> <span class="n">information</span> <span class="o">-----------------------------------------------</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0037</span> <span class="nb">p</span><span class="p">:</span><span class="o">----</span> <span class="n">s</span><span class="p">:</span><span class="mo">0207</span> <span class="n">e</span><span class="p">:</span><span class="mo">000206</span> <span class="no">CFUNC</span> <span class="ss">:match?</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0036</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0006</span> <span class="n">s</span><span class="p">:</span><span class="mo">0202</span> <span class="n">e</span><span class="p">:</span><span class="mo">000201</span> <span class="no">EVAL</span> <span class="p">(</span><span class="n">irb</span><span class="p">):</span><span class="mi">2</span> <span class="p">[</span><span class="no">FINISH</span><span class="p">]</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0035</span> <span class="nb">p</span><span class="p">:</span><span class="o">----</span> <span class="n">s</span><span class="p">:</span><span class="mo">01</span><span class="mi">99</span> <span class="n">e</span><span class="p">:</span><span class="mo">0001</span><span class="mi">98</span> <span class="no">CFUNC</span> <span class="ss">:eval</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0034</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0020</span> <span class="n">s</span><span class="p">:</span><span class="mo">01</span><span class="mi">91</span> <span class="n">e</span><span class="p">:</span><span class="mo">0001</span><span class="mi">90</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="o">/</span><span class="n">workspace</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">119</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0033</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0153</span> <span class="n">s</span><span class="p">:</span><span class="mo">01</span><span class="mi">83</span> <span class="n">e</span><span class="p">:</span><span class="mo">0001</span><span class="mi">81</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="o">/</span><span class="n">context</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">502</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0032</span> <span class="nb">p</span><span class="p">:</span><span class="mo">011</span><span class="mi">9</span> <span class="n">s</span><span class="p">:</span><span class="mo">0170</span> <span class="n">e</span><span class="p">:</span><span class="mo">00016</span><span class="mi">9</span> <span class="no">BLOCK</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">588</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0031</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0024</span> <span class="n">s</span><span class="p">:</span><span class="mo">0164</span> <span class="n">e</span><span class="p">:</span><span class="mo">000163</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">777</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0030</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0007</span> <span class="n">s</span><span class="p">:</span><span class="mo">015</span><span class="mi">8</span> <span class="n">e</span><span class="p">:</span><span class="mo">000157</span> <span class="no">BLOCK</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">567</span>
<span class="n">c</span><span class="p">:</span><span class="mo">002</span><span class="mi">9</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0126</span> <span class="n">s</span><span class="p">:</span><span class="mo">0153</span> <span class="n">e</span><span class="p">:</span><span class="mo">000152</span> <span class="no">BLOCK</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="o">/</span><span class="n">ruby</span><span class="o">-</span><span class="n">lex</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">267</span> <span class="p">[</span><span class="no">FINISH</span><span class="p">]</span>
<span class="n">c</span><span class="p">:</span><span class="mo">002</span><span class="mi">8</span> <span class="nb">p</span><span class="p">:</span><span class="o">----</span> <span class="n">s</span><span class="p">:</span><span class="mo">014</span><span class="mi">9</span> <span class="n">e</span><span class="p">:</span><span class="mo">00014</span><span class="mi">8</span> <span class="no">CFUNC</span> <span class="ss">:loop</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0027</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0005</span> <span class="n">s</span><span class="p">:</span><span class="mo">0145</span> <span class="n">e</span><span class="p">:</span><span class="mo">000144</span> <span class="no">BLOCK</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="o">/</span><span class="n">ruby</span><span class="o">-</span><span class="n">lex</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">249</span> <span class="p">[</span><span class="no">FINISH</span><span class="p">]</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0026</span> <span class="nb">p</span><span class="p">:</span><span class="o">----</span> <span class="n">s</span><span class="p">:</span><span class="mo">0142</span> <span class="n">e</span><span class="p">:</span><span class="mo">000141</span> <span class="no">CFUNC</span> <span class="ss">:catch</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0025</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0010</span> <span class="n">s</span><span class="p">:</span><span class="mo">0137</span> <span class="n">e</span><span class="p">:</span><span class="mo">000136</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="o">/</span><span class="n">ruby</span><span class="o">-</span><span class="n">lex</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">248</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0024</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0050</span> <span class="n">s</span><span class="p">:</span><span class="mo">0132</span> <span class="no">E</span><span class="p">:</span><span class="mo">000</span><span class="n">dd8</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">566</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0023</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0003</span> <span class="n">s</span><span class="p">:</span><span class="mo">0127</span> <span class="n">e</span><span class="p">:</span><span class="mo">000126</span> <span class="no">BLOCK</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">500</span> <span class="p">[</span><span class="no">FINISH</span><span class="p">]</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0022</span> <span class="nb">p</span><span class="p">:</span><span class="o">----</span> <span class="n">s</span><span class="p">:</span><span class="mo">0124</span> <span class="n">e</span><span class="p">:</span><span class="mo">000123</span> <span class="no">CFUNC</span> <span class="ss">:catch</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0021</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0050</span> <span class="n">s</span><span class="p">:</span><span class="mo">011</span><span class="mi">9</span> <span class="no">E</span><span class="p">:</span><span class="mo">000</span><span class="n">d50</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">499</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0020</span> <span class="nb">p</span><span class="p">:</span><span class="mo">006</span><span class="mi">9</span> <span class="n">s</span><span class="p">:</span><span class="mo">0113</span> <span class="n">e</span><span class="p">:</span><span class="mo">000112</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">421</span>
<span class="n">c</span><span class="p">:</span><span class="mo">001</span><span class="mi">9</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0012</span> <span class="n">s</span><span class="p">:</span><span class="mo">0107</span> <span class="n">e</span><span class="p">:</span><span class="mo">000106</span> <span class="no">TOP</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">gems</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">gems</span><span class="o">/</span><span class="n">irb</span><span class="o">-</span><span class="mf">1.6</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">exe</span><span class="o">/</span><span class="n">irb</span><span class="p">:</span><span class="mi">11</span> <span class="p">[</span><span class="no">FINISH</span><span class="p">]</span>
<span class="n">c</span><span class="p">:</span><span class="mo">001</span><span class="mi">8</span> <span class="nb">p</span><span class="p">:</span><span class="o">----</span> <span class="n">s</span><span class="p">:</span><span class="mo">0104</span> <span class="n">e</span><span class="p">:</span><span class="mo">000103</span> <span class="no">CFUNC</span> <span class="ss">:load</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0017</span> <span class="nb">p</span><span class="p">:</span><span class="mo">007</span><span class="mi">8</span> <span class="n">s</span><span class="p">:</span><span class="mo">00</span><span class="mi">99</span> <span class="n">e</span><span class="p">:</span><span class="mo">0000</span><span class="mi">98</span> <span class="no">TOP</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">irb</span><span class="p">:</span><span class="mi">25</span> <span class="p">[</span><span class="no">FINISH</span><span class="p">]</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0016</span> <span class="nb">p</span><span class="p">:</span><span class="o">----</span> <span class="n">s</span><span class="p">:</span><span class="mo">00</span><span class="mi">94</span> <span class="n">e</span><span class="p">:</span><span class="mo">0000</span><span class="mi">93</span> <span class="no">CFUNC</span> <span class="ss">:load</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0015</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0064</span> <span class="n">s</span><span class="p">:</span><span class="mo">00</span><span class="mi">89</span> <span class="n">e</span><span class="p">:</span><span class="mo">0000</span><span class="mi">88</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">cli</span><span class="o">/</span><span class="nb">exec</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">58</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0014</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0050</span> <span class="n">s</span><span class="p">:</span><span class="mo">00</span><span class="mi">83</span> <span class="n">e</span><span class="p">:</span><span class="mo">0000</span><span class="mi">82</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">cli</span><span class="o">/</span><span class="nb">exec</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">23</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0013</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0034</span> <span class="n">s</span><span class="p">:</span><span class="mo">007</span><span class="mi">8</span> <span class="n">e</span><span class="p">:</span><span class="mo">000077</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">cli</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">492</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0012</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0054</span> <span class="n">s</span><span class="p">:</span><span class="mo">0073</span> <span class="n">e</span><span class="p">:</span><span class="mo">000072</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">vendor</span><span class="o">/</span><span class="n">thor</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">thor</span><span class="o">/</span><span class="n">command</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">28</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0011</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0040</span> <span class="n">s</span><span class="p">:</span><span class="mo">0065</span> <span class="n">e</span><span class="p">:</span><span class="mo">000064</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">vendor</span><span class="o">/</span><span class="n">thor</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">thor</span><span class="o">/</span><span class="n">invocation</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">127</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0010</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0213</span> <span class="n">s</span><span class="p">:</span><span class="mo">005</span><span class="mi">8</span> <span class="n">e</span><span class="p">:</span><span class="mo">000057</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">vendor</span><span class="o">/</span><span class="n">thor</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">thor</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">527</span>
<span class="n">c</span><span class="p">:</span><span class="mo">000</span><span class="mi">9</span> <span class="nb">p</span><span class="p">:</span><span class="mo">000</span><span class="mi">8</span> <span class="n">s</span><span class="p">:</span><span class="mo">0045</span> <span class="n">e</span><span class="p">:</span><span class="mo">000044</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">cli</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">34</span>
<span class="n">c</span><span class="p">:</span><span class="mo">000</span><span class="mi">8</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0044</span> <span class="n">s</span><span class="p">:</span><span class="mo">0040</span> <span class="n">e</span><span class="p">:</span><span class="mo">00003</span><span class="mi">9</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">vendor</span><span class="o">/</span><span class="n">thor</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">thor</span><span class="o">/</span><span class="n">base</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">584</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0007</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0022</span> <span class="n">s</span><span class="p">:</span><span class="mo">0033</span> <span class="n">e</span><span class="p">:</span><span class="mo">000032</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">cli</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">28</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0006</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0042</span> <span class="n">s</span><span class="p">:</span><span class="mo">002</span><span class="mi">8</span> <span class="n">e</span><span class="p">:</span><span class="mo">000027</span> <span class="no">BLOCK</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">gems</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">gems</span><span class="o">/</span><span class="n">bundler</span><span class="o">-</span><span class="mf">2.4</span><span class="o">.</span><span class="mi">22</span><span class="o">/</span><span class="n">exe</span><span class="o">/</span><span class="n">bundle</span><span class="p">:</span><span class="mi">37</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0005</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0007</span> <span class="n">s</span><span class="p">:</span><span class="mo">0022</span> <span class="n">e</span><span class="p">:</span><span class="mo">000021</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">friendly_errors</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">117</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0004</span> <span class="nb">p</span><span class="p">:</span><span class="mo">010</span><span class="mi">8</span> <span class="n">s</span><span class="p">:</span><span class="mo">0017</span> <span class="no">E</span><span class="p">:</span><span class="mo">001</span><span class="mi">9</span><span class="n">b8</span> <span class="no">TOP</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">gems</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">gems</span><span class="o">/</span><span class="n">bundler</span><span class="o">-</span><span class="mf">2.4</span><span class="o">.</span><span class="mi">22</span><span class="o">/</span><span class="n">exe</span><span class="o">/</span><span class="n">bundle</span><span class="p">:</span><span class="mi">29</span> <span class="p">[</span><span class="no">FINISH</span><span class="p">]</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0003</span> <span class="nb">p</span><span class="p">:</span><span class="o">----</span> <span class="n">s</span><span class="p">:</span><span class="mo">0013</span> <span class="n">e</span><span class="p">:</span><span class="mo">000012</span> <span class="no">CFUNC</span> <span class="ss">:load</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0002</span> <span class="nb">p</span><span class="p">:</span><span class="mo">00</span><span class="mi">81</span> <span class="n">s</span><span class="p">:</span><span class="mo">000</span><span class="mi">8</span> <span class="no">E</span><span class="p">:</span><span class="mo">000220</span> <span class="no">EVAL</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">bundle</span><span class="p">:</span><span class="mi">25</span> <span class="p">[</span><span class="no">FINISH</span><span class="p">]</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0001</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0000</span> <span class="n">s</span><span class="p">:</span><span class="mo">0003</span> <span class="no">E</span><span class="p">:</span><span class="mo">001</span><span class="mi">980</span> <span class="no">DUMMY</span> <span class="p">[</span><span class="no">FINISH</span><span class="p">]</span>
</code></pre>
<p>Sometimes this happens the very first time I try to execute the command, some other times I have to try a couple of times to see that Segmentation Fault (but usually within the first 5 attempts).</p> Ruby master - Bug #19996 (Assigned): `RUBY_MN_THREADS=1` triggers Action Cable unit test failureshttps://redmine.ruby-lang.org/issues/199962023-11-10T04:16:56Zyahonda (Yasuo Honda)yasuo.honda@gmail.com
<a name="Steps-to-reproduce"></a>
<h3 >Steps to reproduce<a href="#Steps-to-reproduce" class="wiki-anchor">¶</a></h3>
<ol>
<li>Install <code>ruby 3.3.0dev</code>
</li>
<li>Set <code>RUBY_MN_THREADS=1</code> environment variable</li>
<li>Follow these steps</li>
</ol>
<pre><code>git clone https://github.com/rails/rails
cd rails
rm Gemfile.lock
bundle install
cd actioncable
bin/test test/channel/base_test.rb test/subscription_adapter/redis_test.rb test/channel/test_case_test.rb test/subscription_adapter/redis_test.rb test/client_test.rb --seed 14800
</code></pre>
<a name="Expected-behavior"></a>
<h3 >Expected behavior<a href="#Expected-behavior" class="wiki-anchor">¶</a></h3>
<p>It should pass as not setting <code>RUBY_MN_THREADS</code>.</p>
<pre><code>$ unset RUBY_MN_THREADS
$ bin/test test/channel/base_test.rb test/subscription_adapter/redis_test.rb test/channel/test_case_test.rb test/subscription_adapter/redis_test.rb test/client_test.rb --seed 14800
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/gems/minitest-5.20.0/lib/minitest.rb:3: warning: mutex_m which will no longer be part of the default gems since Ruby 3.4.0. Add mutex_m to your Gemfile or gemspec.
Run options: --seed 14800
# Running:
.........................................................................
Finished in 12.031310s, 6.0675 runs/s, 46.7115 assertions/s.
73 runs, 562 assertions, 0 failures, 0 errors, 0 skips
$
</code></pre>
<a name="Actual-behavior"></a>
<h3 >Actual behavior<a href="#Actual-behavior" class="wiki-anchor">¶</a></h3>
<p>It usually fails as follows.</p>
<pre><code>$ bin/test test/channel/base_test.rb test/subscription_adapter/redis_test.rb test/channel/test_case_test.rb test/subscription_adapter/redis_test.rb test/client_test.rb --seed 14800
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/gems/minitest-5.20.0/lib/minitest.rb:3: warning: mutex_m which will no longer be part of the default gems since Ruby 3.4.0. Add mutex_m to your Gemfile or gemspec.
Run options: --seed 14800
# Running:
..................................................F
Failure:
RedisAdapterTest::AlternateConfiguration#test_channel_prefix [/home/yahonda/src/github.com/rails/rails/actioncable/test/subscription_adapter/common.rb:35]:
Expected #<Concurrent::Event:0x00007f0b2698d4f0 @__Lock__=#<Thread::Mutex:0x00007f0b26f8cab8>, @__Condition__=#<Thread::ConditionVariable:0x00007f0b26f8ca90>, @set=false, @iteration=0> to be set?.
bin/test test/subscription_adapter/channel_prefix.rb:6
.F
Failure:
RedisAdapterTest::AlternateConfiguration#test_multiple_broadcast [/home/yahonda/src/github.com/rails/rails/actioncable/test/subscription_adapter/common.rb:35]:
Expected #<Concurrent::Event:0x00007f0b2698a4d0 @__Lock__=#<Thread::Mutex:0x00007f0b26fac688>, @__Condition__=#<Thread::ConditionVariable:0x00007f0b26fac4f8>, @set=false, @iteration=0> to be set?.
bin/test test/subscription_adapter/common.rb:74
E
Error:
ClientTest#test_interacting_clients:
ThreadError: queue empty
<internal:thread_sync>:18:in `pop'
/home/yahonda/src/github.com/rails/rails/actioncable/test/client_test.rb:168:in `read_message'
/home/yahonda/src/github.com/rails/rails/actioncable/test/client_test.rb:241:in `block (2 levels) in test_interacting_clients'
/home/yahonda/src/github.com/rails/rails/actioncable/test/client_test.rb:218:in `block (2 levels) in concurrently'
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/promises.rb:1583:in `evaluate_to'
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/promises.rb:1766:in `block in on_resolvable'
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:352:in `run_task'
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:343:in `block (3 levels) in create_worker'
<internal:kernel>:187:in `loop'
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `block (2 levels) in create_worker'
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:333:in `catch'
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:333:in `block in create_worker'
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/promises.rb:1258:in `raise'
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/promises.rb:1258:in `wait_until_resolved!'
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/gems/concurrent-ruby-1.2.2/lib/concurrent-ruby/concurrent/promises.rb:988:in `value!'
/home/yahonda/src/github.com/rails/rails/actioncable/test/client_test.rb:218:in `map'
/home/yahonda/src/github.com/rails/rails/actioncable/test/client_test.rb:218:in `concurrently'
/home/yahonda/src/github.com/rails/rails/actioncable/test/client_test.rb:240:in `block in test_interacting_clients'
/home/yahonda/src/github.com/rails/rails/actioncable/test/client_test.rb:90:in `with_puma_server'
/home/yahonda/src/github.com/rails/rails/actioncable/test/client_test.rb:234:in `test_interacting_clients'
bin/test test/client_test.rb:233
E
Error:
ClientTest#test_disappearing_client:
ThreadError: queue empty
<internal:thread_sync>:18:in `pop'
/home/yahonda/src/github.com/rails/rails/actioncable/test/client_test.rb:168:in `read_message'
/home/yahonda/src/github.com/rails/rails/actioncable/test/client_test.rb:275:in `block in test_disappearing_client'
/home/yahonda/src/github.com/rails/rails/actioncable/test/client_test.rb:90:in `with_puma_server'
/home/yahonda/src/github.com/rails/rails/actioncable/test/client_test.rb:273:in `test_disappearing_client'
bin/test test/client_test.rb:272
..................
Finished in 1323.812615s, 0.0551 runs/s, 0.3830 assertions/s.
73 runs, 507 assertions, 2 failures, 2 errors, 0 skips
$
</code></pre> Ruby master - Bug #19986 (Open): Win32: `HOME` is set to just `HOMEDRIVE` if `HOMEPATH` is unsethttps://redmine.ruby-lang.org/issues/199862023-11-05T03:15:02Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<pre><code>$ env -u HOME -u USERPROFILE -u HOMEPATH HOMEDRIVE=no/such/home ./miniruby.exe -e 'p ENV["HOME"], Dir.home'
"no/such/home"
"no/such/home"
</code></pre>
<p><code>HOMEDRIVE</code> should be ignored without <code>HOMEPATH</code>, and <code>HOME</code> should fallback to <code>CSIDL_PROFILE</code>.</p> Ruby master - Bug #19920 (Open): Ruby 3.1 fails to build with --enable-shared on macos-arm64: is ...https://redmine.ruby-lang.org/issues/199202023-10-12T11:02:55ZEregon (Benoit Daloze)
<p>See <a href="https://github.com/ruby/ruby-builder/actions/runs/6494296018/job/17636968796#step:18:9" class="external">https://github.com/ruby/ruby-builder/actions/runs/6494296018/job/17636968796#step:18:9</a></p>
<pre><code>installing bundled gems: /Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib/ruby/gems/3.1.0
minitest 5.15.0
power_assert 2.0.1
rake 13.0.6
test-unit 3.5.3
rexml 3.2.5
rss 0.2.9
net-ftp 0.1.3
net-imap 0.2.3
net-pop 0.1.1
net-smtp 0.3.1
matrix 0.4.2
prime 0.1.2
rbs 2.7.0
Building native extensions. This could take a while...
/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:102:in `run': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)
current directory: /Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib/ruby/gems/3.1.0/gems/rbs-2.7.0/ext/rbs_extension
/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/bin/ruby -I /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib extconf.rb
checking for whether -std=c99 is accepted as CFLAGS... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/bin/$(RUBY_BASE_NAME)
/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:490:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:616:in `block in try_compile'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:563:in `with_werror'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:616:in `try_compile'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:680:in `try_cflags'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:1025:in `block (2 levels) in append_cflags'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:989:in `block in checking_for'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:354:in `block (2 levels) in postpone'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:324:in `open'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:354:in `block in postpone'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:324:in `open'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:350:in `postpone'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:988:in `checking_for'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:1024:in `block in append_cflags'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:1023:in `each'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:1023:in `append_cflags'
from extconf.rb:3:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib/ruby/gems/3.1.0/extensions/arm64-darwin-22/3.1.0/rbs-2.7.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib/ruby/gems/3.1.0/gems/rbs-2.7.0 for inspection.
Results logged to /Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib/ruby/gems/3.1.0/extensions/arm64-darwin-22/3.1.0/rbs-2.7.0/gem_make.out
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/ext_conf_builder.rb:28:in `build'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:171:in `build_extension'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:205:in `block in build_extensions'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:202:in `each'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:202:in `build_extensions'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/installer.rb:843:in `build_extensions'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/installer.rb:326:in `install'
from ./tool/rbinstall.rb:899:in `block in install'
from ./tool/rbinstall.rb:713:in `no_write'
from ./tool/rbinstall.rb:899:in `install'
from ./tool/rbinstall.rb:1063:in `block (2 levels) in <main>'
from ./tool/rbinstall.rb:1044:in `foreach'
from ./tool/rbinstall.rb:1044:in `block in <main>'
from ./tool/rbinstall.rb:1119:in `block in <main>'
from ./tool/rbinstall.rb:1116:in `each'
from ./tool/rbinstall.rb:1116:in `<main>'
/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:102:in `run': extconf failed, exit code 1 (Gem::InstallError)
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/ext_conf_builder.rb:28:in `build'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:171:in `build_extension'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:205:in `block in build_extensions'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:202:in `each'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:202:in `build_extensions'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/installer.rb:843:in `build_extensions'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/installer.rb:326:in `install'
from ./tool/rbinstall.rb:899:in `block in install'
from ./tool/rbinstall.rb:713:in `no_write'
from ./tool/rbinstall.rb:899:in `install'
from ./tool/rbinstall.rb:1063:in `block (2 levels) in <main>'
from ./tool/rbinstall.rb:1044:in `foreach'
from ./tool/rbinstall.rb:1044:in `block in <main>'
from ./tool/rbinstall.rb:1119:in `block in <main>'
from ./tool/rbinstall.rb:1116:in `each'
from ./tool/rbinstall.rb:1116:in `<main>'
make: *** [do-install-nodoc] Error 1
BUILD FAILED (macOS 13.6 using ruby-build 20231012)
</code></pre>
<p>And the mkmf.log:</p>
<pre><code>DYLD_FALLBACK_LIBRARY_PATH=.:/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib:/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4 "clang -o conftest -I/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/include/ruby-3.1.0/arm64-darwin22 -I/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/include/ruby-3.1.0/ruby/backward -I/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/include/ruby-3.1.0 -I. -I/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/include -DENABLE_PATH_CHECK=0 -I/opt/homebrew/opt/gmp/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -Wundef -fno-common -pipe conftest.c -L. -L/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib -L. -L/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib -fstack-protector-strong -L/opt/homebrew/opt/gmp/lib -lruby.3.1 "
dyld[47952]: terminating because inserted dylib '/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/libruby.3.1.dylib' could not be loaded: tried: '/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need '')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/libruby.3.1.dylib' (no such file), '/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need '')), './libruby.3.1.dylib' (no such file), '/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need ''))
dyld[47952]: tried: '/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need '')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/libruby.3.1.dylib' (no such file), '/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need '')), './libruby.3.1.dylib' (no such file), '/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need ''))
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
</code></pre>
<p>I believe this bug has nothing to do with ruby-build except that ruby-build does <code>--enable-shared</code> by default.</p>
<p>A known workaround is to use <code>--disable-shared</code>: <a href="https://github.com/rbenv/ruby-build/discussions/1961#discussioncomment-4031745" class="external">https://github.com/rbenv/ruby-build/discussions/1961#discussioncomment-4031745</a><br>
Lots of other people met the same or similar issue as discussed there.<br>
Also discussed in <a href="https://github.com/ruby/rbs/issues/877" class="external">https://github.com/ruby/rbs/issues/877</a></p>
<p>It would be nice if this could be fixed on the 3.1 branch.</p> Ruby master - Bug #19910 (Open): Set#delete_if behavior inconsistent with Array/Hashhttps://redmine.ruby-lang.org/issues/199102023-10-02T21:05:34Zsegiddins (Samuel Giddins)segiddins@segiddins.me
<p>Given the following script:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="c1">#!/usr/bin/env ruby</span>
<span class="nb">require</span> <span class="s1">'set'</span>
<span class="k">def</span> <span class="nf">enum</span><span class="p">(</span><span class="n">collection</span><span class="p">)</span>
<span class="n">i</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">collection</span><span class="p">.</span><span class="nf">delete_if</span> <span class="k">do</span>
<span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span>
<span class="k">raise</span> <span class="no">ArgumentError</span> <span class="k">if</span> <span class="n">i</span> <span class="o">==</span> <span class="mi">6</span>
<span class="n">i</span><span class="p">.</span><span class="nf">odd?</span>
<span class="k">end</span>
<span class="k">rescue</span> <span class="no">ArgumentError</span>
<span class="k">return</span> <span class="n">collection</span>
<span class="k">end</span>
<span class="n">pp</span> <span class="n">enum</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">])</span>
<span class="n">pp</span> <span class="n">enum</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">].</span><span class="nf">to_h</span> <span class="p">{</span> <span class="p">[</span><span class="n">_1</span><span class="p">,</span> <span class="n">_1</span><span class="p">]</span> <span class="p">})</span>
<span class="n">pp</span> <span class="n">enum</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">].</span><span class="nf">to_set</span><span class="p">)</span>
</code></pre>
<p>It results in:</p>
<pre><code>[1, 3, 5, 6, 7]
{1=>1, 3=>3, 5=>5, 6=>6, 7=>7}
#<Set: {0, 1, 2, 3, 4, 5, 6, 7}>
</code></pre>
<p>As you can see, when an exception is raise inside <code>delete_if</code> on Hash/Array, the already-considered elements are still removed from the array. For <code>Set</code>, no elements are deleted (due to the implementation that builds up an intermediary list of elements to delete, then removes them from the underlying hash afterwards). It would be very helpful if <code>Set#delete_if</code> behaved consistently with other core collection types</p> Ruby master - Bug #19875 (Open): Ruby 3.0 -> 3.1 Performance regression in String#counthttps://redmine.ruby-lang.org/issues/198752023-09-12T14:18:33Ziz (Illia Zub)
<p><code>String#count</code> became slower since Ruby 3.1. Originally found by <code>@Freaky</code>: <a href="https://github.com/ruby/ruby/pull/4001#issuecomment-1714779781" class="external">https://github.com/ruby/ruby/pull/4001#issuecomment-1714779781</a></p>
<p>Compared using the <a href="https://github.com/benchmark-driver/benchmark-driver" class="external"><code>benchmark-driver</code> gem</a>.</p>
<pre><code>$ benchmark-driver tmp/string_count_benchmark_driver.yml --rbenv '3.1.1;3.1.4;2.7.2;3.2.2;3.0.6'
Calculating -------------------------------------
3.1.1 3.1.4 2.7.2 3.2.2 3.0.6
count 465.804 463.741 865.783 462.711 857.395 i/s - 10.000k times in 21.468251s 21.563768s 11.550239s 21.611783s 11.663235s
Comparison:
count
2.7.2: 865.8 i/s
3.0.6: 857.4 i/s - 1.01x slower
3.1.1: 465.8 i/s - 1.86x slower
3.1.4: 463.7 i/s - 1.87x slower
3.2.2: 462.7 i/s - 1.87x slower
</code></pre>
<p>Benchmark:</p>
<pre><code class="yml syntaxhl" data-language="yml"><span class="s">$ cat ./tmp/string_count_benchmark_driver.yml</span>
<span class="na">loop_count</span><span class="pi">:</span> <span class="s">10_000</span>
<span class="na">prelude</span><span class="pi">:</span> <span class="pi">|</span>
<span class="s">html = "\nruby\n" * 1024 * 1024</span>
<span class="na">benchmark</span><span class="pi">:</span>
<span class="na">count</span><span class="pi">:</span> <span class="s">html.count($/)</span>
</code></pre>
<hr>
<p><em>Initially, I noticed the difference between <code>str.count($/)</code> and <code>str.lines.size</code> when working on the performance improvement: <a href="https://serpapi.com/blog/lines-count-failed-deployments/" class="external">https://serpapi.com/blog/lines-count-failed-deployments/</a></em></p> Ruby master - Bug #19865 (Open): Segfault when calling user signal handlers during VM shutdownhttps://redmine.ruby-lang.org/issues/198652023-09-06T08:56:16Zivoanjo (Ivo Anjo)ivo.anjo@datadoghq.com
<p>Howdy 👋! I work for Datadog <a href="https://github.com/DataDog/dd-trace-rb" class="external">on the <code>ddtrace</code> gem</a> . I've found this issue while investigating a <a href="https://github.com/DataDog/dd-trace-rb/issues/2980" class="external">customer crash report</a>.</p>
<a name="Background"></a>
<h3 >Background<a href="#Background" class="wiki-anchor">¶</a></h3>
<p>The original issue was found in a production app. A number of things need to be in play to cause it.</p>
<p>The <a href="https://rubygems.org/gems/ruby-odbc" class="external"><code>ruby-odbc</code></a> gem provides a way of accessing databases through the ODBC API. It wraps a database connection as a Data object, with a free function that, prior to freeing the native resources, disconnects from the database if the connection was still active.</p>
<p>Because disconnecting from the database is a blocking operation, the gem (reasonably, in my opinion), releases the global VM lock before disconnecting.</p>
<p>The trigger for the crash is:</p>
<ol>
<li>The app in question used puma, and puma installs a <code>Signal.trap('TERM')</code>
</li>
<li>The database object was still connected when the app started to shut down</li>
<li>A VM shutdown starts...</li>
<li>Half-way through shutdown, the VM received a SIGTERM signal, and queued it for processing</li>
<li>The VM calls the free function on all objects</li>
<li>The ruby-odbc gem sees there's an active database connection, and tries to release the GVL to call the blocking disconnect</li>
<li>Before releasing the GVL, the VM checks for pending interruptions</li>
<li>The VM tries to run the Ruby-level signal handler method half-way through VM shutdown, when you can no longer run Ruby code</li>
<li>Segfault</li>
</ol>
<a name="How-to-reproduce-Ruby-version-amp-script"></a>
<h3 >How to reproduce (Ruby version & script)<a href="#How-to-reproduce-Ruby-version-amp-script" class="wiki-anchor">¶</a></h3>
<p>I was able to reproduce on a minimal example on Ruby 3.2.2 (<code>ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]</code>) and recent master (<code>ruby 3.3.0dev (2023-08-17T07:30:01Z master d26b015e83) [x86_64-linux]</code>).</p>
<p>I've put the test-case up on github as well <a href="https://github.com/DataDog/signal-bug-testcase" class="external">https://github.com/DataDog/signal-bug-testcase</a>, but here's the important bits:</p>
<p><code>signal-bug-testcase.rb</code>:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="s1">'signal_bug_testcase'</span>
<span class="no">Signal</span><span class="p">.</span><span class="nf">trap</span><span class="p">(</span><span class="s2">"TERM"</span><span class="p">)</span> <span class="p">{</span> <span class="nb">puts</span> <span class="s2">"Hello, world"</span> <span class="p">}</span>
<span class="no">FOO</span> <span class="o">=</span> <span class="no">SignalBugTestcase</span><span class="p">.</span><span class="nf">new</span>
</code></pre>
<p><code>signal_bug_testcase.c</code>:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="c1">#include <ruby.h></span>
<span class="c1">#include <ruby/thread.h></span>
<span class="c1">#include <signal.h></span>
<span class="c1">#include <unistd.h></span>
<span class="n">typedef</span> <span class="n">struct</span> <span class="p">{</span> <span class="n">int</span> <span class="n">dummy</span><span class="p">;</span> <span class="p">}</span> <span class="no">BugTestcase</span><span class="p">;</span>
<span class="n">void</span> <span class="o">*</span><span class="n">test_nogvl</span><span class="p">(</span><span class="n">void</span> <span class="o">*</span><span class="n">unused</span><span class="p">)</span> <span class="p">{</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s2">"GVL released!</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span>
<span class="k">return</span> <span class="no">NULL</span><span class="p">;</span>
<span class="p">}</span>
<span class="n">static</span> <span class="n">void</span> <span class="n">bug_testcase_free</span><span class="p">(</span><span class="n">void</span><span class="o">*</span> <span class="n">ptr</span><span class="p">)</span> <span class="p">{</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s2">"Free getting called! Sending signal...</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span>
<span class="n">kill</span><span class="p">(</span><span class="n">getpid</span><span class="p">(),</span> <span class="no">SIGTERM</span><span class="p">);</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s2">"SIGTERM signal queued, trying to release GVL...</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span>
<span class="n">rb_thread_call_without_gvl</span><span class="p">(</span><span class="n">test_nogvl</span><span class="p">,</span> <span class="no">NULL</span><span class="p">,</span> <span class="no">NULL</span><span class="p">,</span> <span class="no">NULL</span><span class="p">);</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s2">"After releasing GVL!</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span>
<span class="n">free</span><span class="p">(</span><span class="n">ptr</span><span class="p">);</span>
<span class="p">}</span>
<span class="n">const</span> <span class="n">rb_data_type_t</span> <span class="n">bug_testcase_data_type</span> <span class="o">=</span> <span class="p">{</span>
<span class="p">.</span><span class="nf">wrap_struct_name</span> <span class="o">=</span> <span class="s2">"SignalBugTestcase"</span><span class="p">,</span>
<span class="p">.</span><span class="nf">function</span> <span class="o">=</span> <span class="p">{</span> <span class="no">NULL</span><span class="p">,</span> <span class="n">bug_testcase_free</span><span class="p">,</span> <span class="no">NULL</span> <span class="p">},</span>
<span class="p">.</span><span class="nf">flags</span> <span class="o">=</span> <span class="no">RUBY_TYPED_FREE_IMMEDIATELY</span>
<span class="p">};</span>
<span class="no">VALUE</span> <span class="n">bug_testcase_alloc</span><span class="p">(</span><span class="no">VALUE</span> <span class="n">klass</span><span class="p">)</span> <span class="p">{</span>
<span class="no">BugTestcase</span><span class="o">*</span> <span class="n">obj</span> <span class="o">=</span> <span class="n">calloc</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">sizeof</span><span class="p">(</span><span class="no">BugTestcase</span><span class="p">));</span>
<span class="k">return</span> <span class="no">TypedData_Make_Struct</span><span class="p">(</span><span class="n">klass</span><span class="p">,</span> <span class="no">BugTestcase</span><span class="p">,</span> <span class="o">&</span><span class="n">bug_testcase_data_type</span><span class="p">,</span> <span class="n">obj</span><span class="p">);</span>
<span class="p">}</span>
<span class="n">void</span> <span class="no">Init_signal_bug_testcase</span><span class="p">(</span><span class="n">void</span><span class="p">)</span> <span class="p">{</span>
<span class="no">VALUE</span> <span class="n">cBugTestcase</span> <span class="o">=</span> <span class="n">rb_define_class</span><span class="p">(</span><span class="s2">"SignalBugTestcase"</span><span class="p">,</span> <span class="n">rb_cObject</span><span class="p">);</span>
<span class="n">rb_define_alloc_func</span><span class="p">(</span><span class="n">cBugTestcase</span><span class="p">,</span> <span class="n">bug_testcase_alloc</span><span class="p">);</span>
<span class="p">}</span>
</code></pre>
<a name="Expectation-and-result"></a>
<h3 >Expectation and result<a href="#Expectation-and-result" class="wiki-anchor">¶</a></h3>
<p>No segfault happens.</p>
<p>Interestingly, on Ruby 2.7, the VM exits half-way through but doesn't always segfault, but running it a few times always triggers the issue. On 3.2+ it crashes every time for me.</p>
<p>I suspect the right thing here is to no longer accept/try to run any Ruby-level signal handlers after VM shutdown starts.</p>
<p>Here's what I see with this test-case:</p>
<pre><code>$ bundle exec ruby lib/signal-bug-testcase.rb
Free getting called! Sending signal...
SIGTERM signal queued, trying to release GVL...
lib/signal-bug-testcase.rb:3: [BUG] Segmentation fault at 0x0000000000000007
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0003 p:---- s:0011 e:000010 CFUNC :puts
c:0002 p:0005 s:0006 e:000005 BLOCK lib/signal-bug-testcase.rb:3 [FINISH]
c:0001 p:0000 s:0003 E:0001a0 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
lib/signal-bug-testcase.rb:3:in `block in <main>'
lib/signal-bug-testcase.rb:3:in `puts'
-- Machine register context ------------------------------------------------
RIP: 0x000070aa64cedbe7 RBP: 0x000070aa648e8fd0 RSP: 0x00007ffc5c057608
RAX: 0x0000000000004171 RBX: 0x00007ffc5c057630 RCX: 0x0000000000000001
RDX: 0x00007ffc5c057630 RDI: 0x0000000000000007 RSI: 0x0000000000004171
R8: 0x000000000000021b R9: 0x0000000000000000 R10: 0x000070aa63eff048
R11: 0x0000000000000000 R12: 0x000070aa648e8fd0 R13: 0x0000000000004171
R14: 0x0000000000000007 R15: 0x000070aa648e8ff0 EFL: 0x0000000000010202
-- C level backtrace information -------------------------------------------
ruby-3.2.2/lib/libruby.so.3.2(rb_print_backtrace+0xd) [0x70aa64d5bb5f] ruby-3.2.2/vm_dump.c:785
ruby-3.2.2/lib/libruby.so.3.2(rb_vm_bugreport) ruby-3.2.2/vm_dump.c:1080
ruby-3.2.2/lib/libruby.so.3.2(rb_bug_for_fatal_signal+0xf4) [0x70aa64b52164] ruby-3.2.2/error.c:813
ruby-3.2.2/lib/libruby.so.3.2(sigsegv+0x4d) [0x70aa64cab0fd] ruby-3.2.2/signal.c:964
/lib/x86_64-linux-gnu/libc.so.6(0x70aa64642520) [0x70aa64642520]
ruby-3.2.2/lib/libruby.so.3.2(hash_table_index+0x0) [0x70aa64cedbe7] ruby-3.2.2/symbol.h:72
ruby-3.2.2/lib/libruby.so.3.2(rb_id_table_lookup) ruby-3.2.2/id_table.c:230
ruby-3.2.2/lib/libruby.so.3.2(cached_callable_method_entry+0x24) [0x70aa64d356bb] ruby-3.2.2/vm_method.c:1295
ruby-3.2.2/lib/libruby.so.3.2(callable_method_entry_or_negative) ruby-3.2.2/vm_method.c:1365
ruby-3.2.2/lib/libruby.so.3.2(callable_method_entry) ruby-3.2.2/vm_method.c:1402
ruby-3.2.2/lib/libruby.so.3.2(rb_callable_method_entry) ruby-3.2.2/vm_method.c:1409
ruby-3.2.2/lib/libruby.so.3.2(gccct_method_search_slowpath+0x38) [0x70aa64d36258] ruby-3.2.2/vm_eval.c:434
ruby-3.2.2/lib/libruby.so.3.2(rb_call0+0x267) [0x70aa64d4e877] ruby-3.2.2/vm_eval.c:483
ruby-3.2.2/lib/libruby.so.3.2(rb_call+0x32) [0x70aa64d4f406] ruby-3.2.2/vm_eval.c:877
ruby-3.2.2/lib/libruby.so.3.2(rb_funcallv_kw) ruby-3.2.2/vm_eval.c:1074
ruby-3.2.2/lib/libruby.so.3.2(vm_call_cfunc_with_frame+0x127) [0x70aa64d30277] ruby-3.2.2/vm_insnhelper.c:3268
ruby-3.2.2/lib/libruby.so.3.2(vm_sendish+0x97) [0x70aa64d407a4] ruby-3.2.2/vm_insnhelper.c:5080
ruby-3.2.2/lib/libruby.so.3.2(vm_exec_core) ruby-3.2.2/insns.def:820
ruby-3.2.2/lib/libruby.so.3.2(rb_vm_exec+0xd3) [0x70aa64d460d3] ruby-3.2.2/vm.c:2374
ruby-3.2.2/lib/libruby.so.3.2(rb_vm_invoke_proc+0x5f) [0x70aa64d4bfcf] ruby-3.2.2/vm.c:1603
ruby-3.2.2/lib/libruby.so.3.2(vm_call0_body+0x5df) [0x70aa64d4c5cf] ruby-3.2.2/vm_eval.c:274
ruby-3.2.2/lib/libruby.so.3.2(vm_call0_cc+0x77) [0x70aa64d4e7e7] ruby-3.2.2/vm_eval.c:87
ruby-3.2.2/lib/libruby.so.3.2(rb_call0) ruby-3.2.2/vm_eval.c:551
ruby-3.2.2/lib/libruby.so.3.2(rb_call+0x32) [0x70aa64d4f406] ruby-3.2.2/vm_eval.c:877
ruby-3.2.2/lib/libruby.so.3.2(rb_funcallv_kw) ruby-3.2.2/vm_eval.c:1074
ruby-3.2.2/lib/libruby.so.3.2(rb_eval_cmd_kw+0x142) [0x70aa64d4f562] ruby-3.2.2/vm_eval.c:1923
ruby-3.2.2/lib/libruby.so.3.2(signal_exec+0xf6) [0x70aa64caae16] ruby-3.2.2/signal.c:1064
ruby-3.2.2/lib/libruby.so.3.2(rb_threadptr_execute_interrupts+0x36b) [0x70aa64cf7078] ruby-3.2.2/thread.c:2334
ruby-3.2.2/lib/libruby.so.3.2(rb_threadptr_execute_interrupts) ruby-3.2.2/thread.c:2291
ruby-3.2.2/lib/libruby.so.3.2(rb_vm_check_ints+0xb) [0x70aa64cf7ac5] ruby-3.2.2/vm_core.h:1994
ruby-3.2.2/lib/libruby.so.3.2(rb_vm_check_ints) ruby-3.2.2/vm_core.h:1985
ruby-3.2.2/lib/libruby.so.3.2(unblock_function_set) ruby-3.2.2/thread.c:320
ruby-3.2.2/lib/libruby.so.3.2(blocking_region_begin) ruby-3.2.2/thread.c:1485
ruby-3.2.2/lib/libruby.so.3.2(rb_nogvl+0xbf) [0x70aa64cf90cf] ruby-3.2.2/thread.c:1548
signal-bug-testcase-2/lib/signal_bug_testcase.so(fprintf+0x0) [0x70aa6518f299] ../../../../ext/signal_bug_testcase/signal_bug_testcase.c:17
signal-bug-testcase-2/lib/signal_bug_testcase.so(bug_testcase_free) ../../../../ext/signal_bug_testcase/signal_bug_testcase.c:18
ruby-3.2.2/lib/libruby.so.3.2(run_final+0xf) [0x70aa64b73172] ruby-3.2.2/gc.c:4388
ruby-3.2.2/lib/libruby.so.3.2(finalize_list) ruby-3.2.2/gc.c:4407
ruby-3.2.2/lib/libruby.so.3.2(finalize_deferred_heap_pages) ruby-3.2.2/gc.c:4436
ruby-3.2.2/lib/libruby.so.3.2(rb_objspace_call_finalizer+0x350) [0x70aa64b80d70] ruby-3.2.2/gc.c:4573
ruby-3.2.2/lib/libruby.so.3.2(rb_ec_finalize+0x2a) [0x70aa64b5d6d1] ruby-3.2.2/eval.c:168
ruby-3.2.2/lib/libruby.so.3.2(rb_ec_cleanup) ruby-3.2.2/eval.c:262
ruby-3.2.2/lib/libruby.so.3.2(ruby_run_node+0x9d) [0x70aa64b5d91d] ruby-3.2.2/eval.c:330
ruby-3.2.2/bin/ruby(rb_main+0x21) [0x5d5d1295f187] ./main.c:38
ruby-3.2.2/bin/ruby(main) ./main.c:57
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_call_main+0x80) [0x70aa64629d90] ../sysdeps/nptl/libc_start_call_main.h:58
/lib/x86_64-linux-gnu/libc.so.6(call_init+0x0) [0x70aa64629e40] ../csu/libc-start.c:392
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main_impl) ../csu/libc-start.c:379
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main) (null):0
[0x5d5d1295f1d5]
</code></pre> Ruby master - Bug #19831 (Open): warning message of linker with macOS Sonoma betahttps://redmine.ruby-lang.org/issues/198312023-08-04T09:21:01Zhsbt (Hiroshi SHIBATA)hsbt@ruby-lang.org
<p>Xcode 15 beta and macOS Sonoma beta show the following warnings with <code>make</code></p>
<pre><code>(snip)
linking miniruby
ld: warning: ignoring duplicate library '-lpthread'
miniruby: replacing existing signature
exe/ruby: replacing existing signature
builtin_binary.inc updated
compiling builtin.c
linking static-library libruby.3.3-static.a
linking ruby
ld: warning: ignoring duplicate library '-lgmp'
ld: warning: ignoring duplicate library '-ldl'
ld: warning: ignoring duplicate library '-lobjc'
ld: warning: ignoring duplicate library '-lpthread'
ld: warning: ignoring duplicate library '-lpthread'
(snip)
</code></pre>
<p>I'm not investigate that yet. It may be caused by <code>ld-prime</code> that is new linker of macOS platform.</p>
<pre><code>$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 15.0.0.0.1.1690355577
volume: /
location: /
install-time: 1690967267
</code></pre> Ruby master - Bug #19794 (Assigned): Ruby 3.2.2 fails to build on macOS Sonoma betashttps://redmine.ruby-lang.org/issues/197942023-08-02T05:08:15Zjhaungs (Jim Haungs)
<p>With Big Sur, Apple deprecated putting dylibs in /usr/local/lib. In Sonoma (beta 4), this directory has disappeared completely. However, ruby's configure script depends on its existence. So, virtually every ruby installer (RVM, rbenv, asdf, ruby-build, and even building from source tarball) fails.</p>
<p>When building ruby 3.2.2 from source, the configure step outputs the irritatingly useless "something wrong with LDFLAGS" error message and fails to build.</p>
<p>The solution was to <code>cd /usr/local; sudo mkdir lib</code> to create the missing lib directory under /usr/local.</p>
<p>It would be nice to remove this dependency from the configure script.</p> Ruby master - Bug #19756 (Open): URI::HTTP.build does not accept a host of `_gateway`, but `URI.p...https://redmine.ruby-lang.org/issues/197562023-07-04T02:11:27Zpostmodern (Hal Brodigan)postmodern.mod3@gmail.com
<p>I noticed a difference in behavior between <code>URI::HTTP.build</code> and <code>URI.parse</code>. <code>URI::HTTP.build</code> will not accept <code>host:</code> value of <code>_gateway</code>, but <code>URI.parse</code> will.</p>
<a name="Steps-To-Reproduce"></a>
<h2 >Steps To Reproduce<a href="#Steps-To-Reproduce" class="wiki-anchor">¶</a></h2>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">URI</span><span class="o">::</span><span class="no">HTTP</span><span class="p">.</span><span class="nf">build</span><span class="p">(</span><span class="ss">host: </span><span class="s2">"_gateway"</span><span class="p">)</span>
</code></pre>
<p>vs.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">URI</span><span class="p">.</span><span class="nf">parse</span><span class="p">(</span><span class="s2">"http://_gateway"</span><span class="p">)</span>
</code></pre>
<a name="Expected-Results"></a>
<h3 >Expected Results<a href="#Expected-Results" class="wiki-anchor">¶</a></h3>
<p>Both raise the same exception, or return the same URI object.</p>
<a name="Actual-Results"></a>
<h3 >Actual Results<a href="#Actual-Results" class="wiki-anchor">¶</a></h3>
<pre><code>URI::HTTP.build(host: "_gateway")
/usr/share/ruby/uri/generic.rb:601:in `check_host': bad component(expected host component): _gateway (URI::InvalidComponentError)
from /usr/share/ruby/uri/generic.rb:640:in `host='
from /usr/share/ruby/uri/generic.rb:673:in `hostname='
from /usr/share/ruby/uri/generic.rb:190:in `initialize'
from /usr/share/ruby/uri/generic.rb:136:in `new'
from /usr/share/ruby/uri/generic.rb:136:in `build'
from /usr/share/ruby/uri/http.rb:61:in `build'
from (irb):2:in `<main>'
from /usr/local/share/gems/gems/irb-1.7.0/exe/irb:9:in `<top (required)>'
from /usr/local/bin/irb:25:in `load'
from /usr/local/bin/irb:25:in `<main>'
</code></pre>
<pre><code>URI.parse("https://_gateway")
# => #<URI::HTTPS https://_gateway>
</code></pre>
<a name="Additional-Information"></a>
<h2 >Additional Information<a href="#Additional-Information" class="wiki-anchor">¶</a></h2>
<pre><code>$ gem list uri
uri (default: 0.12.1)
</code></pre> Ruby master - Bug #19703 (Open): text/binary mode of parent process fd is not properly inherited ...https://redmine.ruby-lang.org/issues/197032023-05-31T14:34:29ZYO4 (Yoshinao Muramatsu)
<p>Windows OS can't inherit parent process fds greater than 2, but C runtime library support this.<br>
<a href="https://learn.microsoft.com/en-us/cpp/c-runtime-library/spawn-wspawn-functions#environment-of-the-spawned-process" class="external">https://learn.microsoft.com/en-us/cpp/c-runtime-library/spawn-wspawn-functions#environment-of-the-spawned-process</a></p>
<p>So I made test tool below.<br>
This tool opens NUL device several times and create child ruby process that dumps fds' translation mode.</p>
<pre><code class="c syntaxhl" data-language="c"><span class="c1">// fdinherit.c : test file descprotor inheritance for windows C runtime</span>
<span class="cp">#include</span> <span class="cpf"><stdio.h></span><span class="cp">
#include</span> <span class="cpf"><stdlib.h></span><span class="cp">
#include</span> <span class="cpf"><process.h></span><span class="cp">
#include</span> <span class="cpf"><sys/types.h></span><span class="cp">
#include</span> <span class="cpf"><sys/stat.h></span><span class="cp">
#include</span> <span class="cpf"><share.h></span><span class="cp">
#include</span> <span class="cpf"><fcntl.h></span><span class="cp">
#include</span> <span class="cpf"><io.h></span><span class="cp">
</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">*</span> <span class="n">argv</span><span class="p">[])</span>
<span class="p">{</span>
<span class="kt">int</span> <span class="n">fh</span><span class="p">,</span> <span class="n">count</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
<span class="n">errno_t</span> <span class="n">err</span><span class="p">;</span>
<span class="c1">// child process: read fds and check if it includes "\r" and prints</span>
<span class="c1">// '.' : read as binary</span>
<span class="c1">// 't' : read as text</span>
<span class="c1">// 'F' : open error (no fd?)</span>
<span class="kt">char</span> <span class="n">rb1</span><span class="p">[]</span> <span class="o">=</span>
<span class="s">"print '012'; 3.upto("</span><span class="p">;</span> <span class="kt">char</span> <span class="n">rb2</span><span class="p">[]</span> <span class="o">=</span> <span class="s">") { |n|"</span>
<span class="s">"print ((IO.for_fd(n, 'rb').read.include?(13.chr) ? '.' : 't') rescue 'F');"</span>
<span class="s">"puts if (n % 10) == 9"</span>
<span class="s">"}"</span><span class="p">;</span>
<span class="kt">char</span> <span class="n">upto</span><span class="p">[]</span> <span class="o">=</span> <span class="s">"-4294967295"</span><span class="p">;</span>
<span class="c1">// fd max number to test</span>
<span class="k">if</span> <span class="p">(</span><span class="n">argc</span> <span class="o">>=</span> <span class="mi">2</span><span class="p">)</span> <span class="n">count</span> <span class="o">=</span> <span class="n">atoi</span><span class="p">(</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">]);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">count</span> <span class="o"><</span> <span class="mi">3</span><span class="p">)</span> <span class="n">count</span> <span class="o">=</span> <span class="mi">7</span><span class="p">;</span>
<span class="c1">// create crlf file (current directory)</span>
<span class="n">system</span><span class="p">(</span><span class="s">"echo;>crlf.txt"</span><span class="p">);</span>
<span class="c1">// open fds to inherit</span>
<span class="c1">// even fds are text mode, odd fds are binary mode</span>
<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">3</span><span class="p">;</span> <span class="n">i</span> <span class="o"><=</span> <span class="n">count</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
<span class="n">err</span> <span class="o">=</span> <span class="n">_sopen_s</span><span class="p">(</span><span class="o">&</span><span class="n">fh</span><span class="p">,</span> <span class="s">"crlf.txt"</span><span class="p">,</span> <span class="n">_O_RDONLY</span> <span class="o">|</span> <span class="p">((</span><span class="n">i</span> <span class="o">&</span> <span class="mi">1</span><span class="p">)</span> <span class="o">?</span> <span class="n">_O_BINARY</span> <span class="o">:</span> <span class="n">_O_TEXT</span><span class="p">),</span> <span class="n">_SH_DENYNO</span><span class="p">,</span> <span class="n">_S_IREAD</span> <span class="o">|</span> <span class="n">_S_IWRITE</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">err</span> <span class="o">></span> <span class="mi">0</span><span class="p">)</span> <span class="n">printf</span><span class="p">(</span><span class="s">"%d %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">err</span><span class="p">,</span> <span class="n">fh</span><span class="p">);</span>
<span class="p">}</span>
<span class="c1">// on child side, +1'd fd dump will fail (prints 'F')</span>
<span class="n">sprintf_s</span><span class="p">(</span><span class="n">upto</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">upto</span><span class="p">),</span> <span class="s">"%d"</span><span class="p">,</span> <span class="n">count</span> <span class="o">+</span> <span class="mi">1</span><span class="p">);</span>
<span class="c1">// on windows, arguments are joined into a string. so below has bad manners, but let me take a few corners.</span>
<span class="n">_spawnlp</span><span class="p">(</span><span class="n">_P_WAIT</span><span class="p">,</span> <span class="s">"ruby.exe"</span><span class="p">,</span> <span class="s">"ruby.exe"</span><span class="p">,</span> <span class="s">"-e"</span><span class="p">,</span> <span class="s">"</span><span class="se">\"</span><span class="s">"</span><span class="p">,</span> <span class="n">rb1</span><span class="p">,</span> <span class="n">upto</span><span class="p">,</span> <span class="n">rb2</span><span class="p">,</span> <span class="s">"</span><span class="se">\"</span><span class="s">"</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
<span class="n">_close</span><span class="p">(</span><span class="n">fh</span><span class="p">);</span>
<span class="p">}</span>
</code></pre>
<p>As an example, this would display something like this</p>
<pre><code>>fdinherit.exe
012.t.t.F
>fdinherit.exe 16
012.t.t.t.
t.t.t.tF
>
</code></pre>
<p>0,1,2 are stdin, stdout, stderr<br>
fds of 3,5,7,... are inherited as binary mode<br>
fds of 4,6,... are inherited as text mode</p>
<p>And I found a few things to point out.<br>
When I modify ruby part like "IO.for_fd(n, 'r')" / "IO.for_fd(n, 'rt')" / "IO.for_fd(n)",<br>
It get result like <code>012tttttF</code>, so translation mode are interprited wrong.<br>
The odd thing is that the conversion mode is interpreted as is when "IO.for_fd(n, 'rb')", which I think is the expected behavior when "IO.for_fd(n, 'r')".</p>
<p>This tool and ruby.exe each work with a combination of msvcrt 32/64bit and ucrt64, so the C runtime interface seems stable.<br>
My understanding is that MRI does not state that it supports inheritance of fds larger than 3 in windows, but it seems to work partially.<br>
Are there any chances for improvement?</p>
<p>For those who want to follow up: it seems that fds are not inherited via cmd.exe /c</p> Ruby master - Bug #19701 (Open): The rb_classext_t::classpath field is not marked for T_ICLASShttps://redmine.ruby-lang.org/issues/197012023-05-31T06:26:22Zwks (Kunshan Wang)
<p>I am hacking Ruby to dump information about some objects, and I found that the <code>rb_classext_t::classpath</code> field for <code>T_ICLASS</code> objects sometimes contains dangling references to dead objects.</p>
<p>The commit <a href="https://github.com/ruby/ruby/commit/081cc4eb283cb01ddffb364397e5175dbfacab66" class="external">https://github.com/ruby/ruby/commit/081cc4eb283cb01ddffb364397e5175dbfacab66</a> set the <code>classpath</code> field of <code>rb_mRubyVMFrozenCore</code> to a string "FrozenCore" so that it can be dumped using the <code>rb_dump_literal</code> function.</p>
<p>However, in <code>gc_mark_children</code>, if the <code>obj</code> is a <code>T_ICLASS</code>, the <code>RCLASS_EXT(obj)->classpath</code> will not be marked. As a result, if <code>rb_mRubyVMFrozenCore</code> is the only object that holds a reference to the string "FrozenCore", the string will be considered garbage and reclaimed during a GC, and the <code>classpath</code> will contain a dangling pointer.</p>
<p>There are two solutions to this problem. We can take <em>one</em> of the approaches below (not both).</p>
<ol>
<li>Let the GC mark the <code>classpath</code> field. I drafted a pull request here: <a href="https://github.com/ruby/ruby/pull/7875" class="external">https://github.com/ruby/ruby/pull/7875</a>
</li>
<li>Revert the commit <a href="https://github.com/ruby/ruby/commit/081cc4eb283cb01ddffb364397e5175dbfacab66" class="external">https://github.com/ruby/ruby/commit/081cc4eb283cb01ddffb364397e5175dbfacab66</a>
</li>
</ol>
<p>Marking the <code>classpath</code> field in GC will keep the <code>rb_dump_literal</code> function working. For debug purposes, we can also use that field to identify what object a given <code>T_ICLASS</code> is. Adding one marked field may make GC slower, but I don't think it will be observable because there are far less <code>T_ICLASS</code> objects than ordinary objects.</p>
<p>If we reverting the commit above, the <code>classpath</code> will always be blank for all <code>T_ICLASS</code> objects. (Question: How do we enforce it?) It will also save some memory by keeping less strings alive. However, currently, "FrozenCore" seems to be the only <code>T_OBJECT</code> that has its classpath set, and it may not result in significant memory saving. I don't know what purpose the <code>rb_dump_literal</code> function originally served. Maybe it is still important. Maybe it is safe to remove now.</p>
<p>Which of the two approaches should we take? It looks like each of them has its pros and cons.</p> Ruby master - Bug #19696 (Open): YJIT panicked - branch stubs should never enlarge brancheshttps://redmine.ruby-lang.org/issues/196962023-05-25T21:19:56Zwildmaples (Maple Ong)
<a name="Description"></a>
<h3 >Description<a href="#Description" class="wiki-anchor">¶</a></h3>
<p>We found this error on Rails CI with YJIT enabled. I'm not quite sure how to reproduce it since the error was intermittent.</p>
<p>I'm posting here to see if it is helpful or if anyone else has encountered this.</p>
<pre><code>thread '<unnamed>' panicked at 'branch stubs should never enlarge branches (start_addr: 0x7fa19e55cb99, old_size: 5, new_size: 14)', ./yjit/src/core.rs:1858:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:587: [BUG] YJIT panicked
ruby 3.2.2 (2023-03-30 revision e51014f9c0) +jemalloc +YJIT [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0131 p:0008 s:0680 e:000679 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract_a
c:0130 p:0004 s:0676 e:000675 BLOCK /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/c
c:0129 p:0079 s:0673 e:000671 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activesupport/lib/active_support/callbacks.rb:107
c:0128 p:0009 s:0663 e:000662 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activesupport/lib/active_support/callbacks.rb:929
c:0127 p:0005 s:0658 e:000657 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/c
c:0126 p:0013 s:0653 e:000652 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/c
c:0125 p:0011 s:0648 e:000647 METHOD /var/www/components/rails-backports/lib/rails/backports/7.0/abstract_adapter_thread_local_by_default.rb:97
c:0124 p:0021 s:0642 e:000638 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/c
c:0123 p:0172 s:0635 e:000634 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/c
c:0122 p:0014 s:0625 e:000624 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_handling.rb:313
c:0121 p:0003 s:0621 e:000620 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_handling.rb:280
c:0120 p:0004 s:0617 e:000616 BLOCK /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/fixtures.rb:560
c:0119 p:0087 s:0614 E:000b90 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/fixtures.rb:575
c:0118 p:0015 s:0601 e:000600 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/test_fixtures.rb:275
c:0117 p:0104 s:0596 E:002188 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/test_fixtures.rb:125
c:0116 p:0008 s:0591 e:000590 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/isolator-0.8.0/lib/isolator/railtie.rb:27
c:0115 p:0003 s:0586 e:000585 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/test_fixtures.rb:10
c:0114 p:0009 s:0582 e:000581 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activesupport/lib/active_support/current_attributes/test_help
c:0113 p:0009 s:0578 e:000577 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activesupport/lib/active_support/execution_context/test_helpe
c:0112 p:0003 s:0574 e:000573 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-rails-6.0.2/lib/rspec/rails/adapters.rb:74 [FINISH]
c:0111 p:---- s:0570 e:000569 CFUNC :instance_exec
c:0110 p:0013 s:0565 e:000564 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0109 p:0010 s:0559 e:000558 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0108 p:0009 s:0553 e:000552 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0107 p:0018 s:0550 e:000549 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0106 p:0004 s:0544 e:000543 BLOCK /var/www/packs/tax_predictions/spec/support/tax_predictions.rb:11
c:0105 p:0018 s:0541 e:000540 METHOD /var/www/packs/tax_predictions/app/services/tax_predictions/testing.rb:14
c:0104 p:0021 s:0536 e:000535 BLOCK /var/www/packs/tax_predictions/spec/support/tax_predictions.rb:10 [FINISH]
c:0103 p:---- s:0532 e:000531 CFUNC :instance_exec
c:0102 p:0013 s:0527 e:000526 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0101 p:0010 s:0521 e:000520 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0100 p:0009 s:0515 e:000514 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0099 p:0018 s:0512 e:000511 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0098 p:0005 s:0506 e:000505 BLOCK /var/www/spec/support/initializers/system_exit.rb:14 [FINISH]
c:0097 p:---- s:0502 e:000501 CFUNC :instance_exec
c:0096 p:0013 s:0497 e:000496 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0095 p:0010 s:0491 e:000490 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0094 p:0009 s:0485 e:000484 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0093 p:0018 s:0482 e:000481 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0092 p:0041 s:0476 e:000475 BLOCK /var/www/spec/support/initializers/sidekiq_batch_middleware.rb:17 [FINISH]
c:0091 p:---- s:0471 e:000470 CFUNC :instance_exec
c:0090 p:0013 s:0466 e:000465 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0089 p:0010 s:0460 e:000459 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0088 p:0009 s:0454 e:000453 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0087 p:0018 s:0451 e:000450 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0086 p:0004 s:0445 e:000444 BLOCK /var/www/spec/support/initializers/sidekiq.rb:38
c:0085 p:0018 s:0442 e:000441 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/sidekiq-6.5.8/lib/sidekiq/testing.rb:16
c:0084 p:0009 s:0436 e:000435 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/sidekiq-6.5.8/lib/sidekiq/testing.rb:30
c:0083 p:0010 s:0431 e:000430 BLOCK /var/www/spec/support/initializers/sidekiq.rb:38 [FINISH]
c:0082 p:---- s:0427 e:000426 CFUNC :instance_exec
c:0081 p:0013 s:0422 e:000421 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0080 p:0010 s:0416 e:000415 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0079 p:0009 s:0410 e:000409 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0078 p:0018 s:0407 e:000406 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0077 p:0025 s:0401 e:000400 BLOCK /var/www/spec/support/initializers/rake.rb:18 [FINISH]
c:0076 p:---- s:0397 e:000396 CFUNC :instance_exec
c:0075 p:0013 s:0392 e:000391 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0074 p:0010 s:0386 e:000385 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0073 p:0009 s:0380 e:000379 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0072 p:0018 s:0377 e:000376 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352 [FINISH]
c:0071 p:---- s:0371 e:000370 IFUNC
c:0070 p:0116 s:0368 E:002008 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/prosopite-1.3.1/lib/prosopite.rb:49
c:0069 p:0023 s:0363 e:000362 BLOCK /var/www/spec/support/initializers/prosopite.rb:36 [FINISH]
c:0068 p:---- s:0359 e:000358 CFUNC :instance_exec
c:0067 p:0013 s:0354 e:000353 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0066 p:0010 s:0348 e:000347 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0065 p:0009 s:0342 e:000341 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0064 p:0018 s:0339 e:000338 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0063 p:0023 s:0333 e:000332 BLOCK /var/www/spec/support/initializers/logged_examples.rb:8 [FINISH]
c:0062 p:---- s:0329 e:000328 CFUNC :instance_exec
c:0061 p:0013 s:0324 e:000323 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0060 p:0010 s:0318 e:000317 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0059 p:0009 s:0312 e:000311 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0058 p:0018 s:0309 e:000308 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0057 p:0116 s:0303 e:000302 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-3.11.0/lib/knapsack_pro/adapters/rspec_adapter.rb:72 [FINISH]
c:0056 p:---- s:0298 e:000297 CFUNC :instance_exec
c:0055 p:0013 s:0293 e:000292 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0054 p:0010 s:0287 e:000286 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0053 p:0009 s:0281 e:000280 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0052 p:0018 s:0278 e:000277 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0051 p:0032 s:0272 e:000271 BLOCK /var/www/spec/support/initializers/flake_quarantine.rb:131 [FINISH]
c:0050 p:---- s:0268 e:000267 CFUNC :instance_exec
c:0049 p:0013 s:0263 e:000262 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0048 p:0010 s:0257 e:000256 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0047 p:0009 s:0251 e:000250 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0046 p:0018 s:0248 e:000247 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0045 p:0020 s:0242 e:000241 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/singed-0.2.1/lib/singed/rspec.rb:8 [FINISH]
c:0044 p:---- s:0238 e:000237 CFUNC :instance_exec
c:0043 p:0013 s:0233 e:000232 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0042 p:0010 s:0227 e:000226 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0041 p:0009 s:0221 e:000220 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0040 p:0018 s:0218 e:000217 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352 [FINISH]
c:0039 p:---- s:0212 e:000211 IFUNC
c:0038 p:0007 s:0209 e:000208 METHOD /var/www/spec/support/lib/stream_interceptor.rb:38
c:0037 p:0007 s:0205 e:000204 BLOCK /var/www/spec/support/initializers/stream_interception.rb:10 [FINISH]
c:0036 p:---- s:0201 e:000200 CFUNC :instance_exec
c:0035 p:0013 s:0196 e:000195 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0034 p:0010 s:0190 e:000189 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0033 p:0009 s:0184 e:000183 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0032 p:0018 s:0181 e:000180 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0031 p:0037 s:0175 E:0002c8 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:629
c:0030 p:0104 s:0168 E:000248 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:486
c:0029 p:0018 s:0161 E:0026e8 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:468
c:0028 p:0019 s:0156 E:002178 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:511
c:0027 p:0076 s:0151 E:000188 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:259
c:0026 p:0036 s:0144 e:000143 METHOD /var/www/components/flake_quarantine/lib/flake_quarantine/rspec/example.rb:11
c:0025 p:0037 s:0139 e:000138 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:646 [FINISH]
c:0024 p:---- s:0133 e:000132 CFUNC :map
c:0023 p:0011 s:0129 e:000128 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:642
c:0022 p:0052 s:0124 e:000123 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:607
c:0021 p:0006 s:0115 e:000114 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608 [FINISH]
c:0020 p:---- s:0111 e:000110 CFUNC :map
c:0019 p:0065 s:0107 e:000106 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608
c:0018 p:0006 s:0098 e:000097 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608 [FINISH]
c:0017 p:---- s:0094 e:000093 CFUNC :map
c:0016 p:0065 s:0090 e:000089 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608
c:0015 p:0007 s:0081 e:000080 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:121 [FINISH]
c:0014 p:---- s:0077 e:000076 CFUNC :map
c:0013 p:0030 s:0073 e:000072 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:121
c:0012 p:0026 s:0070 e:000069 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/configuration.rb:2070
c:0011 p:0007 s:0066 e:000065 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:116
c:0010 p:0009 s:0062 e:000061 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/reporter.rb:74
c:0009 p:0019 s:0057 e:000056 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:115
c:0008 p:0035 s:0050 e:000049 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:89
c:0007 p:0201 s:0044 e:000043 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-3.11.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:93
c:0006 p:0161 s:0027 e:000026 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-3.11.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:40
c:0005 p:0041 s:0019 E:000928 METHOD bin/rspec_runner:60
c:0004 p:0016 s:0014 e:000013 METHOD bin/rspec_runner:43
c:0003 p:0005 s:0010 e:000009 METHOD bin/rspec_runner:18
c:0002 p:0060 s:0006 e:000005 EVAL bin/rspec_runner:166 [FINISH]
c:0001 p:0000 s:0003 E:000c50 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
bin/rspec_runner:166:in `<main>'
bin/rspec_runner:18:in `run'
bin/rspec_runner:43:in `run'
bin/rspec_runner:60:in `run_with_knapsack_pro'
/var/www/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-3.11.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:40:in `run'
/var/www/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-3.11.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:93:in `run_tests'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:89:in `run'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:115:in `run_specs'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/reporter.rb:74:in `report'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:116:in `block in run_specs'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/configuration.rb:2070:in `with_suite_hooks'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:121:in `block (2 levels) in run_specs'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:121:in `map'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:121:in `block (3 levels) in run_specs'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `run'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `map'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `block in run'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `run'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `map'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `block in run'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:607:in `run'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:642:in `run_examples'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:642:in `map'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:646:in `block in run_examples'
/var/www/components/flake_quarantine/lib/flake_quarantine/rspec/example.rb:11:in `run'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:259:in `run'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:511:in `with_around_and_singleton_context_hooks'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:468:in `with_around_example_hooks'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:486:in `run'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:629:in `run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/spec/support/initializers/stream_interception.rb:10:in `block (2 levels) in <top (required)>'
/var/www/spec/support/lib/stream_interceptor.rb:38:in `intercept'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/singed-0.2.1/lib/singed/rspec.rb:8:in `block (2 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/spec/support/initializers/flake_quarantine.rb:131:in `block (2 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-3.11.0/lib/knapsack_pro/adapters/rspec_adapter.rb:72:in `block (2 levels) in bind_time_tracker'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/spec/support/initializers/logged_examples.rb:8:in `block (2 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/spec/support/initializers/prosopite.rb:36:in `block (2 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/prosopite-1.3.1/lib/prosopite.rb:49:in `scan'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/spec/support/initializers/rake.rb:18:in `block (2 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/spec/support/initializers/sidekiq.rb:38:in `block (2 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/sidekiq-6.5.8/lib/sidekiq/testing.rb:30:in `fake!'
/var/www/vendor/bundle/ruby/3.2.0/gems/sidekiq-6.5.8/lib/sidekiq/testing.rb:16:in `__set_test_mode'
/var/www/spec/support/initializers/sidekiq.rb:38:in `block (3 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/spec/support/initializers/sidekiq_batch_middleware.rb:17:in `block (2 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/spec/support/initializers/system_exit.rb:14:in `block (2 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/packs/tax_predictions/spec/support/tax_predictions.rb:10:in `block (2 levels) in <main>'
/var/www/packs/tax_predictions/app/services/tax_predictions/testing.rb:14:in `recompute_on_fetch!'
/var/www/packs/tax_predictions/spec/support/tax_predictions.rb:11:in `block (3 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-rails-6.0.2/lib/rspec/rails/adapters.rb:74:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activesupport/lib/active_support/execution_context/test_helper.rb:6:in `before_setup'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activesupport/lib/active_support/current_attributes/test_helper.rb:6:in `before_setup'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/test_fixtures.rb:10:in `before_setup'
/var/www/vendor/bundle/ruby/3.2.0/gems/isolator-0.8.0/lib/isolator/railtie.rb:27:in `setup_fixtures'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/test_fixtures.rb:125:in `setup_fixtures'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/test_fixtures.rb:275:in `load_fixtures'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/fixtures.rb:575:in `create_fixtures'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/fixtures.rb:560:in `block in create_fixtures'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_handling.rb:280:in `connection'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_handling.rb:313:in `retrieve_connection'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rb:211:in `retrieve_connection'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:181:in `connection'
/var/www/components/rails-backports/lib/rails/backports/7.0/abstract_adapter_thread_local_by_default.rb:97:in `checkout'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:341:in `checkout'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:704:in `checkout_and_verify'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activesupport/lib/active_support/callbacks.rb:929:in `_run_checkout_callbacks'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activesupport/lib/active_support/callbacks.rb:107:in `run_callbacks'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:705:in `block in checkout_and_verify'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:587:in `verify!'
-- C level backtrace information -------------------------------------------
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(rb_vm_bugreport+0xb2b) [0x7fa19a87c18b]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(rb_bug_without_die+0x77) [0x7fa19a675937]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(rb_bug+0x9f) [0x7fa19a5d0cd2]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(_ZN4yjit4yjit17rb_bug_panic_hook28_$u7b$$u7b$closure$u7d$$u7d$17hfc31c2f18ccadc75E.llvm.12746241947442316067+0x5a) [0x7fa19a8b8d7a]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(_ZN3std9panicking20rust_panic_with_hook17h66309baf5235212fE+0x3d3) [0x7fa19a8c9d73]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(_ZN3std9panicking19begin_panic_handler28_$u7b$$u7b$closure$u7d$$u7d$17h3a147548aa082356E+0xb7) [0x7fa19a8ecb17]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(_ZN3std10sys_common9backtrace26__rust_end_short_backtrace17hcc62583c733bef84E+0x14) [0x7fa19a8ec824]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(rust_begin_unwind+0x42) [0x7fa19a8c9772]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(_ZN4core9panicking9panic_fmt17h8531284c14f462dcE+0x33) [0x7fa19a5d8823]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(_ZN4yjit4core20branch_stub_hit_body17h45fd758b20fb7aa6E+0xa03) [0x7fa19a89add3]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(_ZN4yjit5cruby12with_vm_lock17h09508b1ca41af130E+0x49) [0x7fa19a8936b9]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(_ZN4yjit4core15branch_stub_hit17h5cf8bd0b5727e3b9E.llvm.7796580109460741199+0x71) [0x7fa19a89ea31]
[0x7fa19b08501f]
-- Other runtime information -----------------------------------------------
* Loaded script: bin/rspec_runner
* Loaded features:
0 enumerator.so
1 thread.rb
2 fiber.so
3 rational.so
4 complex.so
5 ruby2_keywords.rb
6 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/x86_64-linux/enc/encdb.so
7 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/x86_64-linux/enc/trans/transdb.so
8 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/x86_64-linux/rbconfig.rb
9 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/compatibility.rb
10 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/defaults.rb
11 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/deprecate.rb
12 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/errors.rb
13 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/unknown_command_spell_checker.rb
14 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/exceptions.rb
15 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/basic_specification.rb
16 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/stub_specification.rb
17 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/platform.rb
18 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/util/list.rb
19 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/version.rb
20 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/requirement.rb
21 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/specification.rb
22 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/util.rb
23 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/dependency.rb
24 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/core_ext/kernel_gem.rb
25 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/x86_64-linux/monitor.so
26 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/monitor.rb
27 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems.rb
28 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/path_support.rb
29 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/error_highlight/version.rb
30 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/error_highlight/base.rb
31 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/error_highlight/formatter.rb
32 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/error_highlight/core_ext.rb
33 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/error_highlight.rb
34 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/version.rb
35 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/core_ext/name_error.rb
36 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/levenshtein.rb
37 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/jaro_winkler.rb
38 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/spell_checker.rb
39 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb
40 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb
41 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/spell_checkers/name_error_checkers.rb
42 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/spell_checkers/method_name_checker.rb
43 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/spell_checkers/key_error_checker.rb
44 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/spell_checkers/null_checker.rb
45 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/tree_spell_checker.rb
46 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/spell_checkers/require_path_checker.rb
47 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/spell_checkers/pattern_key_name_checker.rb
48 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/formatter.rb
49 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean.rb
50 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/syntax_suggest/core_ext.rb
</code></pre> Ruby master - Bug #19636 (Open): String#encode EUC_JIS_2004で"¥"がEncoding::UndefinedConversionErro...https://redmine.ruby-lang.org/issues/196362023-05-10T05:16:30Zsagittalplane (sagital plane)
<p>既知のバグでしたらすみません。</p>
<p>EUC-JIS-2004はJIS X 0213の実装なので"¥"は含まれているはずですがEncoding::UndefinedConversionErrorになります。</p>
<p><a href="https://ja.wikipedia.org/wiki/EUC-JIS-2004" class="external">https://ja.wikipedia.org/wiki/EUC-JIS-2004</a><br>
<a href="https://ja.wikipedia.org/wiki/JIS_X_0213%E9%9D%9E%E6%BC%A2%E5%AD%97%E4%B8%80%E8%A6%A7" class="external">https://ja.wikipedia.org/wiki/JIS_X_0213%E9%9D%9E%E6%BC%A2%E5%AD%97%E4%B8%80%E8%A6%A7</a></p>
<p>リファレンスマニュアルにも特にないようなのでバグのように見えます。<br>
<a href="https://docs.ruby-lang.org/ja/latest/class/String.html#I_ENCODE" class="external">https://docs.ruby-lang.org/ja/latest/class/String.html#I_ENCODE</a></p>
<pre><code>root@d8c36610327f:/opt/app# ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
root@d8c36610327f:/opt/app# ruby -e '"¥".encode(Encoding::EUC_JIS_2004)'
-e:1:in `encode': U+00A5 from UTF-8 to EUC-JIS-2004 (Encoding::UndefinedConversionError)
from -e:1:in `<main>'
root@d8c36610327f:/opt/app#
</code></pre> Ruby master - Bug #19562 (Open): Setting default_(in|ex)ternal encoding after running an Ractor f...https://redmine.ruby-lang.org/issues/195622023-03-30T13:19:54Zlarskanis (Lars Kanis)
<p>The following command blocks infinitely and must be killed with "kill -9"</p>
<pre><code>ruby -e "Ractor.new{}.take; Encoding.default_external = Encoding::ISO8859_2"
</code></pre>
<p>Backtrace is:</p>
<pre><code>#0 futex_wait (private=0, expected=2, futex_word=0x55555555abd0) at ../sysdeps/nptl/futex-internal.h:146
#1 __GI___lll_lock_wait (futex=futex@entry=0x55555555abd0, private=0) at ./nptl/lowlevellock.c:49
#2 0x00007ffff760a082 in lll_mutex_lock_optimized (mutex=0x55555555abd0) at ./nptl/pthread_mutex_lock.c:48
#3 ___pthread_mutex_lock (mutex=mutex@entry=0x55555555abd0) at ./nptl/pthread_mutex_lock.c:93
#4 0x00007ffff7c5a40d in rb_native_mutex_lock (lock=lock@entry=0x55555555abd0) at ruby-3.2.1/thread_pthread.c:556
#5 0x00007ffff7cc5376 in vm_lock_enter (cr=0x55555555deb0, vm=0x55555555aba0, locked=locked@entry=false, no_barrier=no_barrier@entry=false, lev=0x55555555ac00) at vm_sync.c:56
#6 0x00007ffff7cc5747 in rb_vm_lock_body () at vm_sync.c:175
#7 0x00007ffff7bc02c2 in rb_vm_lock (line=1829, file=0x7ffff7e209cb "ractor.c") at ruby-3.2.1/vm_sync.h:57
#8 ractor_check_blocking (remained_thread_cnt=<optimized out>, file=0x7ffff7e209cb "ractor.c", line=1865, cr=0x55555555deb0) at ractor.c:1829
#9 ractor_check_blocking (line=1865, file=0x7ffff7e209cb "ractor.c", remained_thread_cnt=<optimized out>, cr=0x55555555deb0) at ractor.c:1811
#10 rb_ractor_blocking_threads_inc (cr=0x55555555deb0, file=file@entry=0x7ffff7e29b04 "thread.c", line=line@entry=1488) at ractor.c:1865
#11 0x00007ffff7c60977 in blocking_region_begin (th=0x55555555d070, region=0x7fffffffd220, ubf=0x7ffff7c5b300 <ubf_select>, arg=0x55555555d070, fail_if_interrupted=<optimized out>) at thread.c:1488
#12 0x00007ffff7c61edf in rb_nogvl (func=0x7ffff7ac66e0 <no_gvl_stat>, data1=0x7fffffffd2a0, ubf=<optimized out>, data2=0x55555555d070, flags=<optimized out>) at thread.c:1548
#13 0x00007ffff7acdfbc in stat_without_gvl (st=0x7fffffffd2b0, path=0x7ffff27dfe88 "ruby-3.2.1/lib/ruby/3.2.0/x86_64-linux/enc/iso_8859_2.so") at file.c:1171
#14 rb_check_realpath_internal (basedir=basedir@entry=4, path=path@entry=140737261984200, origenc=0x555555565030, mode=mode@entry=RB_REALPATH_STRICT) at file.c:4491
#15 0x00007ffff7acebaa in rb_realpath_internal (basedir=basedir@entry=4, path=path@entry=140737261984200, strict=strict@entry=1) at file.c:4536
#16 0x00007ffff7b2cdd4 in require_internal (ec=0x55555555e1f0, fname=<optimized out>, exception=1, warn=<optimized out>) at load.c:1195
#17 0x00007ffff7aa0a17 in load_encoding (name=0x5555556049b0 "ISO-8859-2") at encoding.c:779
#18 0x00007ffff7aa2ef8 in check_encoding (enc=0x5555556049d0) at encoding.c:191
#19 enc_check_encoding (obj=140737335533800) at encoding.c:202
#20 rb_to_encoding (enc=enc@entry=140737335533800) at encoding.c:307
#21 0x00007ffff7aa4049 in enc_set_default_encoding (name=0x7ffff7de6287 "external", encoding=140737335533800, def=0x7ffff7fb00c0 <default_external>) at encoding.c:1563
#22 rb_enc_set_default_external (encoding=140737335533800) at encoding.c:1637
#23 0x00007ffff7aa411f in set_default_external (klass=<optimized out>, encoding=140737335533800) at encoding.c:1658
#24 0x00007ffff7c99037 in vm_call_cfunc_with_frame (ec=0x55555555e1f0, reg_cfp=0x7ffff6f7df90, calling=<optimized out>) at ruby-3.2.1/vm_insnhelper.c:3268
#25 0x00007ffff7ca9564 in vm_sendish (method_explorer=<optimized out>, block_handler=<optimized out>, cd=<optimized out>, reg_cfp=<optimized out>, ec=<optimized out>)
at ruby-3.2.1/vm_callinfo.h:367
#26 vm_exec_core (ec=0x55555555e1f0, initial=128) at ruby-3.2.1/insns.def:820
#27 0x00007ffff7caee93 in rb_vm_exec (ec=0x55555555e1f0, jit_enable_p=true) at vm.c:2374
#28 0x00007ffff7abfbf1 in rb_ec_exec_node (ec=ec@entry=0x55555555e1f0, n=n@entry=0x7ffff796c2c0) at eval.c:289
#29 0x00007ffff7ac60b3 in ruby_run_node (n=0x7ffff796c2c0) at eval.c:330
#30 0x0000555555555187 in rb_main (argv=0x7fffffffdb98, argc=3) at ./main.c:38
#31 main (argc=<optimized out>, argv=<optimized out>) at ./main.c:57
</code></pre>
<p>When the encoding was already loaded before running <code>Ractor.new</code>, then it works and doesn't block:</p>
<pre><code>ruby -e "''.encode(Encoding::ISO8859_2); Ractor.new{}.take; Encoding.default_internal = Encoding::ISO8859_2"
</code></pre>
<p>When the encoding is not assigned as default encoding, but used otherwise, it works too:</p>
<pre><code>ruby -e "Ractor.new{}.take; ''.encode(Encoding::ISO8859_2)"
</code></pre> Ruby master - Bug #19558 (Open): str.dump.undump crashes when str contains both Unicode and ASCII...https://redmine.ruby-lang.org/issues/195582023-03-29T13:47:47Zikaronen-relex (Ilmari Karonen)
<p>Recently, as a result of a question I asked on Stack Overflow (<a href="https://stackoverflow.com/q/75866159" class="external">https://stackoverflow.com/q/75866159</a>), I learned about the existence of String#dump and String#undump. However, I also found what seems like a bug in them, in that apparently dumping and then undumping a string containing a sufficiently diverse selection of characters (such as at least one ASCII C0 control character and at least one non-ASCII Unicode character) causes the undump to raise a RuntimeError.</p>
<p>Specifically, evaluating e.g. any of the following expressions:</p>
<pre><code>"\u0000\uFFFF".dump.undump
"\u0001\uABCD".dump.undump
"\u007F\u0080".dump.undump
</code></pre>
<p>raises a RuntimeError with the message "hex escape and Unicode escape are mixed". This contradicts the documentation of String#undump, which says that it "does the inverse of String#dump."</p>
<p>The behavior is the same on all Ruby versions I have tested this on, including master (3.3.0), 2.6.10 and JRuby 9.3.10.0.</p>
<p>The obvious fix would be to simply remove the check for mixed hex and Unicode escape sequences, essentially reverting <a href="https://github.com/ruby/ruby/commit/05d1d29d1f4a87620371463d8c7942e170be031f" class="external">https://github.com/ruby/ruby/commit/05d1d29d1f4a87620371463d8c7942e170be031f</a>. However, as I don't understand why the check is there in the first place, I'm also not sure if removing it could somehow have some unwanted consequences.</p> Ruby master - Bug #19438 (Open): Ruby 2.7 -> 3.2 Performance Regression in so_k_nucleotide benchmarkhttps://redmine.ruby-lang.org/issues/194382023-02-15T13:30:14Znick.schwaderer (Nicholas Schwaderer)nicholas.schwaderer@gmail.com
<a name="Introduction"></a>
<h2 >Introduction<a href="#Introduction" class="wiki-anchor">¶</a></h2>
<p>Recently I had been going through some of the old benchmarks in the <a href="https://programmingzen.com/the-great-ruby-shootout-july-2010/" class="external">Ruby Great Implementation Shootout</a> from around 2010.</p>
<p>As an experiment, one night I ran the benchmarks against Ruby 3.2.0, Ruby 3.2.0 --yjit, TruffleRuby, TruffleRuby +GraalVM, and Ruby 2.6.10.</p>
<p>Most results were as expected. However there was a benchmark that Ruby 2.6.10 was <em>consistently</em> outperforming all new Rubies on.</p>
<a name="Method"></a>
<h2 >Method<a href="#Method" class="wiki-anchor">¶</a></h2>
<p>After pairing with <a class="user active user-mention" href="https://redmine.ruby-lang.org/users/31800">@eightbitraptor (Matthew Valentine-House)</a>, we discovered that this old benchmark was remarkably similar to an existing benchmark in the <code>/benchmark</code><br>
directory, <a href="https://github.com/ruby/ruby/blob/master/benchmark/so_k_nucleotide.yml" class="external">so_k_nucleotide.yml</a>. We decided to go with that benchmark. For brevity I have not included the full 150 lines of the benchmark here.</p>
<p>I tested this benchmark out with 100 runs using <code>benchmark-driver</code> against Ruby 2.7,3.0,3.1,3.2. (I had discovered that 2.7 was even faster than 2.6.).</p>
<p>It appears that about half of the regression occured from 2.7 -> 3.0; the other half from 3.0 -> 3.2. One other interesting finding is that each minor version does appear to regress<br>
from the last, even if a little.</p>
<a name="Code"></a>
<h2 >Code<a href="#Code" class="wiki-anchor">¶</a></h2>
<p>This is my benchmark running code and harnass. <a href="https://gist.github.com/Schwad/16edf3d7cc5316af4baf23497f3c6a8f" class="external">The full code and data can be found here</a></p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">RUNS</span> <span class="o">=</span> <span class="mi">100</span>
<span class="n">results</span> <span class="o">=</span> <span class="no">Hash</span><span class="p">.</span><span class="nf">new</span> <span class="p">{</span> <span class="o">|</span><span class="n">h</span><span class="p">,</span> <span class="n">k</span><span class="o">|</span> <span class="n">h</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> <span class="p">}</span>
<span class="no">RUNS</span><span class="p">.</span><span class="nf">times</span> <span class="k">do</span> <span class="o">|</span><span class="n">i</span><span class="o">|</span>
<span class="nb">puts</span> <span class="n">i</span>
<span class="n">run</span> <span class="o">=</span> <span class="sb">`benchmark-driver so_k_nucleotide.yml --chruby '2.7.5;3.0.5;3.1.3;3.2.0' -o simple`</span>
<span class="n">run</span><span class="p">.</span><span class="nf">scan</span><span class="p">(</span><span class="sr">/\d\.\d\.\d/</span><span class="p">).</span><span class="nf">each_with_index</span> <span class="k">do</span> <span class="o">|</span><span class="n">version</span><span class="p">,</span> <span class="n">index</span><span class="o">|</span>
<span class="n">results</span><span class="p">[</span><span class="n">version</span><span class="p">]</span> <span class="o"><<</span> <span class="n">run</span><span class="p">.</span><span class="nf">scan</span><span class="p">(</span><span class="sr">/\d\.\d\d\d/</span><span class="p">)[</span><span class="n">index</span><span class="p">]</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="nb">require</span> <span class="s1">'csv'</span>
<span class="n">columns</span> <span class="o">=</span> <span class="n">results</span><span class="p">.</span><span class="nf">keys</span>
<span class="n">outdata</span> <span class="o">=</span> <span class="no">CSV</span><span class="p">.</span><span class="nf">generate</span> <span class="k">do</span> <span class="o">|</span><span class="n">csv</span><span class="o">|</span>
<span class="n">csv</span> <span class="o"><<</span> <span class="n">columns</span>
<span class="no">RUNS</span><span class="p">.</span><span class="nf">times</span> <span class="k">do</span> <span class="o">|</span><span class="n">i</span><span class="o">|</span>
<span class="n">csv</span> <span class="o"><<</span> <span class="n">columns</span><span class="p">.</span><span class="nf">map</span> <span class="p">{</span> <span class="o">|</span><span class="n">c</span><span class="o">|</span> <span class="n">results</span><span class="p">[</span><span class="n">c</span><span class="p">][</span><span class="n">i</span><span class="p">]</span> <span class="p">}</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="no">File</span><span class="p">.</span><span class="nf">write</span><span class="p">(</span><span class="s2">"output.csv"</span><span class="p">,</span> <span class="n">outdata</span><span class="p">)</span>
</code></pre>
<a name="Data"></a>
<h2 >Data<a href="#Data" class="wiki-anchor">¶</a></h2>
<p>Ruby 2.7.5 was consistently ~18-20% faster than Ruby 3.2.0 in this Benchmark</p>
<p><img src="https://user-images.githubusercontent.com/7865030/219038430-4a124cc6-0d23-46e2-9794-d89d1f26e227.png" alt="Screenshot 2023-02-15 at 13 16 10"></p>
<a name="Next-Steps"></a>
<h2 >Next Steps<a href="#Next-Steps" class="wiki-anchor">¶</a></h2>
<p>I am happy to help investigate or learn more about this regression if anyone has any ideas.</p> Ruby master - Bug #19412 (Open): Socket starts queueing and not responding after a certain amount...https://redmine.ruby-lang.org/issues/194122023-02-03T23:44:54Zbrodock (Gabriel Mazetto)brodock@gmail.com
<p>Here is a an example code:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="s1">'socket'</span>
<span class="no">PORT</span> <span class="o">=</span> <span class="mi">8080</span>
<span class="no">BACKLOG</span> <span class="o">=</span> <span class="mi">50</span>
<span class="no">LISTEN</span> <span class="o">=</span> <span class="s1">'127.0.0.1'</span>
<span class="k">def</span> <span class="nf">handle_connection</span><span class="p">(</span><span class="n">connection</span><span class="p">,</span> <span class="n">_addrinfo</span><span class="p">)</span>
<span class="n">request</span> <span class="o">=</span> <span class="n">connection</span><span class="p">.</span><span class="nf">gets</span>
<span class="nb">puts</span> <span class="n">request</span>
<span class="n">connection</span><span class="p">.</span><span class="nf">write</span> <span class="s2">"HTTP/1.1 200</span><span class="se">\r\n</span><span class="s2">"</span>
<span class="n">connection</span><span class="p">.</span><span class="nf">write</span> <span class="s2">"Content-Type: text/html</span><span class="se">\r\n</span><span class="s2">"</span>
<span class="n">connection</span><span class="p">.</span><span class="nf">write</span> <span class="s2">"</span><span class="se">\r\n</span><span class="s2">"</span>
<span class="n">connection</span><span class="p">.</span><span class="nf">write</span> <span class="s2">"Hello world! Current time is </span><span class="si">#{</span><span class="no">Time</span><span class="p">.</span><span class="nf">now</span><span class="si">}</span><span class="s2">"</span>
<span class="k">ensure</span>
<span class="n">connection</span><span class="p">.</span><span class="nf">close</span>
<span class="k">end</span>
<span class="k">begin</span>
<span class="n">socket</span> <span class="o">=</span> <span class="no">Socket</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="ss">:INET</span><span class="p">,</span> <span class="ss">:STREAM</span><span class="p">)</span>
<span class="n">socket</span><span class="p">.</span><span class="nf">bind</span><span class="p">(</span><span class="no">Addrinfo</span><span class="p">.</span><span class="nf">tcp</span><span class="p">(</span><span class="no">LISTEN</span><span class="p">,</span> <span class="no">PORT</span><span class="p">))</span>
<span class="n">socket</span><span class="p">.</span><span class="nf">listen</span><span class="p">(</span><span class="no">BACKLOG</span><span class="p">)</span>
<span class="nb">puts</span> <span class="s2">"Requested queue size: </span><span class="si">#{</span><span class="no">BACKLOG</span><span class="si">}</span><span class="s2"> bigger then limit: </span><span class="si">#{</span><span class="no">Socket</span><span class="o">::</span><span class="no">SOMAXCONN</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="no">BACKLOG</span> <span class="o">></span> <span class="no">Socket</span><span class="o">::</span><span class="no">SOMAXCONN</span>
<span class="kp">loop</span> <span class="k">do</span>
<span class="n">listening</span><span class="p">,</span> <span class="o">=</span> <span class="no">IO</span><span class="p">.</span><span class="nf">select</span><span class="p">([</span><span class="n">socket</span><span class="p">])</span>
<span class="n">io</span><span class="p">,</span> <span class="o">=</span> <span class="n">listening</span>
<span class="n">connection</span><span class="p">,</span> <span class="n">addrinfo</span> <span class="o">=</span> <span class="n">io</span><span class="p">.</span><span class="nf">accept</span>
<span class="n">handle_connection</span><span class="p">(</span><span class="n">connection</span><span class="p">,</span> <span class="n">addrinfo</span><span class="p">)</span>
<span class="k">end</span>
<span class="k">ensure</span>
<span class="n">socket</span><span class="p">.</span><span class="nf">close</span>
<span class="k">end</span>
</code></pre>
<p>This tries to simulate a TCP server that responds as if it was an HTTP server.</p>
<p>The amount of requests it can sustain seems to depend on the OS. On a Linux machine running ubuntu 20.04 I get something around 7.6K to 7.8K until it stops responding.</p>
<pre><code>$ uname -a
Linux ... 5.17.5-x86_64-linode154 #1 SMP PREEMPT Mon May 2 15:07:22 EDT 2022 x86_64 x86_64 x86_64 GNU/Linux
$ ab -n 20000 -c 50 http://127.0.0.1:8080/
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 2000 requests
Completed 4000 requests
Completed 6000 requests
apr_pollset_poll: The timeout specified has expired (70007)
Total of 7883 requests completed
</code></pre>
<p>on MacOS Ventura I get around 16K:</p>
<pre><code>$ uname -a
Darwin ... 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:04:44 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T8103 arm64
$ ab -n 20000 -c 50 http://127.0.0.1:8080/
This is ApacheBench, Version 2.3 <$Revision: 1901567 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 2000 requests
Completed 4000 requests
Completed 6000 requests
Completed 8000 requests
Completed 10000 requests
Completed 12000 requests
Completed 14000 requests
Completed 16000 requests
apr_socket_recv: Operation timed out (60)
Total of 16375 requests completed
</code></pre>
<p>in both cases when that limit reaches, if I abort the program (CTRL-C) and try to run it again it takes a while until the port is released:</p>
<pre><code>...
GET / HTTP/1.0
GET / HTTP/1.0
GET / HTTP/1.0
^Csocketserver.rb:29:in `select': Interrupt
from socketserver.rb:29:in `block in <main>'
from socketserver.rb:28:in `loop'
from socketserver.rb:28:in `<main>'
$ ruby socketserver.rb
socketserver.rb:23:in `bind': Address already in use - bind(2) for 127.0.0.1:8080 (Errno::EADDRINUSE)
from socketserver.rb:23:in `<main>'
</code></pre>
<p>After killing the process it seems no process is holding the port:</p>
<pre><code>lsof -wni tcp:8080
</code></pre>
<p>Running the command above does not return anything (it does when the program is still running).</p>
<p>I think we may be failing to release something when interacting with the Socket on syscalls/kernel level and we endup filling up some queue/buffer that eventually gets freed.</p> Ruby master - Bug #19383 (Assigned): Time.now.zone encoding for German display language in Window...https://redmine.ruby-lang.org/issues/193832023-01-26T20:52:24Zstringsn88keys (Thomas Powell)
<p>OS:<br>
Verified on Windows 10 and Windows Server 2022 and Ruby 2.7.7 through 3.1.3</p>
<p>Display language:<br>
Verified on German, but may impact other languages in which Time.now.zone returns characters that aren't [A-Za-z].</p>
<p>Time zone:<br>
CET (UTC +01:00) Amsterdam, Berlin, ...</p>
<p>Time.now.zone # => "Mitteleuro\xE3ische Zeit"<br>
Time.now.zone.encoding # => #<a href="Encoding:IBM437" class="external">Encoding:IBM437</a><br>
puts Time.now.zone # => "Mitteleurop∑ische Zeit" (should be "Mitteleuropäische Zeit")<br>
Time.now.zone.encode(Encoding::UTF_8) # => "Mitteleurop∑ische Zeit"</p>
<p>Doing a force_encoding on all encodings in Encoding.list reveals that ISO-8859-(1..16) and Windows-125(0,2,4,7) work to coerce the ä out of the time zone string:<br>
Time.now.zone.force_encoding(Encoding::WINDOWS_1252) # => "Mitteleuro\xE3ische Zeit"<br>
... but ...<br>
Time.now.zone.force_encoding(Encoding::WINDOWS_1252).encode(Encoding::UTF_8) #=> "Mitteleuropäische Zeit"</p>
<p>Related issue: This improper encoding/rendering caused Ohai's JSON output to be unparseable. Workaround was forcing to Windows-1252.<br>
<a href="https://github.com/chef/ohai/pull/1781" class="external">https://github.com/chef/ohai/pull/1781</a></p> Ruby master - Bug #19378 (Assigned): Windows: Use less syscalls for faster require of big gemshttps://redmine.ruby-lang.org/issues/193782023-01-26T07:02:23Zaidog (Andi Idogawa)andi@idogawa.com
<p>Hello 🙂</p>
<a name="Problem"></a>
<h2 >Problem<a href="#Problem" class="wiki-anchor">¶</a></h2>
<p>require is slow on windows for big gems. (example: require 'gtk3'=> 3 seconds+). This is a problem for people who want to make cross platform GUI apps with ruby.</p>
<a name="Possible-Reason"></a>
<h2 >Possible Reason<a href="#Possible-Reason" class="wiki-anchor">¶</a></h2>
<p>As touched on in <a href="https://bugs.ruby-lang.org/issues/15797" class="external">#15797</a> it seems like require uses realpath, which is emulated on windows. It checks every parent directory. The same syscalls run many times.</p>
<a name="Testfile"></a>
<h2 >Testfile<a href="#Testfile" class="wiki-anchor">¶</a></h2>
<p>C:\tmp\speedtest\testrequire.rb:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="n">__dir__</span> <span class="o">+</span> <span class="s2">"/helloworld1.rb"</span>
<span class="nb">require</span> <span class="n">__dir__</span> <span class="o">+</span> <span class="s2">"/helloworld2.rb"</span>
</code></pre>
<pre><code class="shell syntaxhl" data-language="shell">ruby <span class="nt">--disable-gems</span> C:<span class="se">\t</span>mp<span class="se">\s</span>peedtest<span class="se">\t</span>estrequire.rb
</code></pre>
<a name="Syscalls-per-FileDirectory"></a>
<h3 >Syscalls per File/Directory:<a href="#Syscalls-per-FileDirectory" class="wiki-anchor">¶</a></h3>
<ol>
<li>CreateFile</li>
<li>QueryInformationVolume</li>
<li>QueryIdInformation</li>
<li>QueryAllInformationFile</li>
<li>QueryNameInformationFile</li>
<li>QueryNameInformationFile</li>
<li>QueryNormalizedNameInformationFile</li>
<li>CloseFile</li>
</ol>
<a name="FilesDirectories-checked"></a>
<h3 >Files/Directories checked<a href="#FilesDirectories-checked" class="wiki-anchor">¶</a></h3>
<ol>
<li>C:\tmp</li>
<li>C:\tmp\speedtest</li>
<li>C:\tmp\speedtest\helloworld1.rb</li>
<li>C:\tmp</li>
<li>C:\tmp\speedtest</li>
<li>C:\tmp\speedtest\helloworld2.rb</li>
</ol>
<p>For two required files Ruby had to do 8*6 = <strong>48</strong> syscalls.<br>
The syscalls orginate from rb_w32_reparse_symlink_p / lstat</p>
<p>Rubygems live in subfolders with 9+ parts: "C:\Ruby32-x64\lib\ruby\gems\3.2.0\gems\glib2-4.0.8\lib\glib2\variant.rb"<br>
Each file takes 8 * 9 = <strong>72</strong>+ calls. For variant.rb it is <strong>80</strong> calls.<br>
The result for the syscalls don't change in such a short time, so it should be possible to cache it.</p>
<p>With require_relative it's twice as many calls.</p>
<a name="Other-testcases"></a>
<h2 >Other testcases<a href="#Other-testcases" class="wiki-anchor">¶</a></h2>
<p>Same result:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">File</span><span class="p">.</span><span class="nf">realpath</span> <span class="n">__dir__</span> <span class="o">+</span> <span class="s2">"/helloworld1.rb"</span>
<span class="no">File</span><span class="p">.</span><span class="nf">realpath</span> <span class="n">__dir__</span> <span class="o">+</span> <span class="s2">"/helloworld2.rb"</span>
</code></pre>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">File</span><span class="p">.</span><span class="nf">stat</span> <span class="n">__dir__</span> <span class="o">+</span> <span class="s2">"/helloworld1.rb"</span>
<span class="no">File</span><span class="p">.</span><span class="nf">stat</span> <span class="n">__dir__</span> <span class="o">+</span> <span class="s2">"/helloworld2.rb"</span>
</code></pre>
<p>It does not happen in $LOAD_PATH.resolve_feature_path(<strong>dir</strong> + "/helloworld1.rb")</p>
<a name="Request"></a>
<h2 >Request<a href="#Request" class="wiki-anchor">¶</a></h2>
<p>Would it be possible to cache the stat calls when using require?<br>
I tried to implement a cache inside the ruby source code, but failed.<br>
If not, is there now a way to combine ruby files into one?</p>
<p>I previously talked about require here: <a href="https://bugs.ruby-lang.org/issues/19325#note-11" class="external">YJIT: Windows support lacking.</a></p>
<a name="How-to-reproduce"></a>
<h2 >How to reproduce<a href="#How-to-reproduce" class="wiki-anchor">¶</a></h2>
<p>Ruby versions: At least 3.0+, most likely older ones too.<br>
Tested using Ruby Installer 3.1 and 3.2.<br>
<a href="https://learn.microsoft.com/en-us/sysinternals/downloads/procmon" class="external">Procmon Software by Sysinternals</a></p> Ruby master - Bug #19369 (Assigned): Small corner-case issue that breaks Ractor isolation: change...https://redmine.ruby-lang.org/issues/193692023-01-23T01:28:22Zluke-gru (Luke Gruber)luke.gru@gmail.com
<p>I was looking into how objects are traversed for deep cloning and I came up with a way to break it. I don't think it'll ever happen in real life so it's not really an issue, just<br>
an interesting case. Run with warnings disabled.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">obj</span> <span class="o">=</span> <span class="no">Object</span><span class="p">.</span><span class="nf">new</span>
<span class="nb">p</span> <span class="s2">"unshareable obj:"</span><span class="p">,</span> <span class="n">obj</span>
<span class="no">UNSHAREABLE</span> <span class="o">=</span> <span class="n">obj</span>
<span class="no">GO</span> <span class="o">=</span> <span class="kp">false</span>
<span class="no">SET</span> <span class="o">=</span> <span class="kp">false</span>
<span class="k">class</span> <span class="nc">Object</span>
<span class="nb">attr_accessor</span> <span class="ss">:unshareable</span>
<span class="k">def</span> <span class="nf">initialize_clone</span><span class="p">(</span><span class="n">orig</span><span class="p">)</span>
<span class="nb">puts</span> <span class="s2">"Clone called for </span><span class="si">#{</span><span class="n">orig</span><span class="p">.</span><span class="nf">inspect</span><span class="si">}</span><span class="s2">, self = </span><span class="si">#{</span><span class="nb">self</span><span class="p">.</span><span class="nf">inspect</span><span class="si">}</span><span class="s2">"</span>
<span class="n">_self</span> <span class="o">=</span> <span class="nb">self</span>
<span class="k">if</span> <span class="n">orig</span> <span class="o">==</span> <span class="no">UNSHAREABLE</span>
<span class="n">t</span> <span class="o">=</span> <span class="no">Thread</span><span class="p">.</span><span class="nf">new</span> <span class="k">do</span>
<span class="nb">puts</span> <span class="s2">"In thread"</span>
<span class="no">Thread</span><span class="p">.</span><span class="nf">pass</span> <span class="k">until</span> <span class="no">GO</span>
<span class="nb">puts</span> <span class="s2">"Setting unshareable!"</span>
<span class="c1"># this must be done in separate thread to bypass object traversal deep-cloning</span>
<span class="n">_self</span><span class="p">.</span><span class="nf">unshareable</span> <span class="o">=</span> <span class="no">UNSHAREABLE</span>
<span class="no">Object</span><span class="p">.</span><span class="nf">const_set</span><span class="p">(</span><span class="ss">:SET</span><span class="p">,</span> <span class="kp">true</span><span class="p">)</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">super</span><span class="p">(</span><span class="n">orig</span><span class="p">)</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="n">r</span> <span class="o">=</span> <span class="no">Ractor</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">o</span><span class="o">|</span>
<span class="nb">puts</span> <span class="s2">"from r</span><span class="si">#{</span><span class="no">Ractor</span><span class="p">.</span><span class="nf">current</span><span class="p">.</span><span class="nf">object_id</span><span class="si">}</span><span class="s2"> obj </span><span class="si">#{</span><span class="n">o</span><span class="p">.</span><span class="nf">inspect</span><span class="si">}</span><span class="s2">"</span>
<span class="no">GO</span> <span class="o">=</span> <span class="kp">true</span>
<span class="kp">loop</span> <span class="k">until</span> <span class="no">SET</span>
<span class="nb">p</span> <span class="s2">"from ractor, got unshareable:"</span><span class="p">,</span> <span class="n">o</span><span class="p">.</span><span class="nf">unshareable</span>
<span class="k">end</span>
<span class="n">r</span><span class="p">.</span><span class="nf">take</span>
</code></pre> Ruby master - Bug #19368 (Assigned): Small issue with isolated procs and evalhttps://redmine.ruby-lang.org/issues/193682023-01-22T17:40:38Zluke-gru (Luke Gruber)luke.gru@gmail.com
<pre><code>a = Object.new # non-shareable
prok = Ractor.current.instance_eval do
Proc.new do
eval('a')
end
end
prok.call # this should work, we're in the main ractor and the proc is not isolated
Ractor.make_shareable(prok) # this doesn't currently work, but I think it should. It gives Ractor::IsolationError. See below for reasoning on why I think it should work.
# A flag seems to be set on the proc after it's run and accesses outers...
</code></pre>
<p>Because this work fine:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">a</span> <span class="o">=</span> <span class="no">Object</span><span class="p">.</span><span class="nf">new</span> <span class="c1"># non-shareable</span>
<span class="n">prok</span> <span class="o">=</span> <span class="no">Ractor</span><span class="p">.</span><span class="nf">current</span><span class="p">.</span><span class="nf">instance_eval</span> <span class="k">do</span>
<span class="no">Proc</span><span class="p">.</span><span class="nf">new</span> <span class="k">do</span>
<span class="nb">eval</span><span class="p">(</span><span class="s1">'a'</span><span class="p">)</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="no">Ractor</span><span class="p">.</span><span class="nf">make_shareable</span><span class="p">(</span><span class="n">prok</span><span class="p">)</span> <span class="c1"># this works, and it's okay because we get a different error when actually running the shareable proc inside a ractor that accesses outers through eval.</span>
</code></pre> Ruby master - Bug #19338 (Assigned): Ruby hangs when ouputting warnings inside ractor with VM loc...https://redmine.ruby-lang.org/issues/193382023-01-14T18:15:37Zluke-gru (Luke Gruber)luke.gru@gmail.com
<p>This code causes Ruby to hang:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">rs</span> <span class="o">=</span> <span class="p">[]</span>
<span class="mi">2</span><span class="p">.</span><span class="nf">times</span> <span class="k">do</span>
<span class="n">rs</span> <span class="o"><<</span> <span class="no">Ractor</span><span class="p">.</span><span class="nf">new</span> <span class="k">do</span>
<span class="no">MYCONSTANT</span> <span class="o">=</span> <span class="mi">2</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="n">rs</span><span class="p">.</span><span class="nf">each</span><span class="p">(</span><span class="o">&</span><span class="ss">:take</span><span class="p">)</span>
</code></pre>
<p>There is a problem when the warning is being outputted with multiple ractors. A thread is calling RB_VM_LOCK() while holding the VM lock in ractor.c (ractor_check_blocking())</p>
<p>If the code is changed to RB_VM_LOCK_ENTER() and RB_VM_LOCK_LEAVE() then it fixes it, but I don't know if there's a better way.</p>
<p>Thanks!</p> Ruby master - Bug #19266 (Open): URI::Generic should use URI::RFC3986_PARSER instead of URI::DEFA...https://redmine.ruby-lang.org/issues/192662022-12-26T18:52:36Zgareth (Gareth Adams)
<p>In June 2014, <a href="https://github.com/ruby/ruby/commit/bb83f32dc3e0424d25fa4e55d8ff32b061320e41" class="external"><code>uri/common</code> was updated</a> to introduce a RFC3986-compliant parser (<code>URI::RFC3986_PARSER</code>) as an alternative to the previous RFC2396 parser, and common methods like <code>URI()</code> were updated to use that new parser by default. The only methods in <code>common</code> not updated were <a href="https://github.com/ruby/ruby/blob/28a17436503c3c4cb7a35b423a894b697cd80da9/lib/uri/common.rb#L233-L297" class="external"><code>URI.extract</code> and <code>URI.regexp</code></a> which are marked as obsolete. (The old parser was kept in the <code>DEFAULT_PARSER</code> constant despite it not being the default for those methods, presumably for backward compatibility.)</p>
<p>However, similar <a href="https://github.com/ruby/ruby/blob/28a17436503c3c4cb7a35b423a894b697cd80da9/lib/uri/generic.rb#L169-L175" class="external">methods called on <code>URI::Generic</code></a> were never updated to use this new parser. This means that methods like <code>URI::Generic.build</code> fail when given input that succeeds normally, and this also affects subclasses like URI::HTTP:</p>
<pre><code>$ pry -r uri -r uri/common -r uri/generic
[1] pry(main)> URI::Generic.build(host: "underscore_host.example")
URI::InvalidComponentError: bad component(expected host component): underscore_host.example
from /Users/gareth/.asdf/installs/ruby/3.1.3/lib/ruby/3.1.0/uri/generic.rb:591:in `check_host'
[2] pry(main)> URI::HTTP.build(host: "underscore_host.example")
URI::InvalidComponentError: bad component(expected host component): underscore_host.example
from /Users/gareth/.asdf/installs/ruby/3.1.3/lib/ruby/3.1.0/uri/generic.rb:591:in `check_host'
[3] pry(main)> URI("http://underscore_host.example")
=> #<URI::HTTP http://underscore_host.example>
</code></pre>
<p><code>URI::Generic.new</code> allows a configurable <code>parser</code> positional argument to override the class' default parser, but other factory methods like <code>.build</code> don't allow this override.</p>
<p>Arguably this doesn't cause problems because at least in the case above, the URI can be built with the polymorphic constructor, but having the option to build URIs from explicit named parts is useful, and leaving the outdated functionality in the <code>Generic</code> class is ambiguous. It's possible that the whole Generic class and its subclasses aren't intended to be used directly how I'm intending here, but there's nothing I could see that suggested this is the case.</p>
<p>I'm not aware of the entire list of differences between RFC2396 and RFC3986. The relevant difference here is that in RFC2396 an individual segment of a host (<a href="https://www.rfc-editor.org/rfc/rfc2396#section-3.2.2" class="external"><code>domainlabel</code>s</a>) could only be <code>alphanum | alphanum *( alphanum | "-" ) alphanum</code>, whereas RFC3986 allows <a href="https://www.rfc-editor.org/rfc/rfc3986#page-13" class="external">hostnames</a> to include any of <code>ALPHA / DIGIT / "-" / "." / "_" / "~"</code>. It's possible that other differences might cause issues for developers, but since this has gone over 8 years without anyone else caring about this, this is definitely not especially urgent.</p> Test - Bug #19186 (Open): test2https://redmine.ruby-lang.org/issues/191862022-12-06T01:25:49Zshugo (Shugo Maeda)
<p>Hello, this is a test issue.<br>
This is a second line with umlaut: ü</p> Test - Bug #19185 (Open): testhttps://redmine.ruby-lang.org/issues/191852022-12-06T01:24:24Zshugo (Shugo Maeda)
<p>hello, this is a test issue.<br>
This is a second line.</p> Ruby master - Bug #19172 (Open): `ruby_thread_has_gvl_p` is innacurate sometimes -- document or c...https://redmine.ruby-lang.org/issues/191722022-12-02T09:14:59Zivoanjo (Ivo Anjo)ivo.anjo@datadoghq.com
<p>Howdy 👋! I work for Datadog <a href="https://github.com/DataDog/dd-trace-rb" class="external">on the ddtrace gem</a> and I found a... sharp edge on the internal <code>ruby_thread_has_gvl_p</code> API.</p>
<p>I am aware that <code>ruby_thread_has_gvl_p</code> is documented an experimental API that is exported as a symbol but not present on the VM include files.</p>
<a name="Background"></a>
<h3 >Background<a href="#Background" class="wiki-anchor">¶</a></h3>
<p>In the ddtrace profiling component, we setup a signal handler and then periodically send SIGPROF signals to try to interrupt the running Ruby thread (e.g. the thread that is holding the global VM lock or equivalent).</p>
<p>In the signal handler, we need to perform some API calls which are not safe to do without the GVL. So we need to check if the signal handler got called in the thread that has the GVL.</p>
<a name="The-issue"></a>
<h3 >The issue<a href="#The-issue" class="wiki-anchor">¶</a></h3>
<pre><code class="c syntaxhl" data-language="c"><span class="kt">int</span>
<span class="nf">ruby_thread_has_gvl_p</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">rb_thread_t</span> <span class="o">*</span><span class="n">th</span> <span class="o">=</span> <span class="n">ruby_thread_from_native</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">th</span> <span class="o">&&</span> <span class="n">th</span><span class="o">-></span><span class="n">blocking_region_buffer</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">else</span> <span class="p">{</span>
<span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
<p>In its current implementation, <code>ruby_thread_has_gvl_p</code> only checks if the thread has a <code>blocking_region_buffer</code> or not. Unfortunately, this means that when called from a thread that lost the GVL but not due to blocking (e.g. via <code>rb_thread_schedule()</code>), it can still claim that a thread is holding the GVL when that is not the case.</p>
<p>I ran into this issue in <a href="https://github.com/DataDog/dd-trace-rb/pull/2415" class="external">https://github.com/DataDog/dd-trace-rb/pull/2415</a>, and needed to find a workaround.</p>
<a name="Next-steps"></a>
<h3 >Next steps<a href="#Next-steps" class="wiki-anchor">¶</a></h3>
<p>Since this is an internal VM API, I'm not sure you'd want to change the current behavior, so I was thinking of perhaps two options:</p>
<ul>
<li>
<p>Is it worth changing <code>ruby_thread_has_gvl_p</code> to be accurate in the case I've listed?</p>
</li>
<li>
<p>If not, would you accept a PR to document its current limitations, so that others don't run into the same issue I did?</p>
</li>
</ul> Ruby master - Bug #19157 (Open): URI bad component validation can be trickedhttps://redmine.ruby-lang.org/issues/191572022-11-28T23:46:13Zstraight-shoota (Johannes Müller)
<p><code>URI::HTTP</code> checks the validity of the URI components. For example, the path of a URI with authority component must be either empty or start with a slash.</p>
<p>This validation applies on the <code>.build</code> constructor as well as on the <code>path</code> setter.<br>
But it can be tricked when setting an empty authority component and scheme before setting a relative path, and then setting the authority and scheme again.<br>
This produces an invalid and incorrect URI.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="s2">"uri"</span>
<span class="n">uri</span> <span class="o">=</span> <span class="no">URI</span><span class="o">::</span><span class="no">HTTP</span><span class="p">.</span><span class="nf">build</span><span class="p">({})</span>
<span class="n">uri</span><span class="p">.</span><span class="nf">scheme</span> <span class="o">=</span> <span class="kp">nil</span>
<span class="n">uri</span><span class="p">.</span><span class="nf">path</span> <span class="o">=</span> <span class="s2">"resource"</span>
<span class="n">uri</span><span class="p">.</span><span class="nf">host</span> <span class="o">=</span> <span class="s2">"example.com"</span> <span class="c1"># this should raise URI::InvalidComponentError</span>
<span class="n">uri</span><span class="p">.</span><span class="nf">scheme</span> <span class="o">=</span> <span class="s2">"http"</span>
<span class="n">uri</span><span class="p">.</span><span class="nf">to_s</span> <span class="c1"># => "http://example.comresource"</span>
</code></pre> Ruby master - Bug #19154 (Open): Specify require and autoload guarantees in ractorshttps://redmine.ruby-lang.org/issues/191542022-11-26T23:52:22Zfxn (Xavier Noria)fxn@hashref.com
<p>Given a file <code>c.rb</code>:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">class</span> <span class="nc">C</span>
<span class="k">end</span>
</code></pre>
<p>the following script:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">r1</span> <span class="o">=</span> <span class="no">Ractor</span><span class="p">.</span><span class="nf">new</span> <span class="k">do</span>
<span class="nb">require</span> <span class="s1">'./c.rb'</span>
<span class="k">end</span>
<span class="n">r2</span> <span class="o">=</span> <span class="no">Ractor</span><span class="p">.</span><span class="nf">new</span> <span class="k">do</span>
<span class="nb">require</span> <span class="s1">'./c.rb'</span>
<span class="k">end</span>
<span class="n">r1</span><span class="p">.</span><span class="nf">take</span>
<span class="n">r2</span><span class="p">.</span><span class="nf">take</span>
</code></pre>
<p>raises:</p>
<pre><code>% ruby -v foo.rb
ruby 3.2.0preview3 (2022-11-27) [x86_64-darwin22]
foo.rb:1: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues.
#<Thread:0x000000010fee2928 run> terminated with exception (report_on_exception is true):
#<Thread:0x00000001102acfe0 run> terminated with exception (report_on_exception is true):
<internal:/Users/fxn/.rbenv/versions/3.2.0-preview3/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:164:in `ensure in require': can not access non-shareable objects in constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError)
from <internal:/Users/fxn/.rbenv/versions/3.2.0-preview3/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:167:in `require'
from foo.rb:6:in `block in <main>'
<internal:/Users/fxn/.rbenv/versions/3.2.0-preview3/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:37:in `require'<internal:/Users/fxn/.rbenv/versions/3.2.0-preview3/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:164:in `ensure in require': : can not access non-shareable objects in constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError)
from <internal:/Users/fxn/.rbenv/versions/3.2.0-preview3/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:167:in `require'
can not access non-shareable objects in constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError) from foo.rb:2:in `block in <main>'
<internal:/Users/fxn/.rbenv/versions/3.2.0-preview3/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:37:in `require': can not access non-shareable objects in constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError)
from foo.rb:2:in `block in <main>'
from foo.rb:6:in `block in <main>'
<internal:ractor>:698:in `take': thrown by remote Ractor. (Ractor::RemoteError)
from foo.rb:9:in `<main>'
<internal:/Users/fxn/.rbenv/versions/3.2.0-preview3/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:164:in `ensure in require': can not access non-shareable objects in constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError)
from <internal:/Users/fxn/.rbenv/versions/3.2.0-preview3/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:167:in `require'
from foo.rb:2:in `block in <main>'
<internal:/Users/fxn/.rbenv/versions/3.2.0-preview3/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:37:in `require': can not access non-shareable objects in constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError)
from foo.rb:2:in `block in <main>'
</code></pre>
<p>Would it be possible to have documentation about their interaction?</p>
<p>This is important also to understand autoloading within ractors, since constant references may trigger <code>require</code> calls.</p> Ruby master - Bug #19043 (Open): Segfault on macOS 11.7 while using StringScanner in multiple thr...https://redmine.ruby-lang.org/issues/190432022-10-06T21:08:47Zkeithdoggett (Keith Doggett)
<p>During testing on our CI, one of the runners failed due to a segfault that appears to have originated from the <code>StringScanner</code> class, specifically the <code>scan_until</code> method. The test ensures that we are able to properly parse strings in a multithreaded environment.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"> <span class="k">def</span> <span class="nf">test_multithreaded</span>
<span class="n">parser</span> <span class="o">=</span> <span class="no">RGeo</span><span class="o">::</span><span class="no">WKRep</span><span class="o">::</span><span class="no">WKTParser</span><span class="p">.</span><span class="nf">new</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">fixtures</span><span class="p">.</span><span class="nf">join</span><span class="p">(</span><span class="s2">"isere.wkt"</span><span class="p">).</span><span class="nf">read</span>
<span class="no">Array</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="mi">100</span><span class="p">)</span> <span class="k">do</span>
<span class="no">Thread</span><span class="p">.</span><span class="nf">fork</span> <span class="k">do</span>
<span class="n">parser</span><span class="p">.</span><span class="nf">parse</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="k">end</span>
<span class="k">end</span><span class="p">.</span><span class="nf">map</span><span class="p">(</span><span class="o">&</span><span class="ss">:join</span><span class="p">)</span>
<span class="k">end</span>
</code></pre>
<p>Here's the <code>parse</code> method</p>
<pre><code class="ruby syntaxhl" data-language="ruby"> <span class="k">def</span> <span class="nf">parse</span><span class="p">(</span><span class="n">str</span><span class="p">)</span>
<span class="vi">@mutex</span><span class="p">.</span><span class="nf">synchronize</span> <span class="k">do</span>
<span class="n">str</span> <span class="o">=</span> <span class="n">str</span><span class="p">.</span><span class="nf">downcase</span>
<span class="vi">@cur_factory</span> <span class="o">=</span> <span class="vi">@exact_factory</span>
<span class="k">if</span> <span class="vi">@cur_factory</span>
<span class="vi">@cur_factory_support_z</span> <span class="o">=</span> <span class="vi">@cur_factory</span><span class="p">.</span><span class="nf">property</span><span class="p">(</span><span class="ss">:has_z_coordinate</span><span class="p">)</span> <span class="p">?</span> <span class="kp">true</span> <span class="p">:</span> <span class="kp">false</span>
<span class="vi">@cur_factory_support_m</span> <span class="o">=</span> <span class="vi">@cur_factory</span><span class="p">.</span><span class="nf">property</span><span class="p">(</span><span class="ss">:has_m_coordinate</span><span class="p">)</span> <span class="p">?</span> <span class="kp">true</span> <span class="p">:</span> <span class="kp">false</span>
<span class="k">end</span>
<span class="vi">@cur_expect_z</span> <span class="o">=</span> <span class="kp">nil</span>
<span class="vi">@cur_expect_m</span> <span class="o">=</span> <span class="kp">nil</span>
<span class="vi">@cur_srid</span> <span class="o">=</span> <span class="vi">@default_srid</span>
<span class="k">if</span> <span class="vi">@support_ewkt</span> <span class="o">&&</span> <span class="n">str</span> <span class="o">=~</span> <span class="sr">/^srid=(\d+);/i</span>
<span class="n">str</span> <span class="o">=</span> <span class="vg">$'</span>
<span class="vi">@cur_srid</span> <span class="o">=</span> <span class="no">Regexp</span><span class="p">.</span><span class="nf">last_match</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="nf">to_i</span>
<span class="k">end</span>
<span class="k">begin</span>
<span class="n">start_scanner</span><span class="p">(</span><span class="n">str</span><span class="p">)</span>
<span class="n">obj</span> <span class="o">=</span> <span class="n">parse_type_tag</span>
<span class="k">if</span> <span class="vi">@cur_token</span> <span class="o">&&</span> <span class="o">!</span><span class="vi">@ignore_extra_tokens</span>
<span class="k">raise</span> <span class="no">Error</span><span class="o">::</span><span class="no">ParseError</span><span class="p">,</span> <span class="s2">"Extra tokens beginning with </span><span class="si">#{</span><span class="vi">@cur_token</span><span class="p">.</span><span class="nf">inspect</span><span class="si">}</span><span class="s2">."</span>
<span class="k">end</span>
<span class="k">ensure</span>
<span class="n">clean_scanner</span>
<span class="k">end</span>
<span class="n">obj</span>
<span class="k">end</span>
<span class="k">end</span>
</code></pre>
<p>Where the <code>StringScanner</code> is created and assigned to <code>@scanner</code> in <code>start_scanner</code> and <code>@scanner</code> is set to <code>nil</code> in <code>clean_scanner</code>. According to the control frame information in the log, the error is caused in the <code>scan_until</code> method, but it might be due to <code>gc_sweep</code> being run at some point.</p>
<p>Unfortunately since this happened on a CI system I don't have access to the diagnostic file. We've tried to replicate this locally unsuccessfully. The best we've done is caused a deadlock while trying to join the threads, but cannot reliably reproduce that. Here's a link to the CI run that caused the issue if that's helpful (<a href="https://github.com/rgeo/rgeo/actions/runs/3144578897/jobs/5110771257" class="external">https://github.com/rgeo/rgeo/actions/runs/3144578897/jobs/5110771257</a>).</p>
<p>If there's any tips on how to reproduce or anything you want me to try to get more information please let me know.</p> Ruby master - Bug #18966 (Open): Strange behavior when numbered parameters and method definition ...https://redmine.ruby-lang.org/issues/189662022-08-19T08:51:27Ztompng (tomoya ishida)tomoyapenguin@gmail.com
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="s1">'a'</span><span class="p">.</span><span class="nf">tap</span> <span class="p">{</span> <span class="nb">p</span> <span class="n">_1</span><span class="p">;</span> <span class="k">def</span> <span class="nf">f</span><span class="p">()</span><span class="o">=</span><span class="mi">42</span> <span class="p">}</span> <span class="c1">#=> "a"</span>
<span class="s1">'a'</span><span class="p">.</span><span class="nf">tap</span> <span class="p">{</span> <span class="nb">p</span> <span class="n">_1</span><span class="p">;</span> <span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">=</span><span class="mi">42</span> <span class="p">}</span> <span class="c1">#=> nil</span>
<span class="s1">'a'</span><span class="p">.</span><span class="nf">tap</span> <span class="p">{</span> <span class="k">def</span> <span class="nf">f</span><span class="p">()</span><span class="o">=</span><span class="mi">42</span><span class="p">;</span> <span class="nb">p</span> <span class="n">_1</span> <span class="p">}</span> <span class="c1">#=> "a"</span>
<span class="s1">'a'</span><span class="p">.</span><span class="nf">tap</span> <span class="p">{</span> <span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">=</span><span class="mi">42</span><span class="p">;</span> <span class="nb">p</span> <span class="n">_1</span> <span class="p">}</span> <span class="c1"># Syntax Error -:1: ordinary parameter is defined</span>
</code></pre> Ruby master - Bug #18947 (Open): Unexpected Errno::ENAMETOOLONG on Windowshttps://redmine.ruby-lang.org/issues/189472022-07-29T07:08:19Zinversion (Yura Babak)
<p>On Windows 10, I am working on a script to copy a complex folder structure.</p>
<p>Pathname and FileUtils work fine for me until there is a folder with a <strong>very long path</strong> (>260 chars).</p>
<p>Normally you cannot access such a folder with Ruby.<br>
The next operations will raise <code>Errno::ENOENT</code></p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">Pathname</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="mi">300</span><span class="n">_chars_path</span><span class="p">).</span><span class="nf">children</span>
<span class="no">FileUtils</span><span class="p">.</span><span class="nf">mkpath</span><span class="p">(</span><span class="mi">300</span><span class="n">_chars_path</span><span class="p">)</span>
</code></pre>
<p>But there is a way in Windows to remove the MAX_PATH limitation.<br>
You can find a small .reg file in this article:<br>
<a href="https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry" class="external">https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry</a></p>
<p>After changing this system option, things start to work strangely in Ruby.</p>
<p>This will now raise <code>Errno::ENAMETOOLONG</code>:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">Pathname</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="mi">300</span><span class="n">_chars_path</span><span class="p">).</span><span class="nf">children</span>
</code></pre>
<p>But at the same time, you can create a folder with such a long path and write-read a file in it</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">FileUtils</span><span class="p">.</span><span class="nf">mkpath</span><span class="p">(</span><span class="mi">300</span><span class="n">_chars_path</span><span class="p">)</span>
<span class="n">file</span> <span class="o">=</span> <span class="no">Pathname</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="mi">300</span><span class="n">_chars_path</span><span class="o">+</span><span class="s1">'/file.txt'</span><span class="p">)</span>
<span class="n">file</span><span class="p">.</span><span class="nf">write</span> <span class="s1">'oooooooooo'</span>
<span class="nb">puts</span> <span class="no">Pathname</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="mi">300</span><span class="n">_chars_path</span><span class="o">+</span><span class="s1">'/file.txt'</span><span class="p">).</span><span class="nf">read</span>
</code></pre>
<p>So you can work with individual items but attempts to list such folders' content fail (<code>.children</code>, <code>.glob</code>, <code>.copy</code>, etc).<br>
In my case, deep <code>.glob</code> is broken for all the parent folders of that deep long-path folder ((</p>
<p>The only way I found for listing is</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="s1">'win32ole'</span>
<span class="n">fso</span> <span class="o">=</span> <span class="no">WIN32OLE</span><span class="p">.</span><span class="nf">new</span> <span class="s1">'Scripting.FileSystemObject'</span>
<span class="k">for</span> <span class="n">file</span> <span class="k">in</span> <span class="n">fso</span><span class="o">.</span><span class="no">GetFolder</span><span class="p">(</span><span class="mi">300</span><span class="n">_chars_path</span><span class="p">).</span><span class="nf">files</span>
<span class="n">file</span><span class="p">.</span><span class="nf">name</span>
<span class="n">file</span><span class="p">.</span><span class="nf">path</span><span class="p">.</span><span class="nf">length</span>
<span class="k">end</span>
</code></pre>
<p>But using this workaround breaks all my code workflow built on top of Pathname and FileUtils ((.</p>
<p>So for me, it looks like some operations with long-path folders are not working just because in Ruby there is a check for the path length and not a real operation problem. And in some places (see .mkpath) there is no such check and all works fine.</p>
<p>Also notice that other applications on Windows have no problems with long-path folders (like Total Commander).</p>
<p>Please consider reviewing if we really need to raise <code>Errno::ENAMETOOLONG</code> if the <code>LongPathsEnabled</code> option is enabled in the Windows registry.</p> Ruby master - Bug #18940 (Assigned): Ruby Ractor fails with IOError when handling higher concurrencyhttps://redmine.ruby-lang.org/issues/189402022-07-26T18:33:12Zbrodock (Gabriel Mazetto)brodock@gmail.com
<p>Reproduction server:</p>
<pre><code>require 'socket'
# Set based on CPU count
CONCURRENCY = 8
server = TCPServer.new(8080)
workers = CONCURRENCY.times.map do
Ractor.new do
loop do
# receive TCPSocket
session = Ractor.recv
request = session.gets
puts request
session.print "HTTP/1.1 200\r\n"
session.print "Content-Type: text/html\r\n"
session.print "\r\n"
session.print "Hello world! Current time is #{Time.now}"
session.close
end
end
end
loop do
conn, _ = server.accept
# pass TCPSocket to one of the workers
workers.sample.send(conn, move: true)
end
</code></pre>
<p>run apache benchmark against code above:</p>
<pre><code>ab -n 20000 -c 20 http://localhost:8080/
</code></pre>
<p>or run using hey (<a href="https://github.com/rakyll/hey" class="external">https://github.com/rakyll/hey</a>):</p>
<pre><code>hey -n 20000 -c 20 http://localhost:8080/
</code></pre>
<p>you should see something like this on the benchmark tool side:</p>
<pre><code>Summary:
Total: 32.9538 secs
Slowest: 2.6317 secs
Fastest: 0.0002 secs
Average: 0.0331 secs
Requests/sec: 606.9098
Response time histogram:
0.000 [1] |
0.263 [16968] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
0.527 [1740] |■■■■
0.790 [0] |
1.053 [0] |
1.316 [0] |
1.579 [0] |
1.842 [0] |
2.105 [20] |
2.369 [0] |
2.632 [6] |
Latency distribution:
10% in 0.0008 secs
25% in 0.0010 secs
50% in 0.0012 secs
75% in 0.0016 secs
90% in 0.0075 secs
95% in 0.3101 secs
99% in 0.3175 secs
Details (average, fastest, slowest):
DNS+dialup: 0.0322 secs, 0.0002 secs, 2.6317 secs
DNS-lookup: 0.0006 secs, 0.0000 secs, 0.0127 secs
req write: 0.0001 secs, 0.0000 secs, 0.0095 secs
resp wait: 0.0007 secs, 0.0000 secs, 0.0140 secs
resp read: 0.0001 secs, 0.0000 secs, 0.0088 secs
Status code distribution:
[200] 18735 responses
Error distribution:
[1231] Get "http://localhost:8080/": dial tcp [::1]:8080: connect: connection refused
[16] Get "http://localhost:8080/": dial tcp [::1]:8080: connect: connection reset by peer
[1] Get "http://localhost:8080/": net/http: HTTP/1.x transport connection broken: unexpected EOF
[1] Get "http://localhost:8080/": read tcp 127.0.0.1:57078->127.0.0.1:8080: read: connection reset by peer
[1] Get "http://localhost:8080/": read tcp [::1]:57054->[::1]:8080: read: connection reset by peer
[1] Get "http://localhost:8080/": read tcp [::1]:57058->[::1]:8080: read: connection reset by peer
[1] Get "http://localhost:8080/": read tcp [::1]:57059->[::1]:8080: read: connection reset by peer
[1] Get "http://localhost:8080/": read tcp [::1]:57062->[::1]:8080: read: connection reset by peer
[1] Get "http://localhost:8080/": read tcp [::1]:57067->[::1]:8080: read: connection reset by peer
[1] Get "http://localhost:8080/": read tcp [::1]:57068->[::1]:8080: read: connection reset by peer
[1] Get "http://localhost:8080/": read tcp [::1]:57069->[::1]:8080: read: connection reset by peer
[1] Get "http://localhost:8080/": read tcp [::1]:57070->[::1]:8080: read: connection reset by peer
[1] Get "http://localhost:8080/": read tcp [::1]:57071->[::1]:8080: read: connection reset by peer
[1] Get "http://localhost:8080/": read tcp [::1]:57072->[::1]:8080: read: connection reset by peer
[1] Get "http://localhost:8080/": read tcp [::1]:57075->[::1]:8080: read: connection reset by peer
[1] Get "http://localhost:8080/": read tcp [::1]:57076->[::1]:8080: read: connection reset by peer
[1] Get "http://localhost:8080/": read tcp [::1]:57087->[::1]:8080: read: connection reset by peer
[1] Get "http://localhost:8080/": read tcp [::1]:57088->[::1]:8080: read: connection reset by peer
[1] Get "http://localhost:8080/": read tcp [::1]:57089->[::1]:8080: read: connection reset by peer
[1] Get "http://localhost:8080/": read tcp [::1]:57090->[::1]:8080: read: connection reset by peer
</code></pre>
<p>and this on the ruby process:</p>
<pre><code>...
GET / HTTP/1.1
GET / HTTP/1.1
#<Thread:0x0000000100fbf6e8 run> terminated with exception (report_on_exception is true):
ractor.rb:21:in `write': GET / HTTP/1.1
uninitialized stream (IOError)
from ractor.rb:21:in `print'
from ractor.rb:21:in `block (3 levels) in <main>'
from ractor.rb:11:in `loop'
from ractor.rb:11:in `block (2 levels) in <main>'
GET / HTTP/1.1
GET / HTTP/1.1
</code></pre> Ruby master - Bug #18903 (Open): Stack overflow signal handling seems to be triggered once and th...https://redmine.ruby-lang.org/issues/189032022-07-07T14:33:01Zchrisseaton (Chris Seaton)chris@chrisseaton.com
<p>This program creates a recursive object graph and then tries to convert it to JSON with no max depth, so it stack overflows in C code that does no co-operative stack overflow checks, as the bytecode interpreter would. This therefore triggers a segmentation fault and the stack overflow detection there. It works the first time, but the second time around it doesn't and the program hard crashes on M1.</p>
<p>Is there something like a guard page permission that is switched during the handling, and needs to switched back for the guard page to work again?</p>
<p>Note that it isn't JSON specific - I think any stack overflow within C code would do it.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="s1">'json'</span>
<span class="n">a</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">a</span> <span class="o"><<</span> <span class="n">a</span>
<span class="k">begin</span>
<span class="no">JSON</span><span class="p">.</span><span class="nf">dump</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
<span class="k">rescue</span> <span class="no">Exception</span>
<span class="nb">puts</span> <span class="s1">'rescued'</span>
<span class="k">end</span>
<span class="no">JSON</span><span class="p">.</span><span class="nf">dump</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
</code></pre> Ruby master - Bug #18842 (Open): Ruby's Resolv library does not handle correctly the `NODATA` casehttps://redmine.ruby-lang.org/issues/188422022-06-19T17:39:19Zpiradata (Guilherme Ferreira)
<p>Hello, I am opening this issue based on the following DNS bug sleuthing:</p>
<p><a href="https://gitlab.com/gitlab-org/charts/gitlab/-/issues/3303" class="external">https://gitlab.com/gitlab-org/charts/gitlab/-/issues/3303</a></p>
<p>As described by Stan Hu, seems like the Ruby's Resolv library does not handle correctly the <code>NODATA</code> case because if any of the searchpaths return the <code>NODATA</code> response the search stops there and the domain is not correctly resolved, as the correct resolution should be using the input address as FQDN.</p>
<p>Ruby looks at the DNS response code (<a href="https://github.com/ruby/ruby/blob/9c0df2e81c22e6e35f3c5d69a070c2a3cf67e320/lib/resolv.rb#L532-L552" class="external">https://github.com/ruby/ruby/blob/9c0df2e81c22e6e35f3c5d69a070c2a3cf67e320/lib/resolv.rb#L532-L552</a>), which is described in <a href="https://datatracker.ietf.org/doc/html/rfc2929#section-2.3" class="external">https://datatracker.ietf.org/doc/html/rfc2929#section-2.3</a>.</p>
<p>We are assuming that, as described in the issue, the .aws search path caused the DNS to return "No error" and DNS Resolver interprets it as valid.</p>
<p>Busybox's nslookup implementation mentions the NODATA case here: <a href="https://git.busybox.net/busybox/tree/networking/nslookup.c?h=1_35_stable#n650" class="external">https://git.busybox.net/busybox/tree/networking/nslookup.c?h=1_35_stable#n650</a>. <a href="https://datatracker.ietf.org/doc/html/rfc2308#section-2.2.1" class="external">https://datatracker.ietf.org/doc/html/rfc2308#section-2.2.1</a> and may describe the problem with Ruby's Resolv implementation:</p>
<pre><code>There are a large number of resolvers currently in existence that
fail to correctly detect and process all forms of NODATA response.
Some resolvers treat a TYPE 1 NODATA response as a referral. To
alleviate this problem it is recommended that servers that are
authoritative for the NODATA response only send TYPE 2 NODATA
responses, that is the authority section contains a SOA record and no
NS records. Sending a TYPE 1 NODATA response from a non-
authoritative server to one of these resolvers will only result in an
unnecessary query. If a server is listed as a FORWARDER for another
resolver it may also be necessary to disable the sending of TYPE 1
NODATA response for non-authoritative NODATA responses.
Some name servers fail to set the RCODE to NXDOMAIN in the presence
of CNAMEs in the answer section. If a definitive NXDOMAIN / NODATA
answer is required in this case the resolver must query again using
the QNAME as the query label.
</code></pre>
<p>As it sounded like a Ruby bug report I decided to open this issue in order to correctly to handle the NODATA case.</p>
<p>The link for the sleuthing of the problem part: <a href="https://gitlab.com/gitlab-org/charts/gitlab/-/issues/3303#note_950108922" class="external">https://gitlab.com/gitlab-org/charts/gitlab/-/issues/3303#note_950108922</a> and the specific problem can be found on the start of the comment when we could not resolve the DNS unless we removed the aws searchpath as this serachpath specifically was returning the <code>NODATA</code> response.</p> Ruby master - Bug #18818 (Open): Thread waitq does not retain referenced objects, can lead to use...https://redmine.ruby-lang.org/issues/188182022-06-05T21:39:16Znevans (Nicholas Evans)
<p>The attached script (and/or others like it) can cause SEGV in 3.0, 3.1, and master. It has always behaved as expected when I use <code>optflags=-O0</code>.</p>
<p>When I use it with <code>make run</code> on <code>master</code>:</p>
<pre><code>./miniruby -I../lib -I. -I.ext/common -r./x86_64-linux-fake ../test.rb
========================================================================
fiber_queue
completed in 0.00031349004711955786
========================================================================
fiber_sized_queue
../test.rb:62: [BUG] Segmentation fault at 0x0000000000000000
ruby 3.2.0dev (2022-06-05T06:18:26Z master 5ce0be022f) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0005 p:---- s:0023 e:000022 CFUNC :%
c:0004 p:0031 s:0018 e:000015 METHOD ../test.rb:62 [FINISH]
c:0003 p:---- s:0010 e:000009 CFUNC :pop
c:0002 p:0009 s:0006 e:000005 BLOCK ../test.rb:154 [FINISH]
c:0001 p:---- s:0003 e:000002 (none) [FINISH]
-- Ruby level backtrace information ----------------------------------------
../test.rb:154:in `block (2 levels) in <main>'
../test.rb:154:in `pop'
../test.rb:62:in `unblock'
../test.rb:62:in `%'
-- Machine register context ------------------------------------------------
RIP: 0x000055eae9ffa417 RBP: 0x00007f80aba855d8 RSP: 0x00007f80a9789598
RAX: 0x000000000000009b RBX: 0x00007f80a9789628 RCX: 0x00007f80ab9c37a0
RDX: 0x00007f80a97895c0 RDI: 0x0000000000000000 RSI: 0x000000000000009b
R8: 0x0000000000000000 R9: 0x00007f80a97895c0 R10: 0x0000000055550083
R11: 0x00007f80ac32ace0 R12: 0x00007f80aba855d8 R13: 0x00007f80ab9c3780
R14: 0x00007f80a97895c0 R15: 0x000000000000009b EFL: 0x0000000000010202
-- C level backtrace information -------------------------------------------
./miniruby(rb_vm_bugreport+0x5cf) [0x55eaea06b0ef]
./miniruby(rb_bug_for_fatal_signal+0xec) [0x55eae9e4fc2c]
./miniruby(sigsegv+0x4d) [0x55eae9fba30d]
[0x7f80ac153520]
./miniruby(rb_id_table_lookup+0x7) [0x55eae9ffa417]
./miniruby(callable_method_entry+0x103) [0x55eaea046bd3]
./miniruby(vm_respond_to+0x3f) [0x55eaea056c1f]
./miniruby(rb_check_funcall_default_kw+0x19c) [0x55eaea05788c]
./miniruby(rb_check_convert_type_with_id+0x8e) [0x55eae9f1b85e]
./miniruby(rb_str_format_m+0x1a) [0x55eae9fce82a]
./miniruby(vm_call_cfunc_with_frame+0x127) [0x55eaea041ac7]
./miniruby(vm_exec_core+0x114) [0x55eaea05d684]
./miniruby(rb_vm_exec+0x187) [0x55eaea04e747]
./miniruby(rb_funcallv_scope+0x1b0) [0x55eaea05a770]
./miniruby(rb_fiber_scheduler_unblock+0x3e) [0x55eae9fb979e]
./miniruby(sync_wakeup+0x10d) [0x55eae9ffd45d]
./miniruby(rb_szqueue_pop+0xf5) [0x55eae9ffefd5]
./miniruby(vm_call_cfunc_with_frame+0x127) [0x55eaea041ac7]
./miniruby(vm_exec_core+0x114) [0x55eaea05d684]
./miniruby(rb_vm_exec+0x187) [0x55eaea04e747]
./miniruby(rb_vm_invoke_proc+0x5f) [0x55eaea05584f]
./miniruby(rb_fiber_start+0x1da) [0x55eae9e1e24a]
./miniruby(fiber_entry+0x0) [0x55eae9e1e550]
</code></pre>
<p>I've attached the rest of the VM dump. <code>make runruby</code> gives a nearly identical dump. I can post a core dump or <code>rr</code> recording, if needed.<br>
_<br>
I'm sorry I didn't simplify the script more; small, seemingly irrelevant changes can change the failure or allow it to pass. Sometimes it raises a bizarre exception instead of SEGV, most commonly a NoMethodError which seemingly indicates that the local vars have been shifted or scrambled. For example, this particular SEGV was caused by a guard clause checking that <code>unblock(blocker, fiber)</code> was given a Fiber object. Here, that object is invalid, but I've seen it be a string or some other object from elsewhere in the process.</p>
<p>For comparison, this is what the script output should look like:</p>
<pre><code>========================================================================
fiber_queue
completed in 0.00031569297425448895
========================================================================
fiber_sized_queue
completed in 0.1176840600091964
========================================================================
fiber_sized_queue2
completed in 0.19209402799606323
========================================================================
fiber_sized_queue3
completed in 0.21404067997355014
========================================================================
fiber_sized_queue4
completed in 0.30277197097893804
</code></pre>
<p>I was attempting to create some simple benchmarks for <code>Queue</code> and <code>SizedQueue</code> with fibers, to mimic <code>benchmark/vm_thread_*queue*.rb</code>. I never completed the benchmarks because of this SEGV. :)</p> Ruby master - Bug #18794 (Open): Windows - intermittent SEGV TestObjSpace#test_reachable_objects_...https://redmine.ruby-lang.org/issues/187942022-05-20T17:19:08ZMSP-Greg (Greg L)
<p>Test runs in retry, generates the following (removed path from x64-ucrt-ruby320.dll). mswin build runs it as a single test, I don't believe it's failed.</p>
<pre><code> 1) Failure:
TestObjSpace#test_reachable_objects_during_iteration Line: 145
assert_separately failed with error message
pid 70572 exit 3
| -:8: [BUG] Unnormalized Fixnum value 0x0000023f8eeb2119
| ruby 3.2.0dev (2022-05-20T15:42:07Z master 11336c7ddb) [x64-mingw-ucrt]
|
| -- Control frame information -----------------------------------------------
| c:0006 p:---- s:0021 e:000020 CFUNC :to_s
| c:0005 p:---- s:0018 e:000017 CFUNC :inspect
| c:0004 p:0004 s:0014 e:000013 BLOCK -:8 [FINISH]
| c:0003 p:---- s:0010 e:000009 CFUNC :each_object
| c:0002 p:0073 s:0006 e:000005 EVAL -:7 [FINISH]
| c:0001 p:0000 s:0003 E:002060 (none) [FINISH]
|
| -- Ruby level backtrace information ----------------------------------------
| -:7:in `<main>'
| -:7:in `each_object'
| -:8:in `block in <main>'
| -:8:in `inspect'
| -:8:in `to_s'
|
| -- C level backtrace information -------------------------------------------
| C:\Windows\SYSTEM32\ntdll.dll(NtWaitForSingleObject+0x14) [0x00007ffbdb40ef74]
| C:\Windows\System32\KERNELBASE.dll(WaitForSingleObjectEx+0x8e) [0x00007ffbd89fe7ae]
| x64-ucrt-ruby320.dll(rb_vm_bugreport+0x313) [0x00007ffba62417c3]
| x64-ucrt-ruby320.dll(rb_bug_without_die+0x75) [0x00007ffba6039d15]
| x64-ucrt-ruby320.dll(rb_bug+0x33) [0x00007ffba626e014]
| x64-ucrt-ruby320.dll(rb_out_of_int+0x42) [0x00007ffba626f81b]
| x64-ucrt-ruby320.dll(rb_vm_invoke_proc+0x22c) [0x00007ffba622c34c]
| x64-ucrt-ruby320.dll(rb_eval_cmd_kw+0x5ea) [0x00007ffba6230e7a]
| x64-ucrt-ruby320.dll(rb_funcallv+0x11) [0x00007ffba62310c1]
| x64-ucrt-ruby320.dll(rb_inspect+0x17) [0x00007ffba60f9417]
| x64-ucrt-ruby320.dll(rb_hash_values+0xfc1) [0x00007ffba606e791]
| x64-ucrt-ruby320.dll(rb_hash_values+0x102c) [0x00007ffba606e7fc]
| x64-ucrt-ruby320.dll(rb_st_foreach_check+0x77) [0x00007ffba61a1637]
| x64-ucrt-ruby320.dll(rb_hash_set_default_proc+0x1e19) [0x00007ffba60724a9]
| x64-ucrt-ruby320.dll(rb_ensure+0x18f) [0x00007ffba60453af]
| x64-ucrt-ruby320.dll(rb_hash_set_default_proc+0x2272) [0x00007ffba6072902]
| x64-ucrt-ruby320.dll(rb_hash_aset+0x1d1f) [0x00007ffba6077c2f]
| x64-ucrt-ruby320.dll(rb_mutex_trylock+0x51c) [0x00007ffba61d864c]
| x64-ucrt-ruby320.dll(rb_exec_recursive+0x17) [0x00007ffba61e0217]
| x64-ucrt-ruby320.dll(rb_error_arity+0x26e) [0x00007ffba62182ee]
| x64-ucrt-ruby320.dll(rb_vm_call_with_refinements+0x47d) [0x00007ffba6233fed]
| x64-ucrt-ruby320.dll(rb_vm_exec+0x255) [0x00007ffba62252a5]
| x64-ucrt-ruby320.dll(rb_yield+0x1e8) [0x00007ffba622ac88]
| x64-ucrt-ruby320.dll(rb_obj_id+0x1c94) [0x00007ffba6057024]
| x64-ucrt-ruby320.dll(rb_size_mul_or_raise+0x154) [0x00007ffba605c464]
| x64-ucrt-ruby320.dll(rb_ensure+0x18f) [0x00007ffba60453af]
| x64-ucrt-ruby320.dll(rb_objspace_each_objects_without_setup+0x1ac) [0x00007ffba606562c]
| x64-ucrt-ruby320.dll(rb_error_arity+0x26e) [0x00007ffba62182ee]
| x64-ucrt-ruby320.dll(rb_vm_search_method_slowpath+0x723) [0x00007ffba621ce33]
| x64-ucrt-ruby320.dll(rb_vm_call_with_refinements+0x4e8) [0x00007ffba6234058]
| x64-ucrt-ruby320.dll(rb_vm_exec+0x255) [0x00007ffba62252a5]
| x64-ucrt-ruby320.dll(rb_call_end_proc+0x130) [0x00007ffba603e400]
| x64-ucrt-ruby320.dll(ruby_run_node+0xa5) [0x00007ffba6044145]
| [0x00007ff62fcc15a8]
| [0x00007ff62fcc13b1]
| [0x00007ff62fcc14e6]
| C:\Windows\System32\KERNEL32.DLL(BaseThreadInitThunk+0x10) [0x00007ffbd93c4ed0]
</code></pre> Ruby master - Bug #18740 (Open): Use of rightward assignment changes line number needed for line-...https://redmine.ruby-lang.org/issues/187402022-04-18T10:00:41Zhurricup (Alexandr Evstigneev)hurricup@gmail.com
<p>Affected ruby 3.1.1</p>
<p>Sample illustrating the problem (<code>test.rb</code>):</p>
<pre><code>def foo
File.read("test.rb")
.split("\n")
.map(&:strip)
.reject(&:empty?)
.first(10) => lines
puts lines
end
TracePoint.new(:line){ puts 'Hi' }.enable(target: RubyVM::InstructionSequence.of(method :foo), target_line: 2)
foo
</code></pre>
<p>produces</p>
<pre><code><internal:trace_point>:212:in `enable': can not enable any hooks (ArgumentError)
</code></pre>
<p>iseq for method:</p>
<pre><code>== disasm: #<ISeq:foo@/home/hurricup/test.rb:1 (1,0)-(9,3)> (catch: FALSE)
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] lines@0
0000 putnil ( 6)[LiCa]
0001 putnil
0002 putobject false
0004 putnil
0005 putnil
0006 opt_getinlinecache 15, <is:0> ( 2)
0009 putobject true
0011 getconstant :File
0013 opt_setinlinecache <is:0>
0015 putstring "test.rb"
0017 opt_send_without_block <calldata!mid:read, argc:1, ARGS_SIMPLE>
0019 putstring "\n" ( 3)
0021 opt_send_without_block <calldata!mid:split, argc:1, ARGS_SIMPLE>
0023 putobject :strip ( 4)
0025 send <calldata!mid:map, argc:0, ARGS_BLOCKARG>, nil
0028 putobject :empty? ( 5)
0030 send <calldata!mid:reject, argc:0, ARGS_BLOCKARG>, nil
0033 putobject 10 ( 6)
0035 opt_send_without_block <calldata!mid:first, argc:1, ARGS_SIMPLE>
0037 dup
0038 setlocal_WC_0 lines@0
0040 jump 88
0042 putspecialobject 1 ( 2)
0044 topn 4
0046 branchif 64
0048 putobject NoMatchingPatternError
0050 putspecialobject 1
0052 putobject "%p: %s"
0054 topn 4
0056 topn 7
0058 opt_send_without_block <calldata!mid:core#sprintf, argc:3, ARGS_SIMPLE>
0060 opt_send_without_block <calldata!mid:core#raise, argc:2, ARGS_SIMPLE>
0062 jump 84
0064 putobject NoMatchingPatternKeyError
0066 putspecialobject 1
0068 putobject "%p: %s"
0070 topn 4
0072 topn 7
0074 opt_send_without_block <calldata!mid:core#sprintf, argc:3, ARGS_SIMPLE>
0076 topn 7
0078 topn 9
0080 opt_send_without_block <calldata!mid:new, argc:3, kw:[matchee,key], KWARG>
0082 opt_send_without_block <calldata!mid:core#raise, argc:1, ARGS_SIMPLE>
0084 adjuststack 7
0086 jump 90
0088 adjuststack 6 ( 6)
0090 putself ( 8)[Li]
0091 getlocal_WC_0 lines@0
0093 opt_send_without_block <calldata!mid:puts, argc:1, FCALL|ARGS_SIMPLE>
0095 leave ( 9)[Re]
</code></pre>
<p>Works like a charm without <code>=> lines</code></p> Ruby master - Bug #18733 (Open): Ruby GC problems cause performance issue with Ractorhttps://redmine.ruby-lang.org/issues/187332022-04-15T05:04:10Zjakit (Jakit Liang)
<p>Code:</p>
<pre><code>require 'benchmark'
def fib(n)
return n if [0,1].include?(n)
fib(n-1) + fib(n-2)
end
tp = []
puts Benchmark.measure {
8.times do
tp << fork { fib(37) }
end
tp.each { |t| Process.wait(t) }
}
puts Benchmark.measure {
8.times.map {
Ractor.new { fib(37) }
}.each{ |r| r.take }
}
</code></pre>
<p>Result:</p>
<table>
<thead>
<tr>
<th>A</th>
<th>B</th>
</tr>
</thead>
<tbody>
<tr>
<td>fork</td>
<td>0.000264 0.003439 87.181198 ( 11.211349)</td>
</tr>
<tr>
<td>Ractor</td>
<td>80.292916 15.062559 95.355475 ( 39.569527)</td>
</tr>
</tbody>
</table>
<p>And I found that here's the problem showing on the ActiveMonitor.app:</p>
<p><img src="http://jakit.cn/screen_shot_ruby_bug.jpg" alt="ruby_bug_with_m1"></p>
<p>As you can see, the process of ruby is always using all Performance Cores on my Apple M1 Mac.</p>
<p>But there's no one of the Efficiency Cores was in used by ruby Ractor.</p> Ruby master - Bug #18608 (Open): `require': cannot load such file -- ripper (LoadError) after `ma...https://redmine.ruby-lang.org/issues/186082022-03-03T19:51:39Zbrandonrdn (Brandon Riden)
<p>When compiling multiple instances of Ruby (In our case, two separate prefixes), using the following build code causes the 2nd installed Ruby to throw an error on any ruby/irb call.</p>
<p>Changing the code to delete the extracted <code>ruby-3.1.0</code> folder and re-extract from the tarball fixes this issue, so I believe it's something in the <code>make distclean</code> that's causing issues. This was not an issue for ruby 2.6.3 or 2.6.7, just on 3.0+ versions.</p>
<p>Build code:</p>
<pre><code># Build Ruby
RUN set -e ; \
. /etc/profile.d/ccache.sh ; \
wget -q https://cache.ruby-lang.org/pub/ruby/${RUBY_VERSION%.*}/ruby-${RUBY_VERSION}.tar.gz ; \
tar zxf ruby-${RUBY_VERSION}.tar.gz ; \
rm -f ruby-${RUBY_VERSION}.tar.gz ; \
pushd ruby-${RUBY_VERSION} ; \
type -p gcc ; \
for prefix in /usr/local /opt/vendored_ruby ; do \
./configure --prefix=$prefix --with-compress-debug-sections=no --disable-install-doc ; \
make ; \
make install ; \
make distclean ; \
done ; \
popd ; \
ccache --show-stats ; \
rm -rf ruby-${RUBY_VERSION} /root/.ccache
</code></pre>
<p>Error:</p>
<pre><code><internal:/opt/vendored_ruby/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- ripper (LoadError)
from <internal:/opt/vendored_ruby/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from /opt/vendored_ruby/lib/ruby/3.1.0/irb.rb:12:in `<top (required)>'
from <internal:/opt/vendored_ruby/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from <internal:/opt/vendored_ruby/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from /opt/vendored_ruby/lib/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:9:in `<top (required)>'
from /opt/vendored_ruby/bin/irb:25:in `load'
from /opt/vendored_ruby/bin/irb:25:in `<main>'
[root@cc75157e1b69 /]# /usr/local/bin/irb
irb(main):001:0>
</code></pre>
<p>This error pops up on any reference to ruby or irb, including the base commands.</p>
<p>Steps to reproduce:</p>
<ul>
<li>Compile/make/make install Ruby 3.0+ with the 1st prefix</li>
<li>Run <code>make distclean</code>
</li>
<li>Compile/make/make install Ruby 3.0+ with the 2nd prefix</li>
<li>run the <code>irb</code> and <code>ruby</code> commands in both paths.</li>
</ul> Ruby master - Bug #18510 (Open): Unexpected waiting for console when starting ruby on windowshttps://redmine.ruby-lang.org/issues/185102022-01-23T14:53:12ZYO4 (Yoshinao Muramatsu)
<a name="ruby-version"></a>
<h1 >ruby version<a href="#ruby-version" class="wiki-anchor">¶</a></h1>
<p>C:\Ruby31-x64\bin>"c:\Ruby31-x64\bin\ruby.exe" -v<br>
ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x64-mingw-ucrt]</p>
<p>older versions have same issue too.</p>
<a name="how-to-reproduce"></a>
<h1 >how to reproduce<a href="#how-to-reproduce" class="wiki-anchor">¶</a></h1>
<p>execute ruby.exe from cmd.exe command promput like concatenating the quoted path and file name notation</p>
<pre><code>C:\Ruby31-x64\bin>"c:\Ruby31-x64\bin\"ruby.exe -v
# => wait for console input unexpectedly
puts "This is Console Input"^Z
=> This is Console Input
# ruby terminated, version not appear
</code></pre>
<p>It seems to commandline separation issue.</p> Ruby master - Bug #18444 (Open): Trapped TSTP causes a locking deadlock in 3.0.3 onwardhttps://redmine.ruby-lang.org/issues/184442021-12-28T16:01:45Zwhy-el (Mohamed Wael Khobalatte)
<p>A curious case:</p>
<p><code>ruby -e 'Signal.trap("TSTP") { puts "Received a terminal stop signal, but i will sleep instead."; sleep 10 }; loop {puts 1}'</code></p>
<p>this fails with <code>deadlock; recursive locking (ThreadError)</code> when I send the SIGTSTP via my terminal. This is on Mac OS Monterey (M1). It only happens in 3.0.3 and onward (I tried 3.1.0-preview1 as well, fails there too), when I try 3.0.2, the signal is handled properly.</p> Ruby master - Bug #18412 (Open): Segfault in test_ractor.rbhttps://redmine.ruby-lang.org/issues/184122021-12-16T09:18:39Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<p>During build of Ruby 3.0.3 for Fedora, I sometimes bump into this issue:</p>
<pre><code>... snip ...
test_attr.rb ..
test_autoload.rb ........
test_block.rb ..........................................................
test_class.rb ................................................
test_env.rb ..
test_eval.rb .....................................
test_exception.rb ..................................
test_fiber.rb .....
test_finalizer.rb .
test_flip.rb .
test_flow.rb ..............................................................
test_fork.rb ....
test_gc.rb ..
test_insns.rb ...............................................................................................................................................................................................................................................................................................................................................................................................
test_io.rb .........
test_jump.rb .............................
test_literal.rb ............................................................................................................................................................
test_literal_suffix.rb ................................................
test_load.rb ..
test_marshal.rb .
test_massign.rb ..................................
test_method.rb ...............................................................................................................................................................................................................................
test_objectspace.rb ......
test_proc.rb .....................................
test_ractor.rb .........................................................................................Fstderr output is not empty
<internal:ractor>:627: [BUG] Segmentation fault at 0x0000000000000038
ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [powerpc64le-linux]
-- Control frame information -----------------------------------------------
c:0005 p:0003 s:0020 e:000019 METHOD <internal:ractor>:627
c:0004 p:0032 s:0013 e:000012 BLOCK bootstraptest.tmp.rb:6 [FINISH]
c:0003 p:---- s:0010 e:000009 CFUNC :loop
c:0002 p:0005 s:0006 e:000005 BLOCK bootstraptest.tmp.rb:4 [FINISH]
c:0001 p:---- s:0003 e:000002 (none) [FINISH]
-- Ruby level backtrace information ----------------------------------------
bootstraptest.tmp.rb:4:in `block (2 levels) in <main>'
bootstraptest.tmp.rb:4:in `loop'
bootstraptest.tmp.rb:6:in `block (3 levels) in <main>'
<internal:ractor>:627:in `yield'
-- C level backtrace information -------------------------------------------
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(rb_print_backtrace+0x24) [0x7fffb1dd3604] vm_dump.c:758
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(rb_vm_bugreport.constprop.0+0x5c0) [0x7fffb1df1780] vm_dump.c:998
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(rb_bug_for_fatal_signal+0xa4) [0x7fffb1bbdc74] error.c:786
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(sigsegv+0x68) [0x7fffb1d2a4a8] signal.c:963
[0x7fffb1f80464]
[0x7fffb191ad68]
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(rb_native_mutex_lock+0x18) [0x7fffb1d6f558] thread_pthread.c:397
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(ractor_select+0x480) [0x7fffb1cda060] ractor.c:61
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(builtin_inline_class_627.lto_priv.0+0x50) [0x7fffb1cdaa30] ractor.c:1286
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(builtin_invoker0.lto_priv.0+0x24) [0x7fffb1db5624] vm_insnhelper.c:5445
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(vm_exec_core.lto_priv.0+0x254c) [0x7fffb1dbfe6c] insns.def:1493
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(rb_vm_exec+0x130) [0x7fffb1ddc7e0] vm.c:2172
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(loop_i+0x2e4) [0x7fffb1dc7bd4] vm.c:1263
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(rb_vrescue2+0xec) [0x7fffb1bbc6cc] eval.c:1019
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(rb_rescue2+0x3c) [0x7fffb1bbc8bc] eval.c:996
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(rb_f_loop.lto_priv.0+0x58) [0x7fffb1dc87c8] vm_eval.c:1483
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(ractor_safe_call_cfunc_0.lto_priv.0+0x24) [0x7fffb1da7904] vm_insnhelper.c:2748
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(vm_call_cfunc_with_frame+0x150) [0x7fffb1db2650] vm_insnhelper.c:2931
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(vm_sendish.lto_priv.0+0x3dc) [0x7fffb1db7b0c] vm_insnhelper.c:4532
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(vm_exec_core.lto_priv.0+0x1890) [0x7fffb1dbf1b0] insns.def:770
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(rb_vm_exec+0x130) [0x7fffb1ddc7e0] vm.c:2172
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(vm_invoke_proc.lto_priv.0+0x2c0) [0x7fffb1dcfc90] vm.c:1263
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(thread_do_start_proc.lto_priv.0+0x5ac) [0x7fffb1d7852c] vm.c:1499
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(thread_start_func_2.constprop.0.isra.0+0x958) [0x7fffb1dfacf8] thread.c:759
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(thread_start_func_1+0x180) [0x7fffb1d70070] thread_pthread.c:994
[0x7fffb1916264]
[0x7fffb19c5f30]
-- Other runtime information -----------------------------------------------
* Loaded script: bootstraptest.tmp.rb
* Loaded features:
0 enumerator.so
1 thread.rb
2 rational.so
3 complex.so
4 ruby2_keywords.rb
5 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/encdb.so
6 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/trans/transdb.so
7 /builddir/build/BUILD/ruby-3.0.3/abrt.rb
* Process memory map:
102330000-102340000 r--p 00000000 fc:06 1076662947 /builddir/build/BUILD/ruby-3.0.3/ruby
102340000-102350000 r-xp 00010000 fc:06 1076662947 /builddir/build/BUILD/ruby-3.0.3/ruby
102350000-102360000 r--p 00020000 fc:06 1076662947 /builddir/build/BUILD/ruby-3.0.3/ruby
102360000-102370000 r--p 00020000 fc:06 1076662947 /builddir/build/BUILD/ruby-3.0.3/ruby
102370000-102380000 rw-p 00030000 fc:06 1076662947 /builddir/build/BUILD/ruby-3.0.3/ruby
134320000-134530000 rw-p 00000000 00:00 0 [heap]
7fff88000000-7fff88bd0000 rw-p 00000000 00:00 0
7fff88bd0000-7fff8c000000 ---p 00000000 00:00 0
7fff8c000000-7fff8cd90000 rw-p 00000000 00:00 0
7fff8cd90000-7fff90000000 ---p 00000000 00:00 0
7fff90000000-7fff901e0000 rw-p 00000000 00:00 0
7fff901e0000-7fff94000000 ---p 00000000 00:00 0
7fff94000000-7fff94be0000 rw-p 00000000 00:00 0
7fff94be0000-7fff98000000 ---p 00000000 00:00 0
7fff98000000-7fff99320000 rw-p 00000000 00:00 0
7fff99320000-7fff9c000000 ---p 00000000 00:00 0
7fff9c000000-7fff9cc40000 rw-p 00000000 00:00 0
7fff9cc40000-7fffa0000000 ---p 00000000 00:00 0
7fffa0000000-7fffa0d60000 rw-p 00000000 00:00 0
7fffa0d60000-7fffa4000000 ---p 00000000 00:00 0
7fffa7ed0000-7fffa7ee0000 ---p 00000000 00:00 0
7fffa7ee0000-7fffa8000000 rw-p 00000000 00:00 0
7fffa8000000-7fffa91a0000 rw-p 00000000 00:00 0
7fffa91a0000-7fffac000000 ---p 00000000 00:00 0
7fffada60000-7fffadaa0000 r--s 00000000 fc:06 1076662947 /builddir/build/BUILD/ruby-3.0.3/ruby
7fffadaa0000-7fffadab0000 r--p 00000000 fc:06 1614754146 /usr/lib64/libgcc_s-11-20211203.so.1
7fffadab0000-7fffadac0000 r-xp 00010000 fc:06 1614754146 /usr/lib64/libgcc_s-11-20211203.so.1
7fffadac0000-7fffadad0000 r--p 00020000 fc:06 1614754146 /usr/lib64/libgcc_s-11-20211203.so.1
7fffadad0000-7fffadae0000 r--p 00020000 fc:06 1614754146 /usr/lib64/libgcc_s-11-20211203.so.1
7fffadae0000-7fffadaf0000 rw-p 00030000 fc:06 1614754146 /usr/lib64/libgcc_s-11-20211203.so.1
7fffadaf0000-7fffadb00000 ---p 00000000 00:00 0
7fffadb00000-7fffadc20000 rw-p 00000000 00:00 0
7fffadc20000-7fffadc30000 ---p 00000000 00:00 0
7fffadc30000-7fffadd50000 rw-p 00000000 00:00 0
7fffadd50000-7fffadd60000 ---p 00000000 00:00 0
7fffadd60000-7fffade80000 rw-p 00000000 00:00 0
7fffade80000-7fffade90000 ---p 00000000 00:00 0
7fffade90000-7fffadfb0000 rw-p 00000000 00:00 0
7fffadfb0000-7fffadfc0000 ---p 00000000 00:00 0
7fffadfc0000-7fffae0e0000 rw-p 00000000 00:00 0
7fffae0e0000-7fffae0f0000 ---p 00000000 00:00 0
7fffae0f0000-7fffae210000 rw-p 00000000 00:00 0
7fffae210000-7fffae220000 ---p 00000000 00:00 0
7fffae220000-7fffae340000 rw-p 00000000 00:00 0
7fffae340000-7fffae350000 r--p 00000000 fc:06 1616770133 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/trans/transdb.so
7fffae350000-7fffae360000 r-xp 00010000 fc:06 1616770133 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/trans/transdb.so
7fffae360000-7fffae370000 r--p 00020000 fc:06 1616770133 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/trans/transdb.so
7fffae370000-7fffae380000 r--p 00020000 fc:06 1616770133 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/trans/transdb.so
7fffae380000-7fffae390000 rw-p 00000000 00:00 0
7fffae390000-7fffae3a0000 r--p 00000000 fc:06 1076646137 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/encdb.so
7fffae3a0000-7fffae3b0000 r-xp 00010000 fc:06 1076646137 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/encdb.so
7fffae3b0000-7fffae3c0000 r--p 00020000 fc:06 1076646137 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/encdb.so
7fffae3c0000-7fffae3d0000 r--p 00020000 fc:06 1076646137 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/encdb.so
7fffae3d0000-7fffae3e0000 rw-p 00000000 00:00 0
7fffae3e0000-7fffae3f0000 ---p 00000000 00:00 0
7fffae3f0000-7fffae460000 rw-p 00000000 00:00 0
7fffae460000-7fffae470000 ---p 00000000 00:00 0
7fffae470000-7fffae4e0000 rw-p 00000000 00:00 0
7fffae4e0000-7fffae4f0000 ---p 00000000 00:00 0
7fffae4f0000-7fffae560000 rw-p 00000000 00:00 0
7fffae560000-7fffae570000 ---p 00000000 00:00 0
7fffae570000-7fffae5e0000 rw-p 00000000 00:00 0
7fffae5e0000-7fffae5f0000 ---p 00000000 00:00 0
7fffae5f0000-7fffae660000 rw-p 00000000 00:00 0
7fffae660000-7fffae670000 ---p 00000000 00:00 0
7fffae670000-7fffae6e0000 rw-p 00000000 00:00 0
7fffae6e0000-7fffae6f0000 ---p 00000000 00:00 0
7fffae6f0000-7fffae760000 rw-p 00000000 00:00 0
7fffae760000-7fffae770000 ---p 00000000 00:00 0
7fffae770000-7fffae7e0000 rw-p 00000000 00:00 0
7fffae7e0000-7fffae7f0000 ---p 00000000 00:00 0
7fffae7f0000-7fffae860000 rw-p 00000000 00:00 0
7fffae860000-7fffae870000 ---p 00000000 00:00 0
7fffae870000-7fffae8e0000 rw-p 00000000 00:00 0
7fffae8e0000-7fffae8f0000 ---p 00000000 00:00 0
7fffae8f0000-7fffae960000 rw-p 00000000 00:00 0
7fffae960000-7fffae970000 ---p 00000000 00:00 0
7fffae970000-7fffae9e0000 rw-p 00000000 00:00 0
7fffae9e0000-7fffae9f0000 ---p 00000000 00:00 0
7fffae9f0000-7fffaea60000 rw-p 00000000 00:00 0
7fffaea60000-7fffaea70000 ---p 00000000 00:00 0
7fffaea70000-7fffaeae0000 rw-p 00000000 00:00 0
7fffaeae0000-7fffaeaf0000 ---p 00000000 00:00 0
7fffaeaf0000-7fffaeb60000 rw-p 00000000 00:00 0
7fffaeb60000-7fffaeb70000 ---p 00000000 00:00 0
7fffaeb70000-7fffaebe0000 rw-p 00000000 00:00 0
7fffaebe0000-7fffaebf0000 ---p 00000000 00:00 0
7fffaebf0000-7fffaec60000 rw-p 00000000 00:00 0
7fffaec60000-7fffaec70000 ---p 00000000 00:00 0
7fffaec70000-7fffaece0000 rw-p 00000000 00:00 0
7fffaece0000-7fffaecf0000 ---p 00000000 00:00 0
7fffaecf0000-7fffaed60000 rw-p 00000000 00:00 0
7fffaed60000-7fffaed70000 ---p 00000000 00:00 0
7fffaed70000-7fffaede0000 rw-p 00000000 00:00 0
7fffaede0000-7fffaedf0000 ---p 00000000 00:00 0
7fffaedf0000-7fffaee60000 rw-p 00000000 00:00 0
7fffaee60000-7fffaee70000 ---p 00000000 00:00 0
7fffaee70000-7fffaeee0000 rw-p 00000000 00:00 0
7fffaeee0000-7fffaeef0000 ---p 00000000 00:00 0
7fffaeef0000-7fffaef60000 rw-p 00000000 00:00 0
7fffaef60000-7fffaef70000 ---p 00000000 00:00 0
7fffaef70000-7fffaefe0000 rw-p 00000000 00:00 0
7fffaefe0000-7fffaeff0000 ---p 00000000 00:00 0
7fffaeff0000-7fffaf060000 rw-p 00000000 00:00 0
7fffaf060000-7fffaf070000 ---p 00000000 00:00 0
7fffaf070000-7fffaf0e0000 rw-p 00000000 00:00 0
7fffaf0e0000-7fffaf0f0000 ---p 00000000 00:00 0
7fffaf0f0000-7fffaf160000 rw-p 00000000 00:00 0
7fffaf160000-7fffaf170000 ---p 00000000 00:00 0
7fffaf170000-7fffaf1e0000 rw-p 00000000 00:00 0
7fffaf1e0000-7fffaf1f0000 ---p 00000000 00:00 0
7fffaf1f0000-7fffaf260000 rw-p 00000000 00:00 0
7fffaf260000-7fffaf270000 ---p 00000000 00:00 0
7fffaf270000-7fffaf2e0000 rw-p 00000000 00:00 0
7fffaf2e0000-7fffaf2f0000 ---p 00000000 00:00 0
7fffaf2f0000-7fffaf360000 rw-p 00000000 00:00 0
7fffaf360000-7fffaf370000 ---p 00000000 00:00 0
7fffaf370000-7fffb1570000 rw-p 00000000 00:00 0
7fffb1570000-7fffb1590000 r--p 00000000 fc:06 1615030600 /usr/lib64/libm.so.6
7fffb1590000-7fffb1650000 r-xp 00020000 fc:06 1615030600 /usr/lib64/libm.so.6
7fffb1650000-7fffb16b0000 r--p 000e0000 fc:06 1615030600 /usr/lib64/libm.so.6
7fffb16b0000-7fffb16c0000 r--p 00130000 fc:06 1615030600 /usr/lib64/libm.so.6
7fffb16c0000-7fffb16d0000 rw-p 00140000 fc:06 1615030600 /usr/lib64/libm.so.6
7fffb16d0000-7fffb16e0000 r--p 00000000 fc:06 1615031006 /usr/lib64/libcrypt.so.2.0.0
7fffb16e0000-7fffb1700000 r-xp 00010000 fc:06 1615031006 /usr/lib64/libcrypt.so.2.0.0
7fffb1700000-7fffb1720000 r--p 00030000 fc:06 1615031006 /usr/lib64/libcrypt.so.2.0.0
7fffb1720000-7fffb1730000 r--p 00040000 fc:06 1615031006 /usr/lib64/libcrypt.so.2.0.0
7fffb1730000-7fffb1740000 rw-p 00000000 00:00 0
7fffb1740000-7fffb1750000 r--p 00000000 fc:06 1615031014 /usr/lib64/libgmp.so.10.4.1
7fffb1750000-7fffb17d0000 r-xp 00010000 fc:06 1615031014 /usr/lib64/libgmp.so.10.4.1
7fffb17d0000-7fffb17f0000 r--p 00090000 fc:06 1615031014 /usr/lib64/libgmp.so.10.4.1
7fffb17f0000-7fffb1800000 r--p 000a0000 fc:06 1615031014 /usr/lib64/libgmp.so.10.4.1
7fffb1800000-7fffb1810000 rw-p 000b0000 fc:06 1615031014 /usr/lib64/libgmp.so.10.4.1
7fffb1810000-7fffb1830000 r-xp 00000000 fc:06 1615030899 /usr/lib64/libz.so.1.2.11
7fffb1830000-7fffb1840000 r--p 00010000 fc:06 1615030899 /usr/lib64/libz.so.1.2.11
7fffb1840000-7fffb1850000 rw-p 00020000 fc:06 1615030899 /usr/lib64/libz.so.1.2.11
7fffb1850000-7fffb1890000 r--p 00000000 fc:06 1615030597 /usr/lib64/libc.so.6
7fffb1890000-7fffb1a40000 r-xp 00040000 fc:06 1615030597 /usr/lib64/libc.so.6
7fffb1a40000-7fffb1ab0000 r--p 001f0000 fc:06 1615030597 /usr/lib64/libc.so.6
7fffb1ab0000-7fffb1ac0000 r--p 00250000 fc:06 1615030597 /usr/lib64/libc.so.6
7fffb1ac0000-7fffb1ad0000 rw-p 00260000 fc:06 1615030597 /usr/lib64/libc.so.6
7fffb1ae0000-7fffb1b20000 r--p 00000000 fc:06 1077936030 /builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3
7fffb1b20000-7fffb1e10000 r-xp 00040000 fc:06 1077936030 /builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3
7fffb1e10000-7fffb1f20000 r--p 00330000 fc:06 1077936030 /builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3
7fffb1f20000-7fffb1f30000 ---p 00440000 fc:06 1077936030 /builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3
7fffb1f30000-7fffb1f40000 r--p 00440000 fc:06 1077936030 /builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3
7fffb1f40000-7fffb1f50000 rw-p 00450000 fc:06 1077936030 /builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3
7fffb1f50000-7fffb1f60000 rw-p 00000000 00:00 0
7fffb1f60000-7fffb1f80000 r--p 00000000 00:00 0 [vvar]
7fffb1f80000-7fffb1f90000 r-xp 00000000 00:00 0 [vdso]
7fffb1f90000-7fffb1fa0000 r--p 00000000 fc:06 1615030592 /usr/lib64/ld64.so.2
7fffb1fa0000-7fffb1ff0000 r-xp 00010000 fc:06 1615030592 /usr/lib64/ld64.so.2
7fffb1ff0000-7fffb2000000 r--p 00060000 fc:06 1615030592 /usr/lib64/ld64.so.2
7fffb2000000-7fffb2010000 r--p 00060000 fc:06 1615030592 /usr/lib64/ld64.so.2
7fffb2010000-7fffb2020000 rw-p 00070000 fc:06 1615030592 /usr/lib64/ld64.so.2
7fffd3830000-7fffd4030000 rw-p 00000000 00:00 0 [stack]
test_string.rb .
test_struct.rb .
test_syntax.rb ............................................................................................................................................................
test_thread.rb .................................................
Fiber count: 10000 (skipping)
#1282 test_ractor.rb:1405:in `<top (required)>':
workers = (0...8).map do
Ractor.new do
loop do
10_000.times.map { Object.new }
Ractor.yield Time.now
end
end
end
1_000.times { idle_worker, tmp_reporter = Ractor.select(*workers) }
"ok"
#=> "" (expected "ok")
FAIL 1/1489 tests failed
make: *** [uncommon.mk:767: yes-btest-ruby] Error 1
... snip ...
</code></pre>
<p>It reminds me <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Segmentation fault when yielding values from Ractors during GC sweeping (Closed)" href="https://redmine.ruby-lang.org/issues/18117">#18117</a>, but that should be fixed, right?</p> Ruby master - Bug #18359 (Open): [Windows MinGW] warning Please include winsock2.h before windows.hhttps://redmine.ruby-lang.org/issues/183592021-11-23T17:05:03ZMSP-Greg (Greg L)
<p>Compile warning from <code>include/ruby/win32.h</code>? Appears with both MINGW64 & UCRT64 builds.</p>
<pre><code>In file included from D:/ruby-mingw/include/ruby-3.1.0/ruby/win32.h:41,
from D:/ruby-mingw/include/ruby-3.1.0/ruby/internal/dosish.h:38,
from D:/ruby-mingw/include/ruby-3.1.0/ruby/defines.h:78,
from D:/ruby-mingw/include/ruby-3.1.0/ruby/ruby.h:25,
from D:/ruby-mingw/include/ruby-3.1.0/ruby.h:38,
from ../../../../ext/nokogiri/nokogiri.h:68,
from ../../../../ext/nokogiri/gumbo.c:30:
C:/msys64/mingw64/x86_64-w64-mingw32/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp]
15 | #warning Please include winsock2.h before windows.h
| ^~~~~~~
</code></pre> Ruby master - Bug #18337 (Assigned): Ruby allows zero-width characters in identifiershttps://redmine.ruby-lang.org/issues/183372021-11-15T00:14:21Zduerst (Martin Dürst)duerst@it.aoyama.ac.jp
<p>Ruby allows zero-width characters in identifiers, which can be shown with the following small test:</p>
<p>irb(main):001:0> script = "ab = 20; a\u200Bb = 30; puts ab;"<br>
=> "ab = 20; ab = 30; puts ab;"<br>
irb(main):002:0> eval(script)<br>
20<br>
=> nil</p>
<p>The first line creates the script. It contains a zero-width space (ZWSP), but that's not visible in most contexts (see next line). Looking at the script, one expects 30 as an output, but the output is 20 because there are two variables involved, one with a ZWSP and one without. I propose we fix this by disallowing such characters in identifiers. I'll give more details in a followup.</p> Ruby master - Bug #18132 (Open): TODO: fix ccan/list thread safetyhttps://redmine.ruby-lang.org/issues/181322021-08-25T07:19:47Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<p>This library does not consider multi-threading at all.<br>
Callers must consider it instead.<br>
AFAIK, VM list has a problem, and others may.</p> Ruby master - Bug #18080 (Open): Syntax error on one-line pattern matchinghttps://redmine.ruby-lang.org/issues/180802021-08-17T05:54:42Zko1 (Koichi Sasada)
<p>One line pattern matching with a method return value with parameters which are not surrounded by parenthesis raises syntax error.<br>
I think it is not intentional, but nobu said it's hard to support because of parse.y limitation.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">p</span> <span class="k">do</span>
<span class="k">end</span> <span class="o">=></span> <span class="n">a</span>
<span class="nb">p</span> <span class="n">a</span> <span class="c1">#=> nil</span>
<span class="nb">p</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="k">do</span>
<span class="k">end</span> <span class="o">=></span> <span class="n">a</span>
<span class="nb">p</span> <span class="n">a</span> <span class="c1">#=> 1</span>
<span class="nb">p</span> <span class="mi">1</span> <span class="k">do</span>
<span class="k">end</span> <span class="o">=></span> <span class="n">a</span>
<span class="c1">#=> </span>
<span class="c1"># syntax error, unexpected =>, expecting end-of-input</span>
<span class="c1"># end => a</span>
<span class="c1"># ^~</span>
<span class="nb">p</span> <span class="mi">1</span> <span class="k">do</span>
<span class="k">end</span> <span class="k">in</span> <span class="n">a</span>
<span class="c1">#=> </span>
<span class="c1"># syntax error, unexpected `in', expecting end-of-input</span>
<span class="c1"># end in a</span>
<span class="c1"># ^~</span>
</code></pre> Ruby master - Bug #18013 (Open): Unexpected results when mxiing negated character classes and cas...https://redmine.ruby-lang.org/issues/180132021-06-29T08:55:22Zjirkamarsik (Jirka Marsik)
<pre><code>irb(main):001:0> /[^a-c]/i.match("A")
=> nil
irb(main):002:0> /[[^a-c]]/i.match("A")
=> #<MatchData "A">
</code></pre>
<p>The two regular expressions above match different strings, because the character classes denote different sets of characters. In order for <code>/[^a-c]/i</code> to produce correct results, Oniguruma provided a fix that can still be easily seen in the code as it is hidden behind an always-on preprocessor flag (<code>CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS</code>, <a href="https://github.com/ruby/ruby/blob/9eae8cdefba61e9e51feb30a4b98525593169666/regparse.c#L5528" class="external">https://github.com/ruby/ruby/blob/9eae8cdefba61e9e51feb30a4b98525593169666/regparse.c#L5528</a>). The idea of the fix is to first case-fold a character class and only then apply the negation (essentially moving the case-fold operator <em>inside</em> the negation).</p>
<p>In the case of our first regular expression, <code>[a-c]</code> is case-folded into <code>[a-cA-C]</code> and that is then inverted into <code>[^a-cA-C]</code>, which is the expected result. However, this case-folding logic is currently only being applied to the top-most character class and so if we use a nested negated character class, the order of the operations will be switched.</p>
<p>With our second regular expression, <code>[a-c]</code> will first be negated to yield <code>[^a-c]</code>, which will then be case-folded into <code>.</code>, the set of all characters (since <code>[^a-c]</code> contains <code>A-C</code>, which case-fold into <code>a-c</code>).</p>
<p>A way to fix this would be to apply case-folding for nested character classes as well, so that the nested character classes behave the same as the top-most character class. Then, we would get the same semantics for both expressions.</p> Ruby master - Bug #18009 (Open): Regexps \w and \W with /i option and /u option produce inconsist...https://redmine.ruby-lang.org/issues/180092021-06-28T09:09:37Zjirkamarsik (Jirka Marsik)
<p>This is a follow up to <a href="https://bugs.ruby-lang.org/issues/4044" class="external">issue 4044</a>. Its fix (<a href="https://github.com/k-takata/Onigmo/issues/4" class="external">https://github.com/k-takata/Onigmo/issues/4</a>) handled the cases that were reported in the original issue, but there are other cases, which were omitted and now produce inconsistent results.</p>
<p>If the <code>\w</code> character set is used inside a nested negated character class, it will not be picked up by the part of the character class analyzer that's responsible for limiting the case-folding of certain character sets (like <code>\w</code> and <code>\W</code>) across the ASCII boundary. We then end up with the situation where <code>/[^\w]/iu</code> and <code>/[[^\w]]/iu</code> match different sets of characters.</p>
<pre><code>irb(main):001:0> ("a".."z").to_a.join.scan(/\W/iu)
=> []
irb(main):002:0> ("a".."z").to_a.join.scan(/[^\w]/iu)
=> []
irb(main):003:0> ("a".."z").to_a.join.scan(/[[^\w]]/iu)
=> ["k", "s"]
</code></pre>
<p>This can also be demonstrated using the inverted matcher:</p>
<pre><code>irb(main):004:0> ("a".."z").to_a.join.scan(/\w/iu).length
=> 26
irb(main):005:0> ("a".."z").to_a.join.scan(/[^[^\w]]/iu).length
=> 24
</code></pre>
<p>A similar issue also arises when using character class intersection. The idea behind the pattern compiler's analysis is that characters are allowed to case-fold across the ASCII boundary only if they are included in the character class by some other means than just being included in <code>\w</code> (or in one of several other character sets which have special treatment). Therefore, in the below, <code>/[\w]/iu</code> will not match the Kelvin sign <code>\u212a</code>, because that would mean crossing the ASCII boundary from <code>k</code> to <code>\u212a</code>. However, <code>/[kx]/iu</code> will match the Kelvin sign, because the <code>k</code> was not contributed by <code>\w</code> and therefore is not subject to the ASCII boundary restriction (we have to use <code>/[kx]/iu</code> instead of <code>/[k]/iu</code> in our examples, or else the pattern analyzer would replace <code>[k]</code> with <code>k</code> and follow a different code path).</p>
<pre><code>irb(main):006:0> /[\w]/iu.match("\u212a")
=> nil
irb(main):007:0> /[kx]/iu.match("\u212a")
=> #<MatchData "K">
</code></pre>
<p>The problem then is when we perform an intersection of these two character sets. Since <code>[kx]</code> is a subset of <code>\w</code>, we would expect their intersection to behave the same as <code>[kx]</code>, but that is not the case.</p>
<pre><code>irb(main):008:0> /[\w&&kx]/i.match("\u212a")
=> nil
</code></pre>
<p>The underlying issue in these cases is the manner in which the <code>ascCc</code> character set is computed during the parsing of character classes. The <code>ascCc</code> character set should contain all characters of the character class except those which were contributed by <code>\w</code> and similar character sets. This is done in a way that these character sets are essentially ignored in the calculation of <code>ascCc</code>, which works well for set union and top-most negation (which is handled explicitly), but it doesn't handle nested set negation and set intersection.</p> Ruby master - Bug #18002 (Open): s390x: Tests failing without LC_ALL envhttps://redmine.ruby-lang.org/issues/180022021-06-21T10:45:16Zjaruga (Jun Aruga)
<p>The following failures happened in RubyCI on our s390x Ubuntu focal server.<br>
On the server, RubyCI (ruby/chkbuild) is executed with LC_ALL not set, by cron.<br>
I found the unset <code>LC_ALL</code> causes the failures on the s390x server. This does not happen on x86_64 Fedora 33 on my local machine.</p>
<p>I was able to reproduce the failures on the master branch <code>dbd1887d04f5ff7c2a1f0a27d7339133a</code> on the server.</p>
<a name="Reproducer"></a>
<h2 >Reproducer<a href="#Reproducer" class="wiki-anchor">¶</a></h2>
<pre><code>$ uname -m
s390x
$ autoconf
$ ./configure \
--prefix=${HOME}/local/ruby-master-9d96837 \
--enable-shared
$ make
</code></pre>
<h3>Without <code>LC_ALL</code>
</h3>
<p>Then run the tests without <code>LC_ALL</code>.</p>
<pre><code>$ unset LC_ALL
$ echo $LC_ALL
<= empty
</code></pre>
<pre><code>$ make test-all TESTS="-v test/ruby/test_file.rb -n TestFile#test_realpath_encoding"
Run options:-
--seed=85060
"--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems"
--excludes-dir=./test/excludes
--name=!/memory_leak/
-v
-n
TestFile#test_realpath_encoding
# Running tests:
[1/0] TestFile#test_realpath_encoding = 0.00 s
1) Failure:
TestFile#test_realpath_encoding [/home/jaruga/git/ruby/ruby2/test/ruby/test_file.rb:284]:
<"/tmp/rubytest-realpath20210621-3365652-za1wql/A\u0391\u0410\u0531\u10A0\u05D0\u2C00\u3042"> expected but was
<"/tmp/rubytest-realpath20210621-3365652-za1wql/A\u00CE\u0091\u00D0\u0090\u00D4\u00B1\u00E1\u0082\u00A0\u00D7\u0090\u00E2\u00B0\u0080\u00E3\u0081\u0082">.
Finished tests in 0.007217s, 138.5674 tests/s, 692.8372 assertions/s.
1 tests, 5 assertions, 1 failures, 0 errors, 0 skips
ruby -v: ruby 3.1.0dev (2021-06-18T10:13:36Z master 9d96837dbd) [s390x-linux]
make: *** [uncommon.mk:803: yes-test-all] Error 1
</code></pre>
<pre><code>$ make test-all TESTS="-v test/irb/test_context.rb -n TestIRB::TestContext#test_eval_input_with_invalid_byte_sequence_exception"
Run options:-
--seed=74635
"--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems"
--excludes-dir=./test/excludes
--name=!/memory_leak/
-v
-n
TestIRB::TestContext#test_eval_input_with_invalid_byte_sequence_exception
# Running tests:
[1/0] TestIRB::TestContext#test_eval_input_with_invalid_byte_sequence_exception = 0.00 s
1) Failure:
TestIRB::TestContext#test_eval_input_with_invalid_byte_sequence_exception [/home/jaruga/git/ruby/ruby2/test/irb/test_context.rb:505]:
Expected /\(irb\):1:in `fuga': A\\xF3B \(RuntimeError\)\n/
to match
"(irb):1:in `fuga': A�B (RuntimeError)\n"+
"\tfrom (irb):1:in `hoge'\n"+
"\tfrom (irb):1:in `<main>'\n"
after 1 patterns with 0 characters.
Finished tests in 0.007640s, 130.8819 tests/s, 785.2916 assertions/s.
1 tests, 6 assertions, 1 failures, 0 errors, 0 skips
ruby -v: ruby 3.1.0dev (2021-06-18T10:13:36Z master 9d96837dbd) [s390x-linux]
make: *** [uncommon.mk:803: yes-test-all] Error 1
</code></pre>
<h3>With <code>export LC_ALL=C</code>
</h3>
<p>On the <code>export LC_ALL=C</code> (<code>LC_ALL=C</code> without <code>export</code> is not enough to pass the tests)</p>
<pre><code>$ export LC_ALL=C
$ echo $LC_ALL
C
</code></pre>
<pre><code>$ make test-all TESTS="-v test/ruby/test_file.rb -n TestFile#test_realpath_encoding"
Run options:
--seed=89696
"--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems"
--excludes-dir=./test/excludes
--name=!/memory_leak/
-v
-n
TestFile#test_realpath_encoding
# Running tests:
[1/0] TestFile#test_realpath_encoding = 0.00 s
Finished tests in 0.004715s, 212.0691 tests/s, 1060.3455 assertions/s.
1 tests, 5 assertions, 0 failures, 0 errors, 0 skips
ruby -v: ruby 3.1.0dev (2021-06-18T10:13:36Z master 9d96837dbd) [s390x-linux]
</code></pre>
<pre><code>$ make test-all TESTS="-v test/irb/test_context.rb -n TestIRB::TestContext#test_eval_input_with_invalid_byte_sequence_exception"
Run options:
--seed=67965
"--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems"
--excludes-dir=./test/excludes
--name=!/memory_leak/
-v
-n
TestIRB::TestContext#test_eval_input_with_invalid_byte_sequence_exception
# Running tests:
[1/0] TestIRB::TestContext#test_eval_input_with_invalid_byte_sequence_exception = 0.00 s
Finished tests in 0.007877s, 126.9448 tests/s, 761.6689 assertions/s.
1 tests, 6 assertions, 0 failures, 0 errors, 0 skips
ruby -v: ruby 3.1.0dev (2021-06-18T10:13:36Z master 9d96837dbd) [s390x-linux]
</code></pre>
<a name="Possible-Solution"></a>
<h2 >Possible Solution<a href="#Possible-Solution" class="wiki-anchor">¶</a></h2>
<p>Fix the tests not depending on the external LC_ALL condition.</p> Ruby master - Bug #17999 (Open): TestMethod#test_zsuper intermittent timeout error on raspbian10-...https://redmine.ruby-lang.org/issues/179992021-06-18T01:33:18Zxtkoba (Tee KOBAYASHI)
<p>In <a href="http://rubyci.s3.amazonaws.com/raspbian10-aarch64/ruby-master/log/20210617T223805Z.log.html.gz" class="external">http://rubyci.s3.amazonaws.com/raspbian10-aarch64/ruby-master/log/20210617T223805Z.log.html.gz</a> the following error message is observed:</p>
<pre><code> 1) Error:
TestMethod#test_zsuper:
Timeout::Error: execution of assert_separately expired timeout (30.0 sec)
pid 16029 killed by SIGTERM (signal 15)
|
/home/chkbuild/build/20210617T223805Z/ruby/test/ruby/test_inlinecache.rb:37:in `test_zsuper'
</code></pre>
<p>This seems to appear intermittently.</p>
<p>As for test timeout on aarch64-linux we have other open issues: <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: TestThreadQueue#test_thr_kill is flaky on AArch64 (Closed)" href="https://redmine.ruby-lang.org/issues/16493">#16493</a>, <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: TestThread#test_signal_at_join fails on aarch64 (Closed)" href="https://redmine.ruby-lang.org/issues/16920">#16920</a>, <a class="issue tracker-1 status-1 priority-4 priority-default" title="Bug: make notes and make test fail with Ruby3.0.1p64 RaspberryPI 4B Ubuntu 20.10 ARM64 (Open)" href="https://redmine.ruby-lang.org/issues/17792">#17792</a>. I'm not sure if they are relevant to one another in any way.</p> Ruby master - Bug #17617 (Open): When a Ractor's incoming port is closed, Ractor.receive_if does ...https://redmine.ruby-lang.org/issues/176172021-02-09T16:24:27Zdazuma (Daniel Azuma)dazuma@gmail.com
<p>If Ractor#close_incoming is called on a Ractor, any pending Ractor.receive call will raise Ractor::ClosedError. However, any pending Ractor.receive_if call will not; instead, it never returns.</p>
<pre><code>r1 = Ractor.new do
Ractor.receive
rescue => e
e
end
r1.close_incoming
result = r1.take
puts "**** taken: #{result}" # displays the Ractor::ClosedError
r2 = Ractor.new do
Ractor.receive_if { true }
puts "**** never reaches here"
rescue => e
puts "**** never reaches here"
e
end
r2.close_incoming
puts "**** hangs here..."
r2.take
puts "**** never reaches here"
</code></pre>
<p>This was tested against both 3.0.0 and 3.1.0 head, with the same result.</p>
<pre><code>% ruby -v
ruby 3.1.0dev (2021-02-09T13:22:37Z master e7a831de8e) [x86_64-darwin20]
</code></pre>
<pre><code>% ruby -v
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20
</code></pre>
<p>I have also tried including sleep statements to force the Ractor.receive_if to execute both before and after the Ractor#close_incoming call. The result is the same either way. receive_if hangs regardless of whether the incoming port is already closed when receive_if is invoked, or whether the port is closed while the receive_if is already blocking.</p> Ruby master - Bug #17420 (Open): Unsafe mutation of $" when doing non-RubyGems require in Ractorhttps://redmine.ruby-lang.org/issues/174202020-12-21T18:31:49ZEregon (Benoit Daloze)
<p>With an empty file <code>a.rb</code>:</p>
<pre><code>$ ruby --disable-gems -e 'Ractor.new { puts $" }.take'
-e:1:in `block in <main>': can not access global variables $" from non-main Ractors (RuntimeError)
</code></pre>
<p>That is expected, given the rules for global variables.</p>
<pre><code>ruby --disable-gems -e 'Ractor.new { require "./a.rb"; }.take; p $"'
[... , "/home/eregon/a.rb"]
</code></pre>
<p>Is it OK that the Ractor can do <code>require</code>, which does modify <code>$"</code>?</p>
<p>I think it's not, and it might lead to segfaults if e.g. the main Ractor mutates <code>$"</code> in parallel to some other Ractor doing <code>require</code>.</p>
<p>Probably <code>require</code> needs to be forbidden in non-main Ractors (it does mutate <code>$"</code>, so it's logical), or there needs to be always VM-global synchronization on any access to <code>$"</code> (otherwise, segfaults are possible).<br>
The latter doesn't seem reasonable, especially when considering the user might do <code>$".each { ... }</code>.</p>
<hr>
<p>Note that RubyGems' <code>require</code> does not work on non-main Ractors (pretty much expected given it depends on a lot of global state):</p>
<pre><code>$ ruby -e 'Ractor.new { require "./a.rb"; }.take'
<internal:/home/eregon/prefix/ruby-master/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:37:in `require': can not access non-shareable objects in constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (NameError)
</code></pre>
<p>This probably also has consequences for <code>autoload</code>.<br>
Maybe the <code>zeitwerk</code> gem can help with the mode to resolve all autoload at once.</p> Ruby master - Bug #17142 (Open): Ruby fails to build in AIX https://redmine.ruby-lang.org/issues/171422020-09-02T14:05:19ZAyappan (Ayappan Perumal)
<p>Ruby fails to build in AIX in 64bit mode.</p>
<p>This commit <a href="https://github.com/ruby/ruby/commit/f47c38245ff6976c5d1fc27a79f239bba00fc333" class="external">https://github.com/ruby/ruby/commit/f47c38245ff6976c5d1fc27a79f239bba00fc333</a> essentially broke the 64bit build.</p>
<p>The asm code is not applicable for AIX it seems. Probably we need to add a !defined(_AIX) check on this.</p> Ruby master - Bug #16905 (Open): Ruby required to build Ruby on Haiku?https://redmine.ruby-lang.org/issues/169052020-05-20T17:55:21Zextrowerk (Zoltán Mizsei)
<p>Building Ruby on Haiku results in the following error:</p>
<pre><code>executable host ruby is required. use --with-baseruby option.
</code></pre>
<p>Build environment:</p>
<pre><code>~> uname -a
Haiku shredder 1 hrev54197 May 14 2020 06:44:52 x86_64 x86_64 Haiku
</code></pre>
<p>Current recipe and patch set:<br>
<a href="https://github.com/extrowerk/haikuports/tree/ruby_2.7.1/dev-lang/ruby" class="external">https://github.com/extrowerk/haikuports/tree/ruby_2.7.1/dev-lang/ruby</a></p> Ruby master - Bug #16776 (Assigned): Regression in coverage libraryhttps://redmine.ruby-lang.org/issues/167762020-04-10T16:39:29Zdeivid (David Rodríguez)
<p>Hi!</p>
<p>I noticed a regression in the coverage library. I tried to write a minimal program to show it, hopefully it gives some clues or where the issue might lie.</p>
<p>In ruby 2.5.8 and earlier, the following program would print <code>{:lines=>[1, 1, nil]}</code>, showing that the body of the "foo" method was run once. However, on newer rubies, it prints <code>{:lines=>[1, 0, nil]}</code>, which is incorrect because the "foo" method body has actually been run once.</p>
<p>This is the repro script:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="c1"># frozen_string_literal: true</span>
<span class="nb">require</span> <span class="s2">"coverage"</span>
<span class="no">Coverage</span><span class="p">.</span><span class="nf">start</span><span class="p">(</span><span class="ss">lines: </span><span class="kp">true</span><span class="p">)</span>
<span class="n">code</span> <span class="o">=</span> <span class="o"><<~</span><span class="no">RUBY</span><span class="sh">
def foo
"LOL"
end
</span><span class="no">RUBY</span>
<span class="no">File</span><span class="p">.</span><span class="nf">open</span><span class="p">(</span><span class="s2">"foo.rb"</span><span class="p">,</span> <span class="s2">"w"</span><span class="p">)</span> <span class="p">{</span> <span class="o">|</span><span class="n">f</span><span class="o">|</span> <span class="n">f</span><span class="p">.</span><span class="nf">write</span><span class="p">(</span><span class="n">code</span><span class="p">)</span> <span class="p">}</span>
<span class="nb">require_relative</span> <span class="s2">"foo"</span>
<span class="no">TracePoint</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="ss">:line</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">_tp</span><span class="o">|</span>
<span class="n">foo</span>
<span class="k">end</span><span class="p">.</span><span class="nf">enable</span> <span class="k">do</span>
<span class="nb">sleep</span> <span class="mi">0</span>
<span class="k">end</span>
<span class="n">res</span> <span class="o">=</span> <span class="no">Coverage</span><span class="p">.</span><span class="nf">result</span>
<span class="nb">puts</span> <span class="n">res</span><span class="p">[</span><span class="no">File</span><span class="p">.</span><span class="nf">expand_path</span><span class="p">(</span><span class="s2">"foo.rb"</span><span class="p">)]</span>
</code></pre> Ruby master - Bug #16497 (Assigned): StringIO#internal_encoding is broken (more severely in 2.7)https://redmine.ruby-lang.org/issues/164972020-01-10T11:18:31Zzverok (Victor Shepelev)zverok.offline@gmail.com
<p>To the best of my understanding from <a href="https://docs.ruby-lang.org/en/master/Encoding.html" class="external">Encoding</a> docs, the following is true:</p>
<ul>
<li>external encoding (explicitly specified or taken from <code>Encoding.default_external</code>) specifies how the IO understands input and stores it internally</li>
<li>internal encoding (explicitly specified or taken from <code>Encoding.default_internal</code>) specifies how the IO converts what it reads.</li>
</ul>
<p>Demonstration with regular files:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="c1"># prepare data</span>
<span class="no">File</span><span class="p">.</span><span class="nf">write</span><span class="p">(</span><span class="s1">'test.txt'</span><span class="p">,</span> <span class="s1">'Україна'</span><span class="p">.</span><span class="nf">encode</span><span class="p">(</span><span class="s1">'KOI8-U'</span><span class="p">),</span> <span class="ss">encoding: </span><span class="s1">'KOI8-U'</span><span class="p">)</span> <span class="c1">#=> 7</span>
<span class="k">def</span> <span class="nf">test</span><span class="p">(</span><span class="n">io</span><span class="p">)</span>
<span class="n">str</span> <span class="o">=</span> <span class="n">io</span><span class="p">.</span><span class="nf">read</span>
<span class="p">[</span><span class="n">io</span><span class="p">.</span><span class="nf">external_encoding</span><span class="p">,</span> <span class="n">io</span><span class="p">.</span><span class="nf">internal_encoding</span><span class="p">,</span> <span class="n">str</span><span class="p">,</span> <span class="n">str</span><span class="p">.</span><span class="nf">encoding</span><span class="p">]</span>
<span class="k">end</span>
<span class="c1"># read it:</span>
<span class="nb">test</span><span class="p">(</span><span class="no">File</span><span class="p">.</span><span class="nf">open</span><span class="p">(</span><span class="s1">'test.txt'</span><span class="p">,</span> <span class="s1">'r:KOI8-U'</span><span class="p">))</span>
<span class="c1"># => [#<Encoding:KOI8-U>, nil, "\xF5\xCB\xD2\xC1\xA7\xCE\xC1", #<Encoding:KOI8-U>]</span>
<span class="c1"># We can specify internal encoding when opening the file:</span>
<span class="nb">test</span><span class="p">(</span><span class="no">File</span><span class="p">.</span><span class="nf">open</span><span class="p">(</span><span class="s1">'test.txt'</span><span class="p">,</span> <span class="s1">'r:KOI8-U:UTF-8'</span><span class="p">))</span>
<span class="c1"># => [#<Encoding:KOI8-U>, #<Encoding:UTF-8>, "Україна", #<Encoding:UTF-8>]</span>
<span class="c1"># ...or when it is already opened</span>
<span class="nb">test</span><span class="p">(</span><span class="no">File</span><span class="p">.</span><span class="nf">open</span><span class="p">(</span><span class="s1">'test.txt'</span><span class="p">).</span><span class="nf">tap</span> <span class="p">{</span> <span class="o">|</span><span class="n">f</span><span class="o">|</span> <span class="n">f</span><span class="p">.</span><span class="nf">set_encoding</span><span class="p">(</span><span class="s1">'KOI8-U'</span><span class="p">,</span> <span class="s1">'UTF-8'</span><span class="p">)</span> <span class="p">})</span>
<span class="c1"># => [#<Encoding:KOI8-U>, #<Encoding:UTF-8>, "Україна", #<Encoding:UTF-8>]</span>
<span class="c1"># ...or with Encoding.default_internal</span>
<span class="no">Encoding</span><span class="p">.</span><span class="nf">default_internal</span> <span class="o">=</span> <span class="s1">'UTF-8'</span>
<span class="nb">test</span><span class="p">(</span><span class="no">File</span><span class="p">.</span><span class="nf">open</span><span class="p">(</span><span class="s1">'test.txt'</span><span class="p">,</span> <span class="s1">'r:KOI8-U'</span><span class="p">))</span>
<span class="c1"># => [#<Encoding:KOI8-U>, #<Encoding:UTF-8>, "Україна", #<Encoding:UTF-8>]</span>
</code></pre>
<p>But with StringIO, <strong>internal encoding can't be set</strong> in Ruby <strong>2.6</strong>:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="s1">'stringio'</span>
<span class="no">Encoding</span><span class="p">.</span><span class="nf">default_internal</span> <span class="o">=</span> <span class="kp">nil</span>
<span class="n">str</span> <span class="o">=</span> <span class="s1">'Україна'</span><span class="p">.</span><span class="nf">encode</span><span class="p">(</span><span class="s1">'KOI8-U'</span><span class="p">)</span>
<span class="c1"># Simplest form:</span>
<span class="nb">test</span><span class="p">(</span><span class="no">StringIO</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="n">str</span><span class="p">))</span>
<span class="c1"># => [#<Encoding:KOI8-U>, nil, "\xF5\xCB\xD2\xC1\xA7\xCE\xC1", #<Encoding:KOI8-U>]</span>
<span class="c1"># Try to set via mode</span>
<span class="nb">test</span><span class="p">(</span><span class="no">StringIO</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="n">str</span><span class="p">,</span> <span class="s1">'r:KOI8-U:UTF-8'</span><span class="p">))</span>
<span class="c1"># => [#<Encoding:KOI8-U>, nil, "\xF5\xCB\xD2\xC1\xA7\xCE\xC1", #<Encoding:KOI8-U>]</span>
<span class="c1"># Try to set via set_encoding:</span>
<span class="nb">test</span><span class="p">(</span><span class="no">StringIO</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="n">str</span><span class="p">,</span> <span class="s1">'r:KOI8-U:UTF-8'</span><span class="p">).</span><span class="nf">tap</span> <span class="p">{</span> <span class="o">|</span><span class="n">f</span><span class="o">|</span> <span class="n">f</span><span class="p">.</span><span class="nf">set_encoding</span><span class="p">(</span><span class="s1">'KOI8-U'</span><span class="p">,</span> <span class="s1">'UTF-8'</span><span class="p">)</span> <span class="p">})</span>
<span class="c1"># => [#<Encoding:KOI8-U>, nil, "\xF5\xCB\xD2\xC1\xA7\xCE\xC1", #<Encoding:KOI8-U>]</span>
<span class="c1"># Try to set via Enoding.default_internal:</span>
<span class="no">Encoding</span><span class="p">.</span><span class="nf">default_internal</span> <span class="o">=</span> <span class="s1">'UTF-8'</span>
<span class="nb">test</span><span class="p">(</span><span class="no">StringIO</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="n">str</span><span class="p">))</span>
<span class="c1"># => [#<Encoding:KOI8-U>, nil, "\xF5\xCB\xD2\xC1\xA7\xCE\xC1", #<Encoding:KOI8-U>]</span>
</code></pre>
<p>So, in 2.6, any attempt to do something with StringIO's internal encoding are <strong>just ignored</strong>.</p>
<p>In <strong>2.7</strong>, though, matters became much worse:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="s1">'stringio'</span>
<span class="no">Encoding</span><span class="p">.</span><span class="nf">default_internal</span> <span class="o">=</span> <span class="kp">nil</span>
<span class="n">str</span> <span class="o">=</span> <span class="s1">'Україна'</span><span class="p">.</span><span class="nf">encode</span><span class="p">(</span><span class="s1">'KOI8-U'</span><span class="p">)</span>
<span class="c1"># Behaves same as 2.6</span>
<span class="nb">test</span><span class="p">(</span><span class="no">StringIO</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="n">str</span><span class="p">))</span>
<span class="c1"># => [#<Encoding:KOI8-U>, nil, "\xF5\xCB\xD2\xC1\xA7\xCE\xC1", #<Encoding:KOI8-U>]</span>
<span class="c1"># Try to set via mode: WEIRD behavior starts</span>
<span class="nb">test</span><span class="p">(</span><span class="no">StringIO</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="n">str</span><span class="p">,</span> <span class="s1">'r:KOI8-U:UTF-8'</span><span class="p">))</span>
<span class="c1"># => [#<Encoding:UTF-8>, nil, "\xF5\xCB\xD2\xC1\xA7\xCE\xC1", #<Encoding:UTF-8>]</span>
<span class="c1"># Try to set via set_encoding: still just ignored</span>
<span class="nb">test</span><span class="p">(</span><span class="no">StringIO</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="n">str</span><span class="p">,</span> <span class="s1">'r:KOI8-U:UTF-8'</span><span class="p">).</span><span class="nf">tap</span> <span class="p">{</span> <span class="o">|</span><span class="n">f</span><span class="o">|</span> <span class="n">f</span><span class="p">.</span><span class="nf">set_encoding</span><span class="p">(</span><span class="s1">'KOI8-U'</span><span class="p">,</span> <span class="s1">'UTF-8'</span><span class="p">)</span> <span class="p">})</span>
<span class="c1"># => [#<Encoding:KOI8-U>, nil, "\xF5\xCB\xD2\xC1\xA7\xCE\xC1", #<Encoding:KOI8-U>]</span>
<span class="c1"># Try to set via Enoding.default_internal: WEIRD behavior again</span>
<span class="no">Encoding</span><span class="p">.</span><span class="nf">default_internal</span> <span class="o">=</span> <span class="s1">'UTF-8'</span>
<span class="nb">test</span><span class="p">(</span><span class="no">StringIO</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="n">str</span><span class="p">))</span>
<span class="c1"># => [#<Encoding:UTF-8>, nil, "\xF5\xCB\xD2\xC1\xA7\xCE\xC1", #<Encoding:UTF-8>]</span>
</code></pre>
<p>So, <strong>2.7</strong> not just ignores attempts to set <strong>internal</strong> encoding, but erroneously sets it to <strong>external</strong> one, so strings are not recoded, but their encoding is forced to change.</p>
<p>I believe it is severe bug (more severe than 2.6's "just ignoring").</p>
<p><a href="https://www.reddit.com/r/ruby/comments/emd6q4/is_this_a_stringio_bug_in_ruby_270/" class="external">This Reddit thread</a> shows how it breaks existing code:</p>
<ul>
<li>the author uses <code>StringIO</code> to work with <code>ASCII-8BIT</code> strings;</li>
<li>the code is performed in Rails environment (which sets <code>internal_encoding</code> to <code>UTF-8</code> by default);</li>
<li>under <strong>2.7</strong>, <code>StringIO#read</code> returns <code>ASCII-8BIT</code> content in Strings saying their encoding is <code>UTF-8</code>.</li>
</ul> Ruby master - Bug #16158 (Open): "st" Character Sequence In Regex Look-Behind Causes Illegal Patt...https://redmine.ruby-lang.org/issues/161582019-09-09T15:14:59Zmichaeltomko (Michael Tomko)
<p><em>This is my first Ruby bug submission. Please let me know if there is anything else that I can provide that would be helpful. Thanks for your time!</em></p>
<p>I've tried just about as many combinations as I can think of and I have been able to narrow down the issue to the following components being present in a regular expression.</p>
<ul>
<li>The character sequence "st" either preceded by any characters OR being a part of a top-level alternation inside of a look-behind. The issue occurs with both positive and negative look-behinds. ex: <code>(?<!Costa)</code> or <code>(?<!Bob|Sally|Stan)</code> or <code>(?<= st)</code>
</li>
<li>Case insensitivity either being set globally or inside of the regex with <code>(?i)</code> preceding the look-behind.</li>
<li>Any curly-style POSIX bracket expression included anywhere in the regex. ex: <code>\p{Space}</code> or <code>\p{L}</code>
</li>
</ul>
<p>Here are some examples of the error. I have tested this on 2.5.0 locally and [on 2.5.3 with Rubular] (<a href="https://rubular.com/r/jnr98E9JfAZJIQ" class="external">https://rubular.com/r/jnr98E9JfAZJIQ</a>).</p>
<pre><code>2.5.0 :044 > pat = /(?<!a st)\p{Space}/i
Traceback (most recent call last):
SyntaxError ((irb):44: invalid pattern in look-behind: /(?<!a st)\p{Space}/i)
2.5.0 :047 > pat = /(?i)(?<!a st)\p{Space}/
Traceback (most recent call last):
SyntaxError ((irb):47: invalid pattern in look-behind: /(?i)(?<!a st)\p{Space}/)
2.5.0 :016 > pat = /(?<!Costa)Mesa(\p{Space}|\p{Punct})+(AZ|Arizona)/i
Traceback (most recent call last):
SyntaxError ((irb):16: invalid pattern in look-behind: /(?<=Costa)Mesa(\p{Space}|\p{Punct})+(AZ|Arizona)/i)
</code></pre>
<p>My expectation would be that this regular expression would compile as written, as it does in JRuby and in MacOS regex testing apps like Patterns or Reggy.</p>
<p>It does compile as expected if the case insensitivity flag is removed or instantiated after the look-behind, if the "st" character sequence is first in the look-behind and not apart of an alternation, or if different types of operators are substituted for the POSIX bracket expressions.</p>
<pre><code>2.5.0 :007 > pat = /((?<!Cosa)Mesa|Arlington(?=([:space:]|[:punct:])+(AZ|Arizona)))/
=> /((?<!Cosa)Mesa|Arlington(?=(\p{Space}|\p{Punct})+(AZ|Arizona)))/
2.5.0 :008 > pat = /((?<!Cosa)Mesa|Arlington(?=([:space:]|[:punct:])+(AZ|Arizona)))/i
=> /((?<!Cosa)Mesa|Arlington(?=([:space:]|[:punct:])+(AZ|Arizona)))/i
2.5.0 :009 > pat = /((?<!Cosa)Mesa|Arlington(?=([:space:]|[:punct:])+(AZ|Arizona)))/i
=> /((?<!Cosa)Mesa|Arlington(?=(\s|\W)+(AZ|Arizona)))/i
2.5.0 :056 > pat = /(?<!a st)(?i)(?<!juice)\p{Space}/
=> /(?<!a st)(?i)(?<!juice)\p{Space}/
2.5.0 :058 > pat = /(?<!a st)(?i)(?<!stark)\p{Space}/
=> /(?<!a st)(?i)(?<!stark)\p{Space}/
</code></pre> Ruby master - Bug #16145 (Open): regexp match error if mixing /i, character classes, and utf8https://redmine.ruby-lang.org/issues/161452019-09-05T19:40:03Zzenspider (Ryan Davis)
<p>(reported on behalf of <a href="mailto:mage@mage.gold" class="email">mage@mage.gold</a> -- there appears to be an error in registration or login):</p>
<p>See: ruby-talk @ X-Mail-Count: 440336</p>
<p>2.6.3 :049 > 'SHOP' =~ /[xo]/i<br>
=> 2<br>
2.6.3 :050 > 'CAFÉ' =~ /[é]/i<br>
=> 3<br>
2.6.3 :051 > 'CAFÉ' =~ /[xé]/i<br>
=> nil<br>
2.6.3 :052 > 'CAFÉ' =~ /[xÉ]/i<br>
=> 3</p>
<p>Expected result:<br>
2.6.3 :051 > 'CAFÉ' =~ /[xé]/i<br>
=> 3</p>
<p>I tested it on random regex online pages.</p>
<p>It does not match on <a href="https://regex101.com/" class="external">https://regex101.com/</a></p>
<p>It matches on:</p>
<p><a href="https://regexr.com/" class="external">https://regexr.com/</a><br>
<a href="https://www.regextester.com/" class="external">https://www.regextester.com/</a><br>
<a href="https://www.freeformatter.com/regex-tester.html" class="external">https://www.freeformatter.com/regex-tester.html</a></p>
<p>(Ignore case turned on).</p>
<p>The reason I suppose it’s more like a bug than a feature is the fact that /[é]/i matches 'CAFÉ'. If the //i didn’t work for UTF-8 characters then the /[é]/i wouldn’t match it either. For example, [é] does not match 'CAFÉ' on <a href="https://regex101.com/" class="external">https://regex101.com/</a></p>
<p>I could not find a page or a system that behaves the same way as Ruby does. For example, it matches in PostgreSQL 10 (under FreeBSD 12) too:</p>
<a name="select-CAFÉ-xé"></a>
<h1 >select 'CAFÉ'~ '[xé]';<a href="#select-CAFÉ-xé" class="wiki-anchor">¶</a></h1>
<a name="column"></a>
<h2 >?column?<a href="#column" class="wiki-anchor">¶</a></h2>
<p>f<br>
(1 row)</p>
<a name="select-CAFÉ-xé-2"></a>
<h1 >select 'CAFÉ' ~* '[xé]';<a href="#select-CAFÉ-xé-2" class="wiki-anchor">¶</a></h1>
<a name="column-2"></a>
<h2 >?column?<a href="#column-2" class="wiki-anchor">¶</a></h2>
<p>t<br>
(1 row)</p>
<p>Tested it in IRB on macOS and FreeBSD.</p>
<p>$ uname -a && ruby -v && locale<br>
Darwin xxx 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64<br>
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]<br>
LANG="en_US.UTF-8"<br>
LC_COLLATE="en_US.UTF-8"<br>
LC_CTYPE="en_US.UTF-8"<br>
LC_MESSAGES="en_US.UTF-8"<br>
LC_MONETARY="en_US.UTF-8"<br>
LC_NUMERIC="en_US.UTF-8"<br>
LC_TIME="en_US.UTF-8"<br>
LC_ALL="en_US.UTF-8"</p>
<p>$ uname -a && ruby -v && locale<br>
FreeBSD xxx 12.0-RELEASE-p9 FreeBSD 12.0-RELEASE-p9 GENERIC amd64<br>
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-freebsd12.0]<br>
LANG=en_US.UTF-8<br>
LC_CTYPE="en_US.UTF-8"<br>
LC_COLLATE="en_US.UTF-8"<br>
LC_TIME="en_US.UTF-8"<br>
LC_NUMERIC="en_US.UTF-8"<br>
LC_MONETARY="en_US.UTF-8"<br>
LC_MESSAGES="en_US.UTF-8"<br>
LC_ALL=en_US.UTF-8</p>
<p>I installed Ruby with RVM.</p> Ruby master - Bug #15993 (Open): 'require' doesn't work if there are Cyrillic chars in the path t...https://redmine.ruby-lang.org/issues/159932019-07-10T19:41:05Zinversion (Yura Babak)
<p>I’m trying to build a cross-platform portable application with Ruby onboard and there is a problem on Windows.<br>
A user usually installs it to the Roaming folder which sits inside a user folder which can often have not a Latin name or contain spaces).<br>
When there is a Cyrillic character (maybe just not Latin) in the path — require of any gem doesn’t work:</p>
<pre><code>D:\users\киї\Ruby\2.6\bin>ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x64-mingw32]
D:\users\киї\Ruby\2.6\bin>ruby -e "require 'logger'"
Traceback (most recent call last):
1: from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
<internal:gem_prelude>:2:in `require': No such file or directory -- D:/users/РєРёС—/Ruby/2.6/lib/ruby/2.6.0/rubygems.rb (LoadError)
D:\users\киї\Ruby\2.6\bin>ruby --disable=rubyopt -e "require 'logger'"
Traceback (most recent call last):
1: from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
<internal:gem_prelude>:2:in `require': No such file or directory -- D:/users/РєРёС—/Ruby/2.6/lib/ruby/2.6.0/rubygems.rb (LoadError)
D:\users\киї\Ruby\2.6\bin>gem list
Traceback (most recent call last):
1: from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
<internal:gem_prelude>:2:in `require': No such file or directory -- D:/users/РєРёС—/Ruby/2.6/lib/ruby/2.6.0/rubygems.rb (LoadError)
</code></pre>
<p>We can see such encoding transformations in the output:</p>
<pre><code>киї (utf-8) == РєРёС— (win1251)
</code></pre>
<p>I have an old Ruby installation that works fine:</p>
<pre><code>D:\users\киї\Ruby\2.0\bin>ruby -e "require 'logger'"
D:\users\киї\Ruby\2.0\bin>ruby -v
ruby 2.0.0p451 (2014-02-24) [i386-mingw32]
</code></pre>
<p>The same is for <code>ruby 2.0.0p643 (2015-02-25) [i386-mingw32]</code> .</p>
<p>I also checked that require fails in the same case for<br>
<code>ruby 2.1.9p490 (2016-03-30 revision 54437) [i386-mingw32]</code></p> Ruby master - Bug #15764 (Open): Whitespace and control characters should not be permitted in tokenshttps://redmine.ruby-lang.org/issues/157642019-04-11T20:59:47ZBatmanAoD (Kyle Strand)kyle.j.strand@gmail.com
<p>As of Ruby 2.5.1p57, it appears that all valid Unicode code-points above 128 are permitted in tokens. This includes whitespace and control characters.</p>
<p>This was demonstrated here: <a href="https://gist.github.com/qrohlf/7045823" class="external">https://gist.github.com/qrohlf/7045823</a></p>
<p>I have attached the raw download from the above gist.</p>
<p>The issue has been discussed on StackOverflow: <a href="https://stackoverflow.com/q/34455427/1858225" class="external">https://stackoverflow.com/q/34455427/1858225</a></p>
<p>I would say this is arguably a bug, but I am marking this ticket as a "feature" since the current behavior could be considered by-design.</p> Ruby master - Bug #15550 (Assigned): Windows - gem bin files - can't run from bash shellhttps://redmine.ruby-lang.org/issues/155502019-01-20T00:45:45ZMSP-Greg (Greg L)
<p>As I recall, ruby-loco is no longer touching the gem related files located in the bin folder. Previously, there were two files associated with each gem, one with a .cmd/.bat extension, one without.</p>
<p>Currently, there is just one file with a .cmd extension. I have seen this before, and just came across it again, where gems are using *nix scripts run with either the MSYS2 shell or the Git shell in their CI. Hence, there is an expectation for the plain (extensionless) file to exist.</p>
<p>Not sure if this is considered a breaking change or a bug/issue.</p>
<p>Thanks, Greg</p> Ruby master - Bug #15247 (Open): Windows - TEMP folder, non 8.3 & drive, fails & errors in test-a...https://redmine.ruby-lang.org/issues/152472018-10-23T17:02:28ZMSP-Greg (Greg L)
<p>While working with Azure pipelines, two issues came up related to the TEMP folder.</p>
<p>1. The standard Windows TEMP folder is located in a user directory. The user for pipeplines is 'buildguest', which is greater than 8 characters, and hence, its short and long paths differ. When I created a new user account locally on Windows 10, both ENV['TEMP'] and ENV['TMP'] were set to the short path.</p>
<p>This is causes two failures in <code>test/rdoc/test_rdoc_rdoc.rb</code> and one failure in <code>test_dir.rb</code>, the failures are listed in the attached file temp_short-long.txt.</p>
<p>2. Azure pipelines has the normal TEMP folder on drive C:, but, unlike Appveyor, the repo is placed on drive D:. This causes one failure in <code>test/rdoc/test_rdoc_options.rb</code>, and two errors from the same file, but in the std-Lib file <code>pathname.rb</code>. See attached file temp_drive.txt.</p>
<p>I'm not really sure what I think the solution for this is, as the issue is really due to Windows setting ENV['TEMP'] and ENV['TMP'] to short paths. I do recall the same issues happened on my old multi-drive desktop system. At the time, there were more significant issues with build/test, so I reconfigured the env for that...</p> Ruby master - Bug #14761 (Open): TestThread#test_join_limits hangs up on Solaris 10 with gcchttps://redmine.ruby-lang.org/issues/147612018-05-15T14:21:08Zngoto (Naohisa Goto)ngotogenome@gmail.com
<p>On Solaris 10, sparc architecture, when compiling ruby (r63417) by GCC (version 4.6.2), TestThread#test_join_limits did not end.</p>
<p>The test ended successfully when compiling ruby by Oracle Developer Studio 12.5 or 12.6.</p> Ruby master - Bug #14727 (Assigned): TestQueue#test_queue_with_trap always timeout on Windows10https://redmine.ruby-lang.org/issues/147272018-05-01T02:27:47Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<p>表題の通りです。ささださんも把握しているそうなので、備忘録として。</p>
<pre><code>[19/35] TestQueue#test_queue_with_trap = 10.13 s
1) Error:
TestQueue#test_queue_with_trap:
Timeout::Error: execution of assert_in_out_err expired timeout (10 sec)
pid 11608 exit 0
|
C:/Users/usa/develop/ruby/core/mytree/test/thread/test_queue.rb:553:in `test_queue_with_trap'
</code></pre> Ruby master - Bug #14681 (Open): `syswrite': stream closed in another thread (IOError)https://redmine.ruby-lang.org/issues/146812018-04-12T03:16:08Zioquatix (Samuel Williams)samuel@oriontransfer.net
<p>Perhaps related to <a href="https://bugs.ruby-lang.org/issues/13632" class="external">https://bugs.ruby-lang.org/issues/13632</a></p>
<p>Here is a sample to reproduce the issue.</p>
<pre><code>#!/usr/bin/env ruby
require 'thread'
puts RUBY_VERSION
100.times.collect do
Thread.new do
input, output = IO.pipe
worker = Thread.new do
sleep(0.1)
output.syswrite('.')
end
input.read(1)
input.close
output.close
worker.join
end
end.each(&:join)
</code></pre>
<p>If you run this, you will get output like so:</p>
<pre><code>2.5.0
#<Thread:0x00007fb7a4956ee8@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a50bb468@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4964250@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a49386f0@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a493ab08@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a495fb88@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a50bbb98@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4948820@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4939820@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a486a458@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4860020@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4970258@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4973f48@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4948618@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a495f728@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a495f868@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4848628@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4843858@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4809400@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a5085278@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a495e0f8@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a48417d8@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a5037c80@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4948398@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4948c30@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4939b18@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4957500@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a480a9b8@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a5036d30@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a5085c50@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a495e2b0@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a495f070@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a495e6e8@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a49572d0@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a495e580@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a494a350@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4811060@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a50842b0@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a494bb10@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a493ae00@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a495e878@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a494be30@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4809c70@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a480a4e0@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a50b90f0@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4965600@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
Exited with status 1 after 0.291 seconds
</code></pre>
<p>However, you can clearly see from the order of the sample code it's not possible for such an error to occur. <code>#close</code> is only invoked after a successful <code>#read</code> which is only possible after a successful <code>#write</code>. Yet, the error implies that the write failed because it was already closed.</p> Ruby master - Bug #14640 (Open): [win32] File.realpath treats a relative path with a drive letter...https://redmine.ruby-lang.org/issues/146402018-03-28T16:18:34Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<p>When <code>t</code> exists in the current directory under the drive C:,</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">File</span><span class="p">.</span><span class="nf">realpath</span><span class="p">(</span><span class="s2">"c:t"</span><span class="p">)</span> <span class="c1">#=> No such file or directory @ realpath_rec - c:/t (Errno::ENOENT)</span>
</code></pre>
<p>whereas <code>File.expand_path</code> returns <code>Dir.pwd + "/t"</code>.</p> Ruby master - Bug #14582 (Open): Unable to use `method__entry` and `method_return` tracing probes...https://redmine.ruby-lang.org/issues/145822018-03-07T06:23:00Zguilhermereiscampos (Guilherme Reis Campos)guilhermekbsa@gmail.com
<p>Hi,</p>
<p>I am trying to use dtrace/systemtap probes and not being able to use it after the 2.5. The 2.4 version works fine. I was hoping this was fixed on 2.6-preview, but apparently not (just downloaded dev and tested).</p>
<p>I tried on OSX using dtrace and also on ubuntu (vagrant).</p>
<pre><code># test.rb
class Foo
def bar
100.times { "Bar" }
end
end
foo = Foo.new
foo.bar
# test.stp
probe process("/home/vagrant/.rbenv/versions/2.4.0/bin/ruby").mark("method__entry") # you will need to change this to your ruby path of your version.
{
printf("%s => %s.%s in %s:%d\n", thread_indent(1), kernel_string($arg1),kernel_string($arg2),kernel_string($arg3),$arg4);
}
probe process("/home/vagrant/.rbenv/versions/2.4.0/bin/ruby").mark("method__return")
{
printf("%s <= %s.%s in %s:%d\n", thread_indent(-1), kernel_string($arg1),kernel_string($arg2),kernel_string($arg3),$arg4);
}
</code></pre>
<p>dtrace was something similar to it.</p>
<p>I was expecting to see this output:</p>
<pre><code># lots of calls
# ....
# then:
4090 ruby(9667): <= Gem::Specification.unresolved_deps in /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/specification.rb:1298
4095 ruby(9667): => MonitorMixin.mon_exit in /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/monitor.rb:197
4100 ruby(9667): => MonitorMixin.mon_check_owner in /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/monitor.rb:247
4104 ruby(9667): <= MonitorMixin.mon_check_owner in /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/monitor.rb:251
4109 ruby(9667): <= MonitorMixin.mon_exit in /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/monitor.rb:204
4283 ruby(9667): <= Kernel.require in /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55
4303 ruby(9667): <= Kernel.require in /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55
0 ruby(9667): => Foo.bar in test.rb:3
16 ruby(9667): <= Foo.bar in test.rb:5
</code></pre>
<p>(The output above is 2.4)</p>
<p>my ruby (all versions that I tested) was install with rb-env:</p>
<pre><code>RUBY_CONFIGURE_OPTS='--enable-dtrace --disable-install-doc' rbenv install 2.5.0
</code></pre>
<p>I am happy to provide details if required. I'd also be happy to fix it if I have guidance.</p>
<p>Thanks,</p> Ruby master - Bug #14090 (Assigned): `TestGc#test_interrupt_in_finalizer` fails very rarelyhttps://redmine.ruby-lang.org/issues/140902017-11-07T07:35:25Zmame (Yusuke Endoh)mame@ruby-lang.org
<p><code>TestGc#test_interrupt_in_finalizer</code> fails very rarely, only once every handred or thousand runs.</p>
<pre><code># Running tests:
[1/1] TestGc#test_interrupt_in_finalizer = 10.13 s
1) Error:
TestGc#test_interrupt_in_finalizer:
Timeout::Error: execution of assert_in_out_err expired
pid 24697 killed by SIGABRT (signal 6) (core dumped)
|
| [BUG] Segmentation fault at 0x000003e800006075
| ruby 2.5.0dev (2017-11-07) [x86_64-linux]
|
| -- Control frame information -----------------------------------------------
|
|
| -- Machine register context ------------------------------------------------
| RIP: 0x00007f80612bb072 RBP: 0x000055c3587e1efc RSP: 0x00007ffc4f8100b0
| RAX: 0xfffffffffffffffc RBX: 0x000055c3587e1ee4 RCX: 0x00007f80612bb072
| RDX: 0x0000000000000000 RDI: 0x000055c3587e1efc RSI: 0x0000000000000080
| R8: 0x00000000000000ca R9: 0x0000000000000000 R10: 0x0000000000000000
| R11: 0x0000000000000246 R12: 0x000055c3587e1ed0 R13: 0x00007ffc4f810110
| R14: 0x000055c3587e1f38 R15: 0x0000000000000003 EFL: 0x0000000000000246
|
| -- C level backtrace information -------------------------------------------
| /home/mame/work/ruby.tmp/ruby(rb_vm_bugreport+0x7d3) [0x55c357e7a333] vm_dump.c:703
| /home/mame/work/ruby.tmp/ruby(rb_bug_context+0xd1) [0x55c357e6de11] error.c:554
| /home/mame/work/ruby.tmp/ruby(sigsegv+0x42) [0x55c357d5e602] signal.c:928
| /lib/x86_64-linux-gnu/libpthread.so.0 [0x7f80612c0150]
| /lib/x86_64-linux-gnu/libpthread.so.0(pthread_cond_wait+0x152) [0x7f80612bb072]
| /home/mame/work/ruby.tmp/ruby(native_sleep.constprop.79+0x1de) [0x55c357d967fe] thread_pthread.c:340
| /home/mame/work/ruby.tmp/ruby(rb_thread_terminate_all+0x1e0) [0x55c357d9aba0] thread.c:507
| /home/mame/work/ruby.tmp/ruby(ruby_cleanup+0x17e) [0x55c357c6078e] eval.c:188
| /home/mame/work/ruby.tmp/ruby(ruby_run_node+0x36) [0x55c357c60aa6] eval.c:302
| /home/mame/work/ruby.tmp/ruby(main+0x5f) [0x55c357c5ca1f] encoding.c:164
|
| -- Other runtime information -----------------------------------------------
|
| * Loaded script: -e
|
| * Loaded features:
|
| 0 enumerator.so
| 1 thread.rb
| 2 rational.so
| 3 complex.so
| 4 /home/mame/work/ruby.tmp/.ext/x86_64-linux/enc/encdb.so
| 5 /home/mame/work/ruby.tmp/.ext/x86_64-linux/enc/trans/transdb.so
| 6 /home/mame/work/ruby.tmp/rbconfig.rb
| 7 /home/mame/work/ruby.tmp/lib/rubygems/compatibility.rb
| 8 /home/mame/work/ruby.tmp/lib/rubygems/defaults.rb
| 9 /home/mame/work/ruby.tmp/lib/rubygems/deprecate.rb
| 10 /home/mame/work/ruby.tmp/lib/rubygems/errors.rb
| 11 /home/mame/work/ruby.tmp/lib/rubygems/version.rb
| 12 /home/mame/work/ruby.tmp/lib/rubygems/requirement.rb
| 13 /home/mame/work/ruby.tmp/lib/rubygems/platform.rb
| 14 /home/mame/work/ruby.tmp/lib/rubygems/basic_specification.rb
| 15 /home/mame/work/ruby.tmp/lib/rubygems/stub_specification.rb
| 16 /home/mame/work/ruby.tmp/lib/rubygems/util/list.rb
| 17 /home/mame/work/ruby.tmp/.ext/x86_64-linux/stringio.so
| 18 /home/mame/work/ruby.tmp/lib/rubygems/specification.rb
| 19 /home/mame/work/ruby.tmp/lib/rubygems/exceptions.rb
| 20 /home/mame/work/ruby.tmp/lib/rubygems/core_ext/kernel_gem.rb
| 21 /home/mame/work/ruby.tmp/lib/monitor.rb
| 22 /home/mame/work/ruby.tmp/lib/rubygems/core_ext/kernel_require.rb
| 23 /home/mame/work/ruby.tmp/lib/rubygems.rb
| 24 /home/mame/work/ruby.tmp/lib/rubygems/dependency.rb
| 25 /home/mame/work/ruby.tmp/lib/rubygems/path_support.rb
|
| * Process memory map:
|
| 55c357c3a000-55c357f55000 r-xp 00000000 fd:01 21892603 /home/mame/work/ruby.tmp/ruby
| 55c358155000-55c35815a000 r--p 0031b000 fd:01 21892603 /home/mame/work/ruby.tmp/ruby
| 55c35815a000-55c35815b000 rw-p 00320000 fd:01 21892603 /home/mame/work/ruby.tmp/ruby
| 55c35815b000-55c35816c000 rw-p 00000000 00:00 0
| 55c3587e1000-55c358b0d000 rw-p 00000000 00:00 0 [heap]
| 7f8058000000-7f8058021000 rw-p 00000000 00:00 0
| 7f8058021000-7f805c000000 ---p 00000000 00:00 0
| 7f805e93f000-7f805eb1e000 r--s 00000000 fd:01 15604574 /lib/x86_64-linux-gnu/libc-2.26.so
| 7f805eb1e000-7f805fb92000 r--s 00000000 fd:01 21892603 /home/mame/work/ruby.tmp/ruby
| 7f805fb92000-7f805fba8000 r-xp 00000000 fd:01 15597591 /lib/x86_64-linux-gnu/libgcc_s.so.1
| 7f805fba8000-7f805fda7000 ---p 00016000 fd:01 15597591 /lib/x86_64-linux-gnu/libgcc_s.so.1
| 7f805fda7000-7f805fda8000 r--p 00015000 fd:01 15597591 /lib/x86_64-linux-gnu/libgcc_s.so.1
| 7f805fda8000-7f805fda9000 rw-p 00016000 fd:01 15597591 /lib/x86_64-linux-gnu/libgcc_s.so.1
| 7f805fda9000-7f805feaa000 rw-p 00000000 00:00 0
| 7f805feaa000-7f805feb3000 r-xp 00000000 fd:01 23333969 /home/mame/work/ruby.tmp/.ext/x86_64-linux/stringio.so
| 7f805feb3000-7f80600b2000 ---p 00009000 fd:01 23333969 /home/mame/work/ruby.tmp/.ext/x86_64-linux/stringio.so
| 7f80600b2000-7f80600b3000 r--p 00008000 fd:01 23333969 /home/mame/work/ruby.tmp/.ext/x86_64-linux/stringio.so
| 7f80600b3000-7f80600b4000 rw-p 00009000 fd:01 23333969 /home/mame/work/ruby.tmp/.ext/x86_64-linux/stringio.so
| 7f80600b4000-7f80600b6000 r-xp 00000000 fd:01 23333689 /home/mame/work/ruby.tmp/.ext/x86_64-linux/enc/trans/transdb.so
| 7f80600b6000-7f80602b6000 ---p 00002000 fd:01 23333689 /home/mame/work/ruby.tmp/.ext/x86_64-linux/enc/trans/transdb.so
| 7f80602b6000-7f80602b7000 r--p 00002000 fd:01 23333689 /home/mame/work/ruby.tmp/.ext/x86_64-linux/enc/trans/transdb.so
| 7f80602b7000-7f80602b8000 rw-p 00003000 fd:01 23333689 /home/mame/work/ruby.tmp/.ext/x86_64-linux/enc/trans/transdb.so
| 7f80602b8000-7f80602ba000 r-xp 00000000 fd:01 23333649 /home/mame/work/ruby.tmp/.ext/x86_64-linux/enc/encdb.so
| 7f80602ba000-7f80604b9000 ---p 00002000 fd:01 23333649 /home/mame/work/ruby.tmp/.ext/x86_64-linux/enc/encdb.so
| 7f80604b9000-7f80604ba000 r--p 00001000 fd:01 23333649 /home/mame/work/ruby.tmp/.ext/x86_64-linux/enc/encdb.so
| 7f80604ba000-7f80604bb000 rw-p 00002000 fd:01 23333649 /home/mame/work/ruby.tmp/.ext/x86_64-linux/enc/encdb.so
| 7f80604bb000-7f8060691000 r-xp 00000000 fd:01 15604574 /lib/x86_64-linux-gnu/libc-2.26.so
| 7f8060691000-7f8060891000 ---p 001d6000 fd:01 15604574 /lib/x86_64-linux-gnu/libc-2.26.so
| 7f8060891000-7f8060895000 r--p 001d6000 fd:01 15604574 /lib/x86_64-linux-gnu/libc-2.26.so
| 7f8060895000-7f8060897000 rw-p 001da000 fd:01 15604574 /lib/x86_64-linux-gnu/libc-2.26.so
| 7f8060897000-7f806089b000 rw-p 00000000 00:00 0
| 7f806089b000-7f80609f0000 r-xp 00000000 fd:01 15604578 /lib/x86_64-linux-gnu/libm-2.26.so
| 7f80609f0000-7f8060bef000 ---p 00155000 fd:01 15604578 /lib/x86_64-linux-gnu/libm-2.26.so
| 7f8060bef000-7f8060bf0000 r--p 00154000 fd:01 15604578 /lib/x86_64-linux-gnu/libm-2.26.so
| 7f8060bf0000-7f8060bf1000 rw-p 00155000 fd:01 15604578 /lib/x86_64-linux-gnu/libm-2.26.so
| 7f8060bf1000-7f8060bfa000 r-xp 00000000 fd:01 15604576 /lib/x86_64-linux-gnu/libcrypt-2.26.so
| 7f8060bfa000-7f8060df9000 ---p 00009000 fd:01 15604576 /lib/x86_64-linux-gnu/libcrypt-2.26.so
| 7f8060df9000-7f8060dfa000 r--p 00008000 fd:01 15604576 /lib/x86_64-linux-gnu/libcrypt-2.26.so
| 7f8060dfa000-7f8060dfb000 rw-p 00009000 fd:01 15604576 /lib/x86_64-linux-gnu/libcrypt-2.26.so
| 7f8060dfb000-7f8060e29000 rw-p 00000000 00:00 0
| 7f8060e29000-7f8060e2c000 r-xp 00000000 fd:01 15604577 /lib/x86_64-linux-gnu/libdl-2.26.so
| 7f8060e2c000-7f806102b000 ---p 00003000 fd:01 15604577 /lib/x86_64-linux-gnu/libdl-2.26.so
| 7f806102b000-7f806102c000 r--p 00002000 fd:01 15604577 /lib/x86_64-linux-gnu/libdl-2.26.so
| 7f806102c000-7f806102d000 rw-p 00003000 fd:01 15604577 /lib/x86_64-linux-gnu/libdl-2.26.so
| 7f806102d000-7f80610ab000 r-xp 00000000 fd:01 12068737 /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.2
| 7f80610ab000-7f80612ab000 ---p 0007e000 fd:01 12068737 /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.2
| 7f80612ab000-7f80612ac000 r--p 0007e000 fd:01 12068737 /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.2
| 7f80612ac000-7f80612ad000 rw-p 0007f000 fd:01 12068737 /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.2
| 7f80612ad000-7f80612c7000 r-xp 00000000 fd:01 15604589 /lib/x86_64-linux-gnu/libpthread-2.26.so
| 7f80612c7000-7f80614c6000 ---p 0001a000 fd:01 15604589 /lib/x86_64-linux-gnu/libpthread-2.26.so
| 7f80614c6000-7f80614c7000 r--p 00019000 fd:01 15604589 /lib/x86_64-linux-gnu/libpthread-2.26.so
| 7f80614c7000-7f80614c8000 rw-p 0001a000 fd:01 15604589 /lib/x86_64-linux-gnu/libpthread-2.26.so
| 7f80614c8000-7f80614cc000 rw-p 00000000 00:00 0
| 7f80614cc000-7f80614f3000 r-xp 00000000 fd:01 15602223 /lib/x86_64-linux-gnu/ld-2.26.so
| 7f8061592000-7f80615b6000 r--s 00000000 fd:01 15604589 /lib/x86_64-linux-gnu/libpthread-2.26.so
| 7f80615b6000-7f80616bc000 rw-p 00000000 00:00 0
| 7f80616cb000-7f80616cc000 ---p 00000000 00:00 0
| 7f80616cc000-7f80616ec000 rw-p 00000000 00:00 0
| 7f80616ec000-7f80616ed000 ---p 00000000 00:00 0
| 7f80616ed000-7f80616f3000 rw-p 00000000 00:00 0
| 7f80616f3000-7f80616f4000 r--p 00027000 fd:01 15602223 /lib/x86_64-linux-gnu/ld-2.26.so
| 7f80616f4000-7f80616f5000 rw-p 00028000 fd:01 15602223 /lib/x86_64-linux-gnu/ld-2.26.so
| 7f80616f5000-7f80616f6000 rw-p 00000000 00:00 0
| 7ffc4f013000-7ffc4f812000 rw-p 00000000 00:00 0 [stack]
| 7ffc4f904000-7ffc4f907000 r--p 00000000 00:00 0 [vvar]
| 7ffc4f907000-7ffc4f909000 r-xp 00000000 00:00 0 [vdso]
| ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
|
|
| [NOTE]
| You may have encountered a bug in the Ruby interpreter or extension libraries.
| Bug reports are welcome.
| For details: http://www.ruby-lang.org/bugreport.html
|
/home/mame/work/ruby.tmp/test/ruby/test_gc.rb:354:in `test_interrupt_in_finalizer'
Finished tests in 10.127763s, 0.0987 tests/s, 0.2962 assertions/s.
1 tests, 3 assertions, 0 failures, 1 errors, 0 skips
</code></pre>
<a name="How-to-reproduce"></a>
<h2 >How to reproduce<a href="#How-to-reproduce" class="wiki-anchor">¶</a></h2>
<ol>
<li>Apply this patch. This removes a mitigation of this issue.</li>
</ol>
<pre><code>diff --git a/thread.c b/thread.c
index bfa903c6a4..dfaf75d1ce 100644
--- a/thread.c
+++ b/thread.c
@@ -507,7 +507,7 @@ rb_thread_terminate_all(void)
* me when the last sub-thread exit.
*/
sleeping = 1;
- native_sleep(th, &tv);
+ native_sleep(th, 0);
RUBY_VM_CHECK_INTS_BLOCKING(ec);
sleeping = 0;
}
</code></pre>
<ol start="2">
<li>Run <code>make test-all</code> many times. The following command would be useful.</li>
</ol>
<pre><code>make && while make test-all TESTOPTS="test/ruby/test_gc.rb -n test_interrupt_in_finalizer"; do date; done
</code></pre>
<p>FYI: With execution counter</p>
<pre><code>make && i=0 && while make test-all TESTOPTS="test/ruby/test_gc.rb -n test_interrupt_in_finalizer"; do echo; date; echo "trial:$i"; i=`expr $i + 1`; done
</code></pre>
<a name="Details"></a>
<h2 >Details<a href="#Details" class="wiki-anchor">¶</a></h2>
<p><code>TestGc#test_interrupt_in_finalizer</code> checks if SIGINT can interrupt the GC finalizers. This test itself runs on a child process, and the process should end with SIGINT. If the process does not end in ten seconds, the parent sends SIGSEGV to the child, terminates the test, and reports it as a failure. ("C level backtrace information" has "sigsegv", but don't worry, this SEGV would be the one the parent sent. I guess this bug is not so significant, parhaps.)</p>
<p>When a main thread of Ruby process ends, it terminates all child threads and waits for them. However, for unknown reason (maybe depending upon the timing of SIGINT?), it sometimes fails synchronization: all child threads end, and the main thread meaninglessly waits forever.</p>
<p>Based on Ko1's proposal, I committed a tiny change to mitigate this issue at r60694: instead of waiting forever, the main thread wakes up every one second to monitor all child threads. This is not an essential solution for this issue, but just hides. To debug this issue, we need remove the mitigation by the patch described above.</p> Ruby master - Bug #13671 (Assigned): Regexp with lookbehind and case-insensitivity raises RegexpE...https://redmine.ruby-lang.org/issues/136712017-06-22T23:28:58Zdschweisguth (Dave Schweisguth)dave@schweisguth.org
<p>Here is a test program:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">def</span> <span class="nf">test</span><span class="p">(</span><span class="n">description</span><span class="p">)</span>
<span class="k">begin</span>
<span class="k">yield</span>
<span class="nb">puts</span> <span class="s2">"</span><span class="si">#{</span><span class="n">description</span><span class="si">}</span><span class="s2"> is OK"</span>
<span class="k">rescue</span> <span class="no">RegexpError</span>
<span class="nb">puts</span> <span class="s2">"</span><span class="si">#{</span><span class="n">description</span><span class="si">}</span><span class="s2"> raises RegexpError"</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="nb">test</span><span class="p">(</span><span class="s2">"ass, case-insensitive, special"</span><span class="p">)</span> <span class="p">{</span> <span class="sr">/(?<!ass)/i</span> <span class="o">=~</span> <span class="s1">'✨'</span> <span class="p">}</span>
<span class="nb">test</span><span class="p">(</span><span class="s2">"bss, case-insensitive, special"</span><span class="p">)</span> <span class="p">{</span> <span class="sr">/(?<!bss)/i</span> <span class="o">=~</span> <span class="s1">'✨'</span> <span class="p">}</span>
<span class="nb">test</span><span class="p">(</span><span class="s2">"as, case-insensitive, special"</span><span class="p">)</span> <span class="p">{</span> <span class="sr">/(?<!as)/i</span> <span class="o">=~</span> <span class="s1">'✨'</span> <span class="p">}</span>
<span class="nb">test</span><span class="p">(</span><span class="s2">"ss, case-insensitive, special"</span><span class="p">)</span> <span class="p">{</span> <span class="sr">/(?<!ss)/i</span> <span class="o">=~</span> <span class="s1">'✨'</span> <span class="p">}</span>
<span class="nb">test</span><span class="p">(</span><span class="s2">"ass, case-sensitive, special"</span><span class="p">)</span> <span class="p">{</span> <span class="sr">/(?<!ass)/</span> <span class="o">=~</span> <span class="s1">'✨'</span> <span class="p">}</span>
<span class="nb">test</span><span class="p">(</span><span class="s2">"ass, case-insensitive, regular"</span><span class="p">)</span> <span class="p">{</span> <span class="sr">/(?<!ass)/i</span> <span class="o">=~</span> <span class="s1">'x'</span> <span class="p">}</span>
</code></pre>
<p>Running the test program with Ruby 2.4.1 (macOS) gives</p>
<pre><code>ass, case-insensitive, special raises RegexpError
bss, case-insensitive, special raises RegexpError
as, case-insensitive, special is OK
ss, case-insensitive, special is OK
ass, case-sensitive, special is OK
ass, case-insensitive, regular is OK
</code></pre>
<p>The RegexpError is "invalid pattern in look-behind: /(?<!ass)/i (RegexpError)"</p>
<p>Side note: in the real code in which I found this error I was able to work around the error by using (?i) after the lookbehind instead of //i.</p>
<p>Running the test program with Ruby 2.3.4 does not report any RegexpErrors.</p>
<p>I think this is a regression, although I might be wrong and it might be saving me from an incorrect result with certain strings.</p> Ruby master - Bug #12725 (Assigned): Trying to use ./miniruby before it existshttps://redmine.ruby-lang.org/issues/127252016-09-05T05:04:23Zduerst (Martin Dürst)duerst@it.aoyama.ac.jpRuby master - Bug #12689 (Open): Thread isolation of $~ and $_https://redmine.ruby-lang.org/issues/126892016-08-19T06:37:18Zheadius (Charles Nutter)headius@headius.com
<p>We are debating what is correct behavior now, and what should be correct behavior in the future, for the thread-visibility of the special variables <code>%~</code> and <code>$_</code></p>
<p>We have several examples from <a href="https://github.com/jruby/jruby/issues/3031" class="external">https://github.com/jruby/jruby/issues/3031</a> that seem to exhibit conflicting behavior...or at least the behavior is unexpected in many cases.</p>
<pre><code>$ ruby23 -e 'p = proc { p $~; "foo" =~ /foo/ }; Thread.new {p.call}.join; Thread.new{p.call}.join'
nil
nil
$ ruby23 -e 'def foo; proc { p $~; "foo" =~ /foo/ }; end; p = foo; Thread.new {p.call}.join; Thread.new{p.call}.join'
nil
#<MatchData "foo">
$ ruby23 -e 'p = proc { p $~; "foo" =~ /foo/ }; def foo(p); Thread.new {p.call}.join; Thread.new{p.call}.join; end; foo(p)'
nil
#<MatchData "foo">
$ ruby23 -e 'class Foo; P = proc { p $~; "foo" =~ /foo/ }; def foo; Thread.new {P.call}.join; Thread.new{P.call}.join; end; end; Foo.new.foo'
nil
#<MatchData "foo">
$ ruby23 -e 'def foo; p = proc { p $~; "foo" =~ /foo/ }; Thread.new {p.call}.join; Thread.new{p.call}.join; end; foo'
nil
nil
$ ruby23 -e 'def foo; p = proc { p $~; "foo" =~ /foo/ }; bar(p); end; def bar(p); Thread.new {p.call}.join; Thread.new{p.call}.join; end; foo'
nil
#<MatchData "foo">
</code></pre>
<p>These cases exhibit some oddities in whether $~ (and presumably $_) are shared across threads.</p>
<p>The immediate thought is that they should be both frame and thread-local...but ko1 points out that such a change would break cases like this:</p>
<pre><code>def foo
/foo/ =~ 'foo'
Proc.new{
p $~
}
end
Thread.new{
foo.call
}.join
</code></pre>
<p>So there's a clear conflict here. Users sometimes expect the $~ value to be shared across threads (at least for read, as in ko1's example) and sometimes do not want it shared at all (as in the case of <a href="https://github.com/jruby/jruby/issues/3031" class="external">https://github.com/jruby/jruby/issues/3031</a></p>
<p>Now we discuss.</p> Ruby master - Bug #12445 (Assigned): Testing TestIO#test_open_fifo_does_not_block_other_threads r...https://redmine.ruby-lang.org/issues/124452016-05-31T10:15:12Zduerst (Martin Dürst)duerst@it.aoyama.ac.jp
<p>When I run <code>bin/ruby test/runner.rb test/ruby/test_*</code>, testing stops at <code>TestIO#test_open_fifo_does_not_block_other_threads</code>. Checking the task manager shows that this is a deadlock (there are two ruby interpreters running, but they don't use any CPU at all).</p>
<p>This is what I see for ages:</p>
<pre><code>[1589/4545] TestIO#test_open_fifo_does_not_block_other_threads
</code></pre> Ruby master - Bug #12444 (Assigned): Segmentation fault when running TestException#test_machine_s...https://redmine.ruby-lang.org/issues/124442016-05-31T10:10:48Zduerst (Martin Dürst)duerst@it.aoyama.ac.jp
<p>When I try to run <code>bin/ruby test/runner.rb test/ruby/test_*</code>, I get the error below. This is immediately followed by a very similar error for TestException#test_machine_stackoverflow_by_define_method.</p>
<pre><code>[ 942/4545] TestException#test_machine_stackoverflow = 1.27 s
19) Failure:
TestException#test_machine_stackoverflow [/cygdrive/c/Data/ruby/test/ruby/test_exception.rb:577]:
pid 16416 killed by SIGABRT (signal 6) (core dumped)
| -:7: [BUG] Segmentation fault at 0x000000ffe03fc0
| ruby 2.4.0dev (2016-05-31 trunk 55228) [x86_64-cygwin]
|
| -- Control frame information -----------------------------------------------
| c:0690 p:0014 s:1387 e:001386 LAMBDA -:7 [FINISH]
| c:0689 p:0014 s:1385 e:001384 LAMBDA -:7 [FINISH]
| c:0688 p:0014 s:1383 e:001382 LAMBDA -:7 [FINISH]
| c:0687 p:0014 s:1381 e:001380 LAMBDA -:7 [FINISH]
| c:0686 p:0014 s:1379 e:001378 LAMBDA -:7 [FINISH]
| c:0685 p:0014 s:1377 e:001376 LAMBDA -:7 [FINISH]
| c:0684 p:0014 s:1375 e:001374 LAMBDA -:7 [FINISH]
| c:0683 p:0014 s:1373 e:001372 LAMBDA -:7 [FINISH]
| c:0682 p:0014 s:1371 e:001370 LAMBDA -:7 [FINISH]
| c:0681 p:0014 s:1369 e:001368 LAMBDA -:7 [FINISH]
</code></pre>
<p>[very long list, ending in]</p>
<pre><code>| c:0009 p:0014 s:0025 e:000024 LAMBDA -:7 [FINISH]
| c:0008 p:0014 s:0023 e:000022 LAMBDA -:7 [FINISH]
| c:0007 p:0014 s:0021 e:000020 LAMBDA -:7 [FINISH]
| c:0006 p:0014 s:0019 e:000018 LAMBDA -:7 [FINISH]
| c:0005 p:0014 s:0017 e:000016 LAMBDA -:7 [FINISH]
| c:0004 p:0028 s:0015 E:001588 BLOCK -:8
| c:0003 p:0052 s:0012 e:000011 METHOD /cygdrive/c/Data/ruby/test/lib/test/unit/assertions.rb:74
| c:0002 p:0047 s:0004 E:000610 EVAL -:6 [FINISH]
| c:0001 p:0000 s:0002 E:001930 (none) [FINISH]
|
| -- Ruby level backtrace information ----------------------------------------
| -:6:in `<main>'
| /cygdrive/c/Data/ruby/test/lib/test/unit/assertions.rb:74:in `assert_raise'
| -:8:in `block in <main>'
| -:7:in `block (2 levels) in <main>'
| -:7:in `block (2 levels) in <main>'
| -:7:in `block (2 levels) in <main>'
| -:7:in `block (2 levels) in <main>'
| -:7:in `block (2 levels) in <main>'
| -:7:in `block (2 levels) in <main>'
| -:7:in `block (2 levels) in <main>'
</code></pre>
<p>[again very long list, probably about same length, ending with]</p>
<pre><code>| -:7:in `block (2 levels) in <main>'
| -:7:in `block (2 levels) in <main>'
| -:7:in `block (2 levels) in <main>'
| -:7:in `block (2 levels) in <main>'
| -:7:in `block (2 levels) in <main>'
| -:7:in `block (2 levels) in <main>'
| -:7:in `block (2 levels) in <main>'
| -:7:in `block (2 levels) in <main>'
| -:7:in `block (2 levels) in <main>'
|
| -- Other runtime information -----------------------------------------------
|
| * Loaded script: -
|
| * Loaded features:
|
| 0 enumerator.so
| 1 thread.rb
| 2 rational.so
| 3 complex.so
| 4 /cygdrive/c/Data/ruby/lib/ruby/2.4.0/x86_64-cygwin/enc/encdb.so
| 5 /cygdrive/c/Data/ruby/lib/ruby/2.4.0/x86_64-cygwin/enc/trans/transdb.so
| 6 /cygdrive/c/Data/ruby/lib/ruby/2.4.0/x86_64-cygwin/enc/windows_31j.so
| 7 /cygdrive/c/Data/ruby/lib/ruby/vendor_ruby/unicode_normalize.rb
| 8 /cygdrive/c/Data/ruby/lib/ruby/vendor_ruby/optparse.rb
| 9 /cygdrive/c/Data/ruby/lib/ruby/2.4.0/x86_64-cygwin/rbconfig.rb
| 10 /cygdrive/c/Data/ruby/test/lib/leakchecker.rb
| 11 /cygdrive/c/Data/ruby/test/lib/minitest/unit.rb
| 12 /cygdrive/c/Data/ruby/lib/ruby/vendor_ruby/prettyprint.rb
| 13 /cygdrive/c/Data/ruby/lib/ruby/vendor_ruby/pp.rb
| 14 /cygdrive/c/Data/ruby/test/lib/test/unit/assertions.rb
| 15 /cygdrive/c/Data/ruby/lib/ruby/vendor_ruby/open3.rb
| 16 /cygdrive/c/Data/ruby/lib/ruby/vendor_ruby/timeout.rb
| 17 /cygdrive/c/Data/ruby/test/lib/find_executable.rb
| 18 /cygdrive/c/Data/ruby/lib/ruby/2.4.0/x86_64-cygwin/rbconfig/sizeof.so
| 19 /cygdrive/c/Data/ruby/test/lib/envutil.rb
| 20 /cygdrive/c/Data/ruby/test/lib/test/unit/testcase.rb
| 21 /cygdrive/c/Data/ruby/test/lib/test/unit.rb
|
| [NOTE]
| You may have encountered a bug in the Ruby interpreter or extension libraries.
| Bug reports are welcome.
| For details: http://www.ruby-lang.org/bugreport.html
|
</code></pre> Ruby master - Bug #12442 (Assigned): TestArgf#test_textmode fails on cygwinhttps://redmine.ruby-lang.org/issues/124422016-05-31T10:01:19Zduerst (Martin Dürst)duerst@it.aoyama.ac.jp
<p>When I try to run <code>bin/ruby test/runner.rb test/ruby/test_*</code> (because <code>make test-all</code> doesn't work), the first failure that I get is as below.</p>
<pre><code>$ bin/ruby test/runner.rb test/ruby/test_*
Run options:
# Running tests:
[ 156/4545] TestArgf#test_textmode = 1.60 s
1) Failure:
TestArgf#test_textmode [/cygdrive/c/Data/ruby/test/ruby/test_argf.rb:685]:
<a href="/issues/5268">[ruby-core:39234]</a>.
<"1\n2\n3\n4\n5\n6\n"> expected but was
<"1\n2\n3\n4\n5\r\n6\r\n">.
</code></pre> Ruby master - Bug #12040 (Assigned): [Win32] File.stat fails on a mounted volumehttps://redmine.ruby-lang.org/issues/120402016-02-01T08:13:24Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<p>On Windows, <code>File.stat</code> fails on the volume mount point directory whose name contains <code>"..."</code>.</p>
<p>Where <code>%vol%</code> is the volume ID of a new VHD volume,</p>
<pre><code>C:> set vol
\\?\Volume{3C458AE9-C8B1-11E5-A233-0800271D089F}\
C:> mkdir x...y
C:> mountvol x...y %vol%
C:> .\miniruby -e "p Dir.chdir('x...y'){File.stat('.')}" -e "p File.stat('x...y')"
#<File::Stat dev=0x2, ino=1407374883553285, mode=040755, nlink=1, uid=0, gid=0, rdev=0x2, size=4096, blksize=nil, blocks=nil, atime=2016-02-01 16:35:45 +0900, mtime=2016-02-01 16:35:45 +0900, ctime=2016-02-01 16:35:45 +0900>
-e:2:in `stat': No such file or directory @ rb_file_s_stat - x...y (Errno::ENOENT)
from -e:2:in `<main>'
</code></pre>
<p>Note that <code>Dir.chdir</code> and <code>File.stat</code> there succeed.<br>
This failures depends on the mount point name, because of <code>check_valid_dir()</code>.</p> Ruby master - Bug #8444 (Open): Regexp vars $~ and friends are not thread localhttps://redmine.ruby-lang.org/issues/84442013-05-24T18:15:17Zjamespharaoh (James Pharaoh)james@phsys.co.uk
<p>In the docs for the Regexp special variables, <code>$~</code> and friends, it says "These global variables are thread-local and method-local variables". However the following gives an unexpected result:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">def</span> <span class="nf">get_proc</span>
<span class="nb">proc</span> <span class="k">do</span> <span class="o">|</span><span class="n">str</span><span class="o">|</span>
<span class="n">str</span> <span class="o">=~</span> <span class="sr">/(.+)/</span>
<span class="nb">sleep</span> <span class="mf">0.1</span>
<span class="nb">puts</span> <span class="s2">"got </span><span class="si">#{</span><span class="vg">$1</span><span class="si">}</span><span class="s2"> from </span><span class="si">#{</span><span class="n">str</span><span class="si">}</span><span class="se">\n</span><span class="s2">"</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="nb">proc</span> <span class="o">=</span> <span class="n">get_proc</span>
<span class="n">t1</span> <span class="o">=</span> <span class="no">Thread</span><span class="p">.</span><span class="nf">new</span> <span class="p">{</span> <span class="nb">proc</span><span class="p">.</span><span class="nf">call</span> <span class="s2">"abc"</span> <span class="p">}</span>
<span class="n">t2</span> <span class="o">=</span> <span class="no">Thread</span><span class="p">.</span><span class="nf">new</span> <span class="p">{</span> <span class="nb">proc</span><span class="p">.</span><span class="nf">call</span> <span class="s2">"def"</span> <span class="p">}</span>
<span class="n">t1</span><span class="p">.</span><span class="nf">join</span>
<span class="n">t2</span><span class="p">.</span><span class="nf">join</span>
</code></pre>
<p>This outputs the following:</p>
<pre><code>got abc from abc
got abc from def
</code></pre>
<p>The expected result is of course:</p>
<pre><code>got abc from abc
got def from def
</code></pre>
<p>Clearly the variables are being scoped to the <code>get_proc</code> method and are being shared by both threads. This runs contrary to the documentation and also to expectations.</p>
<p>This behaviour should either be changed, or the documentation updated to reflect the actual behaviour.</p>
<p>Interestingly, the following does work as expected:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">proc</span> <span class="o">=</span> <span class="nb">proc</span> <span class="k">do</span> <span class="o">|</span><span class="n">str</span><span class="o">|</span>
<span class="n">str</span> <span class="o">=~</span> <span class="sr">/(.+)/</span>
<span class="nb">sleep</span> <span class="mf">0.1</span>
<span class="nb">puts</span> <span class="s2">"got </span><span class="si">#{</span><span class="vg">$1</span><span class="si">}</span><span class="s2"> from </span><span class="si">#{</span><span class="n">str</span><span class="si">}</span><span class="se">\n</span><span class="s2">"</span>
<span class="k">end</span>
<span class="n">t1</span> <span class="o">=</span> <span class="no">Thread</span><span class="p">.</span><span class="nf">new</span> <span class="p">{</span> <span class="nb">proc</span><span class="p">.</span><span class="nf">call</span> <span class="s2">"abc"</span> <span class="p">}</span>
<span class="n">t2</span> <span class="o">=</span> <span class="no">Thread</span><span class="p">.</span><span class="nf">new</span> <span class="p">{</span> <span class="nb">proc</span><span class="p">.</span><span class="nf">call</span> <span class="s2">"def"</span> <span class="p">}</span>
<span class="n">t1</span><span class="p">.</span><span class="nf">join</span>
<span class="n">t2</span><span class="p">.</span><span class="nf">join</span>
</code></pre> Ruby master - Bug #8185 (Open): Thread/fork issuehttps://redmine.ruby-lang.org/issues/81852013-03-30T03:33:57ZAnonymous
<p>Hello all,</p>
<p>I've found an issue where calling fork inside a thread, and passing a block<br>
to the fork, causes the forked process to continue after the block. I've<br>
reproduced the issue on the following versions of ruby:<br>
ruby 2.0.0p100 (2013-03-27 revision 39954) [x86_64-darwin10.8.0]<br>
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin10.8.0]</p>
<p>Here is the script I used to reproduce:</p>
<p>1000.times do |j|<br>
puts "run #{j}"<br>
threads = []<br>
100.times do |i|<br>
threads << Thread.new(i) do |local_i|<br>
opid = fork do<br>
# exit!(true) # fixes the issue<br>
# exit(true) # doesn't fix the issue<br>
# no 'exit' also exhibits issue<br>
end<br>
::Process.waitpid(opid, 0)<br>
File.open("/tmp/test_thread_fork_#{local_i}.pid", "w") {|f| f.write<br>
"1" }<br>
end<br>
end<br>
threads.map { |t| t.join }</p>
<p>borked = false<br>
100.times do |i|<br>
fn = "/tmp/test_thread_fork_#{i}.pid"<br>
contents = File.read(fn)<br>
if contents.size > 1<br>
puts "file #{fn} was written to many times (#{contents})"<br>
borked = true<br>
end<br>
end<br>
exit(false) if borked<br>
end</p>
<p>As you can see from the comments inside the fork I can work around the<br>
issue by using "exit!". I am correct in understanding that there should be<br>
no case in which the file is written to multiple times, correct?</p>
<p>Thank you,<br>
Jason Gladish</p> Ruby master - Bug #7964 (Assigned): Writing an ASCII-8BIT String to a StringIO created from a UTF...https://redmine.ruby-lang.org/issues/79642013-02-26T16:32:50Zbrixen (Brian Shirai)brixen@gmail.com
<p>=begin<br>
In the following script, an ASCII-8BIT String is written to a StringIO created with a UTF-8 String without error. However, a << b or a + b will raise an exception, as will writing an ASCII-8BIT String to a File with UTF-8 external encoding.</p>
<ul>
<li>
<p>$ cat file_enc.rb</p>
<a name="encoding-utf-8"></a>
<h1 >encoding: utf-8<a href="#encoding-utf-8" class="wiki-anchor">¶</a></h1>
<p>require 'stringio'</p>
<p>a = "On a very cold morning, it was -8°F."<br>
b = a.dup.force_encoding "ascii-8bit"</p>
<p>io = StringIO.new a<br>
io.write(b)<br>
p io.string.encoding</p>
<p>File.open "data.txt", "w:utf-8" do |f|<br>
f.write a<br>
f.write b<br>
end</p>
</li>
<li>
<p>$ ruby2.0 -v file_enc.rb<br>
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin10.8.0]<br>
#<a href="Encoding:UTF-8" class="external">Encoding:UTF-8</a><br>
file_enc.rb:13:in <code>write': "\xC2" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError) from file_enc.rb:13:in </code>block in '<br>
from file_enc.rb:11:in <code>open' from file_enc.rb:11:in </code>'</p>
</li>
<li>
<p>$ ruby1.9.3 -v file_enc.rb<br>
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin10.8.0]<br>
#<a href="Encoding:UTF-8" class="external">Encoding:UTF-8</a><br>
file_enc.rb:13:in <code>write': "\xC2" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError) from file_enc.rb:13:in </code>block in '<br>
from file_enc.rb:11:in <code>open' from file_enc.rb:11:in </code>'<br>
=end</p>
</li>
</ul> Ruby master - Bug #7742 (Open): System encoding (Windows-1258) is not recognized by Ruby to conv...https://redmine.ruby-lang.org/issues/77422013-01-26T15:33:40ZMars (Hong Ha Dang )dhhmars9999@gmail.com
<p>I installed Railsinstaller in win8. After intall complete the screen set to</p>
<blockquote>
<p>configuration Railsinstaller on cmd (step 2). I give user name: DHH Mars and<br>
email: <a href="mailto:dhhma...@gmail.com" class="email">dhhma...@gmail.com</a>. It ran and have following massage:</p>
<p>C:/RailsInstaller/scripts/config_check.rb:64:in 'exist?': code converter not<br>
found <a href="Encoding::ConverterNotFoundError" class="external">Encoding::ConverterNotFoundError</a> from<br>
C:/RailsInstaller/scripts/config_check.rb:64:in 'main'</p>
<p>C:\Sites></p>
</blockquote> Ruby master - Bug #6351 (Assigned): transcode table generator does not support multi characters o...https://redmine.ruby-lang.org/issues/63512012-04-24T20:41:39Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<p>改めてチケット起こします。<a href="/issues/6349">[ruby-dev:45576]</a> より。</p>
<p>On 2012/04/24 17:11, "Martin J. Dürst" wrote:</p>
<blockquote>
<p>On 2012/04/24 17:02, U.Nakamura wrote:</p>
<blockquote>
<p>データは例によってNetBSDのものが利用できそうです。<br>
なのですが、transcodeってUnicodeの第0面(BMP)以外はサポートし<br>
てましたっけ?</p>
</blockquote>
<p>もちろんです :-)</p>
</blockquote>
<p>もうちょっと調べました。BMP 以外は transcode の最初から全く問題ないです<br>
が、現時点で引っかかるのは次のものです<br>
(<a href="http://x0213.org/codetable/euc-jis-2004-std.txt" class="external">http://x0213.org/codetable/euc-jis-2004-std.txt</a> から抜粋):</p>
<p>0xA4F7 U+304B+309A # [2000]<br>
0xA4F8 U+304D+309A # [2000]<br>
0xA4F9 U+304F+309A # [2000]<br>
0xA4FA U+3051+309A # [2000]<br>
0xA4FB U+3053+309A # [2000]</p>
<p>0xA5F7 U+30AB+309A # [2000]<br>
0xA5F8 U+30AD+309A # [2000]<br>
0xA5F9 U+30AF+309A # [2000]<br>
0xA5FA U+30B1+309A # [2000]<br>
0xA5FB U+30B3+309A # [2000]<br>
0xA5FC U+30BB+309A # [2000]<br>
0xA5FD U+30C4+309A # [2000]<br>
0xA5FE U+30C8+309A # [2000]</p>
<p>0xA6F8 U+31F7+309A # [2000]</p>
<p>0xABC4 U+00E6+0300 # [2000]</p>
<p>0xABC8 U+0254+0300 # [2000]<br>
0xABC9 U+0254+0301 # [2000]<br>
0xABCA U+028C+0300 # [2000]<br>
0xABCB U+028C+0301 # [2000]<br>
0xABCC U+0259+0300 # [2000]<br>
0xABCD U+0259+0301 # [2000]<br>
0xABCE U+025A+0300 # [2000]<br>
0xABCF U+025A+0301 # [2000]</p>
<p>0xABE5 U+02E9+02E5 # [2000]<br>
0xABE6 U+02E5+02E9 # [2000]</p>
<p>ようするに、JIS X 0213 で一文字になっているが、Unicode で二文字になって<br>
いるものです。EUC-JISX0213 から UTF-8 は問題ないですが、逆は現在引っかか<br>
ります。windows-1258 も (逆ですが) 同じ問題がありますので、いずれはなく<br>
さないといけないと思いましたが、今回はいいきっかけのではないかと思います。</p>
<p>よろしくお願いします。 Martin.</p>