Project

General

Profile

Actions

Bug #9380

closed

Enumerator does not work in timeout

Added by nobu (Nobuyoshi Nakada) about 10 years ago. Updated about 10 years ago.

Status:
Closed
Target version:
[ruby-dev:47872]

Description

Enumeratortimeoutの組み合わせで、Timeout::Errorが起きるべきところでArgumentErrorが発生します。

$ ruby -v -rtimeout -e 'def (o=Object.new).each; sleep; end' -e 'Timeout.timeout(0.01) {o.to_enum.next}'
ruby 2.2.0dev (2014-01-07 trunk 44522) [universal.x86_64-darwin13.0]
/opt/local/lib/ruby/2.2.0/timeout.rb:39:in `throw': uncaught throw #<Timeout::ExitException: Timeout::ExitException> (ArgumentError)
	from /opt/local/lib/ruby/2.2.0/timeout.rb:39:in `exception'
	from -e:1:in `sleep'
	from -e:1:in `each'
	from -e:1:in `each'

Updated by nobu (Nobuyoshi Nakada) about 10 years ago

  • Description updated (diff)
Actions #2

Updated by nobu (Nobuyoshi Nakada) about 10 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r44523.
Nobuyoshi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


lib/timeout.rb: fallback to Timeout::Error

  • lib/timeout.rb (Timeout::ExitException.catch): pass arguments
    for new instance.
  • lib/timeout.rb (Timeout::ExitException#exception): fallback to
    Timeout::Error if couldn't throw. [ruby-dev:47872] [Bug #9380]
  • lib/timeout.rb (Timeout#timeout): initialize ExitException with
    message for the fallback case.

Updated by nobu (Nobuyoshi Nakada) about 10 years ago

  • Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN to 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: REQUIRED
Actions #4

Updated by nobu (Nobuyoshi Nakada) about 10 years ago

  • Description updated (diff)

Updated by naruse (Yui NARUSE) about 10 years ago

  • Backport changed from 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: REQUIRED to 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: DONE
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0