Ruby Issue Tracking System: Issueshttps://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112018-11-28T01:29:11ZRuby Issue Tracking System
Redmine Ruby master - Feature #15352 (Open): Mandatory block parametershttps://bugs.ruby-lang.org/issues/153522018-11-28T01:29:11Zgfx (Goro FUJI)gfuji@cpan.org
<p>There are too many block parameter assertions (it's kind of idioms: <a href="https://github.com/search?q=raise+NoBlockGiven+unless+block_given&type=Code" class="external"><code>raise NoBlockGiven unless glock_given?</code></a>).</p>
<p>It's very useful if there's a syntax to declare mandatory block parameters, such as:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">def</span> <span class="nf">foo</span><span class="p">(</span><span class="o">&!</span><span class="n">block</span><span class="p">)</span>
<span class="n">block</span><span class="p">.</span><span class="nf">call</span>
<span class="k">end</span>
<span class="n">foo</span><span class="p">()</span> <span class="c1"># raises ArgumentError "in `foo`: no block given"</span>
</code></pre> Ruby master - Bug #14558 (Closed): "Backtrace in reverse order" always upsets my brain!https://bugs.ruby-lang.org/issues/145582018-02-28T07:37:22Zgfx (Goro FUJI)gfuji@cpan.org
<p>A Ruby 2.5.0 feature "backtrace in reverse order", issued in <a href="https://bugs.ruby-lang.org/issues/8661" class="external">https://bugs.ruby-lang.org/issues/8661</a>, is confusing in developing Rails applications because I can't expect the order: it sometimes "reversed", sometimes "non-reversed". It just sucks.</p>
<p>Please revert this feature, or provide a way to disable it.</p> Ruby master - Bug #14432 (Closed): Ruby crashes with "[BUG] pthread_mutex_destroy: Device or reso...https://bugs.ruby-lang.org/issues/144322018-02-02T06:51:05Zgfx (Goro FUJI)gfuji@cpan.org
<p>We notice that sidekiq (sidekiq pro) workers crash by <code>rb_bug_errno()</code>.</p>
<p>The very line that the issue raised is here: <a href="https://github.com/ruby/ruby/blob/v2_4_2/thread_pthread.c#L260" class="external">https://github.com/ruby/ruby/blob/v2_4_2/thread_pthread.c#L260</a></p>
<pre><code class="c syntaxhl" data-language="c"><span class="k">static</span> <span class="kt">void</span>
<span class="nf">native_mutex_destroy</span><span class="p">(</span><span class="n">pthread_mutex_t</span> <span class="o">*</span><span class="n">lock</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">int</span> <span class="n">r</span> <span class="o">=</span> <span class="n">pthread_mutex_destroy</span><span class="p">(</span><span class="n">lock</span><span class="p">);</span>
<span class="n">mutex_debug</span><span class="p">(</span><span class="s">"destroy"</span><span class="p">,</span> <span class="n">lock</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">r</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="n">rb_bug_errno</span><span class="p">(</span><span class="s">"pthread_mutex_destroy"</span><span class="p">,</span> <span class="n">r</span><span class="p">);</span> <span class="c1">// HERE!</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
<p>log/sidekiq.log:</p>
<pre><code>[BUG] pthread_mutex_destroy: Device or resource busy (EBUSY)
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
-- Control frame information -----------------------------------------------
-- C level backtrace information -------------------------------------------
/usr/local/rbenv/versions/2.4.2/bin/ruby(rb_vm_bugreport+0xcf4) [0x558eb7577584] vm_dump.c:684
/usr/local/rbenv/versions/2.4.2/bin/ruby(rb_bug+0xd0) [0x558eb756bcf0] error.c:491
/usr/local/rbenv/versions/2.4.2/bin/ruby(rb_bug_errno+0x3a) [0x558eb756be9a] error.c:520
/usr/local/rbenv/versions/2.4.2/bin/ruby(thread_start_func_2+0x98d) [0x558eb74a0e9d] thread_pthread.c:260
/usr/local/rbenv/versions/2.4.2/bin/ruby(thread_start_func_1+0xd0) [0x558eb74a0fd0] thread_pthread.c:887
/lib/x86_64-linux-gnu/libpthread.so.0(start_thread+0xca) [0x7f9c1bf536ba]
/lib/x86_64-linux-gnu/libc.so.6(__clone+0x6d) [0x7f9c1b54441d]
-- Other runtime information -----------------------------------------------
* Loaded script: sidekiq 5.0.5 kibela [1 of 5 busy]
* Loaded features:
0 enumerator.so
1 thread.rb
2 rational.so
3 complex.so
4 /usr/local/rbenv/versions/2.4.2/lib/ruby/2.4.0/x86_64-linux/enc/encdb.so
5 /usr/local/rbenv/versions/2.4.2/lib/ruby/2.4.0/x86_64-linux/enc/trans/transdb.so
6 /usr/local/rbenv/versions/2.4.2/lib/ruby/2.4.0/unicode_normalize.rb
7 /usr/local/rbenv/versions/2.4.2/lib/ruby/2.4.0/x86_64-linux/rbconfig.rb
8 /usr/local/rbenv/versions/2.4.2/lib/ruby/2.4.0/rubygems/compatibility.rb
9 /usr/local/rbenv/versions/2.4.2/lib/ruby/2.4.0/rubygems/defaults.rb
... omit about 5000 lines
</code></pre>
<p>Unfortunately, it occurs only in the production environment, so the condition is not clear. We also issued it to the Sidekiq Pro support team, but it seems a bug in cruby.</p>
<p>versions:</p>
<ul>
<li>ruby 2.4.2</li>
<li>rails 5.1.4</li>
<li>sidekiq 5.0.5</li>
<li>sidekiq-pro 3.7.0</li>
</ul>
<p>sidekiq's concurrency: 1 (see <a href="https://github.com/mperham/sidekiq/wiki/Advanced-Options" class="external">https://github.com/mperham/sidekiq/wiki/Advanced-Options</a> for details)</p> Ruby master - Feature #8953 (Closed): `str =~ /pattern/` does not call =~ method if (1) str is a ...https://bugs.ruby-lang.org/issues/89532013-09-26T16:05:17Zgfx (Goro FUJI)gfuji@cpan.org
<p>The expression <code>a =~ b</code> does not call the =~ method in some cases.<br>
I think it is a bug that results from optimizations.</p>
<p>See the following code for details:</p>
<p>Code that does not work as expected (shows nothing):</p>
<p>$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end; s =~ /foo/' # does nothing</p>
<p>Code that works as expected (raises errors):</p>
<p>$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end; s.=~ /foo/' # call =~ as a method<br>
$ ruby -e 's = "foo"; class << s; def =~ (rhs); raise "a"; end; end; s =~ -> { /foo/ }.call' # RHS is not a Regexp literal but a Regexp object<br>
$ ruby -e 's = Objec.new; class << s; def =~ (rhs); raise "a"; end; end; s =~ /foo/' # LHS is not a String</p> Backport200 - Backport #8884 (Closed): `caller(1, nil)` raises a runtime error while its referenc...https://bugs.ruby-lang.org/issues/88842013-09-10T10:44:58Zgfx (Goro FUJI)gfuji@cpan.org
<blockquote>
<p>$ ruby -e 'caller(1, nil)'<br>
-e:1:in <code>caller': no implicit conversion from nil to integer (TypeError) from -e:1:in </code>'</p>
</blockquote>
<p>Either the behaviour or the document looks wrong; I don't know which is wrong, though.</p>