https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112021-02-17T08:51:09ZRuby Issue Tracking SystemRuby master - Bug #17561: The timeout option for Addrinfo.getaddrinfo is not reliable on Ruby 2.7.2https://redmine.ruby-lang.org/issues/17561?journal_id=904572021-02-17T08:51:09Zstanhu (Stan Hu)
<ul></ul><p>I agree that this should be removed from Ruby 2.7. In <a href="https://gitlab.com/gitlab-org/gitlab/-/issues/11951#note_510756578" class="external">https://gitlab.com/gitlab-org/gitlab/-/issues/11951#note_510756578</a>, we were able to trigger a seg fault by doing this:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="s1">'socket'</span>
<span class="kp">loop</span> <span class="k">do</span>
<span class="no">Addrinfo</span><span class="p">.</span><span class="nf">getaddrinfo</span><span class="p">(</span><span class="s1">'localhost'</span><span class="p">,</span> <span class="kp">nil</span><span class="p">,</span> <span class="ss">timeout: </span><span class="mi">0</span><span class="p">)</span>
<span class="k">rescue</span> <span class="no">SocketError</span>
<span class="k">end</span>
</code></pre> Ruby master - Bug #17561: The timeout option for Addrinfo.getaddrinfo is not reliable on Ruby 2.7.2https://redmine.ruby-lang.org/issues/17561?journal_id=924752021-06-15T04:47:38Zko1 (Koichi Sasada)
<ul></ul><p>confirmed on my machine:</p>
<pre><code>$ ruby -ve "require 'resolv'; 10000.times { |i| p [i, Addrinfo.getaddrinfo('2130706433', 80, nil, :STREAM, timeout: 0)] }"
ruby 2.7.3p183 (2021-04-05 revision 6847ee089d) [x86_64-linux]
*** stack smashing detected ***: terminated
Aborted
</code></pre> Ruby master - Bug #17561: The timeout option for Addrinfo.getaddrinfo is not reliable on Ruby 2.7.2https://redmine.ruby-lang.org/issues/17561?journal_id=924762021-06-15T04:50:10Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>Glass_saga (Masaki Matsushita)</i></li></ul><p><a class="user active user-mention" href="https://redmine.ruby-lang.org/users/1913">@Glass_saga (Masaki Matsushita)</a> Could you handle this?</p> Ruby master - Bug #17561: The timeout option for Addrinfo.getaddrinfo is not reliable on Ruby 2.7.2https://redmine.ruby-lang.org/issues/17561?journal_id=924792021-06-15T05:51:01ZGlass_saga (Masaki Matsushita)glass.saga@gmail.com
<ul><li><strong>Backport</strong> changed from <i>2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN</i> to <i>2.5: DONTNEED, 2.6: DONTNEED, 2.7: REQUIRED, 3.0: DONTNEED</i></li></ul><p>Although I can't reproduce the issue on my machine (I tried several times), I agree that this should be removed from 2.7.<br>
I will create a patch.</p> Ruby master - Bug #17561: The timeout option for Addrinfo.getaddrinfo is not reliable on Ruby 2.7.2https://redmine.ruby-lang.org/issues/17561?journal_id=925512021-06-17T05:46:16Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul></ul><p>About 2.7, to make raise <code>ArgumentError</code> (or other exception) is not acceptable because it's *<em>stable</em> branch.<br>
I strongly hope to fix this problem at master branch and the fix can be backportable, but at this time, we should simply ignore <code>timeout:</code> argument and note it on documentation.</p> Ruby master - Bug #17561: The timeout option for Addrinfo.getaddrinfo is not reliable on Ruby 2.7.2https://redmine.ruby-lang.org/issues/17561?journal_id=927182021-07-01T19:33:21Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul></ul><p>usa (Usaku NAKAMURA) wrote in <a href="#note-5">#note-5</a>:</p>
<blockquote>
<p>About 2.7, to make raise <code>ArgumentError</code> (or other exception) is not acceptable because it's *<em>stable</em> branch.<br>
I strongly hope to fix this problem at master branch and the fix can be backportable, but at this time, we should simply ignore <code>timeout:</code> argument and note it on documentation.</p>
</blockquote>
<p>I sent a pull request to disable the timeout option: <a href="https://github.com/ruby/ruby/pull/4618" class="external">https://github.com/ruby/ruby/pull/4618</a></p>
<p>I couldn't see where the timeout option was documented, so I didn't modify the documentation.</p>
<p>I don't think we'll be able to backport a fix to the issue. The use of getaddrinfo_a was completely removed in <a class="changeset" title="Revert getaddrinfo_a() getaddrinfo_a() gets stuck after fork(). To avoid this, we need 1 second ..." href="https://redmine.ruby-lang.org/projects/ruby-master/repository/git/revisions/5d8bcc4870601ab1ee05346346f241d4a805aac9">5d8bcc4870601ab1ee05346346f241d4a805aac9</a>.</p> Ruby master - Bug #17561: The timeout option for Addrinfo.getaddrinfo is not reliable on Ruby 2.7.2https://redmine.ruby-lang.org/issues/17561?journal_id=930672021-07-31T12:30:15Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Backport</strong> changed from <i>2.5: DONTNEED, 2.6: DONTNEED, 2.7: REQUIRED, 3.0: DONTNEED</i> to <i>2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONE, 3.0: DONTNEED</i></li></ul><p>merged into ruby_2_7 at d9ff8b3e86a03499a5c6bc36fae1592914a25b9c</p> Ruby master - Bug #17561: The timeout option for Addrinfo.getaddrinfo is not reliable on Ruby 2.7.2https://redmine.ruby-lang.org/issues/17561?journal_id=930682021-07-31T17:11:47Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li></ul>