https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112012-12-04T02:23:09ZRuby Issue Tracking SystemRuby master - Feature #7503: make timeout.rb async-interrupt safe by defaulthttps://bugs.ruby-lang.org/issues/7503?journal_id=343752012-12-04T02:23:09Zko1 (Koichi Sasada)
<ul></ul><p>Actually, I like your proposal.<br>
But I make weak objection.</p>
<p>The following code doesn't stop forever.</p>
<p>timeout(3){<br>
# long calculation / infinite loop w/o IO operation<br>
}</p>
<p>I guess most of case, the block includes IO operation and no problem.<br>
However, there are several case for it.</p>
<p>This is Dec and Preview 2 was released.<br>
I think it is too slow to introduce it.</p>
<p>Again, I like this proposal.<br>
If no people have object, I can agree with this proposal.</p>
<p>Alternative proposal is making such a safe timeout method with different<br>
name such as `safe_timeout'.</p>
<p>(2012/12/03 22:33), kosaki (Motohiro KOSAKI) wrote:</p>
<blockquote>
<p>Issue <a class="issue tracker-2 status-2 priority-4 priority-default" title="Feature: make timeout.rb async-interrupt safe by default (Assigned)" href="https://bugs.ruby-lang.org/issues/7503">#7503</a> has been reported by kosaki (Motohiro KOSAKI).</p>
<hr>
<p>Bug <a class="issue tracker-2 status-2 priority-4 priority-default" title="Feature: make timeout.rb async-interrupt safe by default (Assigned)" href="https://bugs.ruby-lang.org/issues/7503">#7503</a>: make timeout.rb async-interrupt safe by default<br>
<a href="https://bugs.ruby-lang.org/issues/7503" class="external">https://bugs.ruby-lang.org/issues/7503</a></p>
<p>Author: kosaki (Motohiro KOSAKI)<br>
Status: Open<br>
Priority: Normal<br>
Assignee:<br>
Category: core<br>
Target version: 2.0.0<br>
ruby -v: trunk</p>
<p>Hi</p>
<p>Again and again we discussed, current timeout.rb is very dangerous because ExitException interrupt argument code and unwind call stack immediately.<br>
It may prevent to run ensure block and makes resource leak.</p>
<p>I proposed change default to interrupted only on blocking point.</p>
<p>patch is here.<br>
<a href="https://gist.github.com/4195015" class="external">https://gist.github.com/4195015</a></p>
<p>I also propse to add 'immediate' optional argument because it may help to make a workaround timeout.rb + zero blocking point corner case.</p>
<p>What do you think?</p>
</blockquote>
<p>--<br>
// SASADA Koichi at atdot dot net</p> Ruby master - Feature #7503: make timeout.rb async-interrupt safe by defaulthttps://bugs.ruby-lang.org/issues/7503?journal_id=344192012-12-06T00:04:13Zkosaki (Motohiro KOSAKI)kosaki.motohiro@gmail.com
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>This issue was solved with changeset r38216.<br>
Motohiro, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<ul>
<li>
<p>lib/timeout.rb (Timeout#timeout): set<br>
async_interrupt_timeing(:on_blocking) by default.<br>
[Bug <a class="issue tracker-2 status-2 priority-4 priority-default" title="Feature: make timeout.rb async-interrupt safe by default (Assigned)" href="https://bugs.ruby-lang.org/issues/7503">#7503</a>] <a href="/issues/7503">[ruby-core:50524]</a></p>
</li>
<li>
<p>test/test_timeout.rb (#test_timeout_blocking): test for the above.</p>
</li>
<li>
<p>test/test_timeout.rb (test_timeout_immediate): ditto</p>
</li>
<li>
<p>test/test_timeout.rb (test_timeout_immediate2): ditto.</p>
</li>
<li>
<p>NEWS: news for the above.</p>
</li>
</ul> Ruby master - Feature #7503: make timeout.rb async-interrupt safe by defaulthttps://bugs.ruby-lang.org/issues/7503?journal_id=344282012-12-06T01:59:31Zko1 (Koichi Sasada)
<ul><li><strong>Status</strong> changed from <i>Closed</i> to <i>Open</i></li></ul><p>I need to make strongly objection about this commit (r38216) because this discussion is not concluded.</p>
<p>I believe at least mame-san's permission is needed to introduce this change.<br>
This is big behavior change.</p> Ruby master - Feature #7503: make timeout.rb async-interrupt safe by defaulthttps://bugs.ruby-lang.org/issues/7503?journal_id=344312012-12-06T02:33:51Zko1 (Koichi Sasada)
<ul><li><strong>Assignee</strong> set to <i>mame (Yusuke Endoh)</i></li><li><strong>Priority</strong> changed from <i>Normal</i> to <i>5</i></li></ul> Ruby master - Feature #7503: make timeout.rb async-interrupt safe by defaulthttps://bugs.ruby-lang.org/issues/7503?journal_id=344772012-12-06T21:31:22Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul><li><strong>Tracker</strong> changed from <i>Bug</i> to <i>Feature</i></li><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> changed from <i>mame (Yusuke Endoh)</i> to <i>matz (Yukihiro Matsumoto)</i></li></ul><p>I do NOT accept r38216 for 2.0.0. Please revert it.</p>
<p>Not only it is a new feature missing the deadline, but also it will lead<br>
to actual compatibility issues. I often use timeout to bound not only IO<br>
operation but also pure calculation, such as game tree search and brute-<br>
force search.</p>
<p>(Thanks ko1 for letting me know!)</p>
<p>--<br>
Yusuke Endoh <a href="mailto:mame@tsg.ne.jp" class="email">mame@tsg.ne.jp</a></p> Ruby master - Feature #7503: make timeout.rb async-interrupt safe by defaulthttps://bugs.ruby-lang.org/issues/7503?journal_id=344782012-12-06T21:31:30Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul><li><strong>Priority</strong> changed from <i>5</i> to <i>Normal</i></li><li><strong>Target version</strong> changed from <i>2.0.0</i> to <i>2.6</i></li></ul> Ruby master - Feature #7503: make timeout.rb async-interrupt safe by defaulthttps://bugs.ruby-lang.org/issues/7503?journal_id=344952012-12-07T14:03:50Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>% Done</strong> changed from <i>100</i> to <i>50</i></li></ul> Ruby master - Feature #7503: make timeout.rb async-interrupt safe by defaulthttps://bugs.ruby-lang.org/issues/7503?journal_id=344962012-12-07T14:04:03Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>50</i> to <i>100</i></li></ul><p>This issue was solved with changeset r38255.<br>
Motohiro, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<p>timeout.rb: replace deferred exception after async_interrupt_timing</p>
<ul>
<li>lib/timeout.rb (Timeout#timeout): since async_interrupt_timing<br>
re-raises a deferred exception, replace the timeout exception with<br>
Timeout::Error after it. [Bug <a class="issue tracker-2 status-2 priority-4 priority-default" title="Feature: make timeout.rb async-interrupt safe by default (Assigned)" href="https://bugs.ruby-lang.org/issues/7503">#7503</a>]</li>
</ul> Ruby master - Feature #7503: make timeout.rb async-interrupt safe by defaulthttps://bugs.ruby-lang.org/issues/7503?journal_id=345082012-12-07T23:17:36Zkosaki (Motohiro KOSAKI)kosaki.motohiro@gmail.com
<ul><li><strong>Status</strong> changed from <i>Closed</i> to <i>Assigned</i></li></ul><blockquote>
<p>Target version changed from 2.0.0 to next minor</p>
</blockquote>
<p>r38216 was reverted then.</p> Ruby master - Feature #7503: make timeout.rb async-interrupt safe by defaulthttps://bugs.ruby-lang.org/issues/7503?journal_id=688542017-12-25T18:15:09Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Target version</strong> deleted (<del><i>2.6</i></del>)</li></ul>