Issue #17849 has been updated by schneems (Richard Schneeman).


>  (2) Some applications can run their program body in ensure clauses.

@ko1 first, thank you for looking at this issue. I agree this is a problem,=
 it is the pathological case to what I was describing by the inability to d=
etect a halting condition. This case is the cause of my suggestion to add s=
ome sort of "overtime" timeout value. Somewhat like how you should send a p=
rocess SIGTERM and let it gracefully exit before having the option of sendi=
ng a SIGKILL. What do you think of that option?

@mame "It may be possible" thank you for this idea. If exploration or PoC i=
s possible to help move things forward that would be great. I can benchmark=
 some real-world rails apps using https://github.com/schneems/derailed_benc=
hmarks if we are worried about performance concerns. (Though if I am not re=
sponsive, it's because ruby-lang emails stopped coming for me. I have asked=
 HSBT but I have no solution now)

I think that this ability to timeout arbitrary Ruby code is very useful, ev=
en if it is not perfect. I agree with @matz that such a truly "perfect" API=
 and implementation may be impossible...I also believe that this feature is=
 worth improving even if the final result has shortcomings.

Thank you all for your continued work with Ruby!

----------------------------------------
Feature #17849: Fix Timeout.timeout so that it can be used in threaded Web =
servers
https://bugs.ruby-lang.org/issues/17849#change-92088

* Author: duerst (Martin D=FCrst)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
Making this a separate issue from #17837

Eregon (Benoit Daloze) wrote in https://bugs.ruby-lang.org/issues/17837#not=
e-10 (which is  about timeouts for regular expressions):

> I think fixing Timeout.timeout might be possible.
> The main/major issue is it can trigger within `ensure`, right? Is there a=
nything else?
> We could automatically mask `Thread#raise` within `ensure` so it only hap=
pens after the `ensure` body completes.
> And we could still have a larger "hard timeout" if an `ensure` takes way =
too long (shouldn't happen, but one cannot be sure).
> I recall discussing this with @schneems some time ago on Twitter.





-- =

https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=3Dunsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>