Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: JRuby 1.6.2, JRuby 1.7.0.pre1
    • Component/s: Core Classes/Modules
    • Labels:
      None
    • Environment:
      jruby 1.6.0.dev (ruby 1.8.7 patchlevel 249) (2010-11-18 2e438b1) (Java HotSpot(TM) Client VM 1.6.0_18) [Windows 7-x86-java]
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      require 'rubygems'
      require 'spec' # rspec 1.3
      require 'timeout'
      describe 'timeout' do
       it 'should' do
      
          begin
          Timeout::timeout(2) {
            sleep
          }
          rescue
          end
       end
      end
      

      When I run this code, it returns "without a message" and with %ERRORLEVEL% set to 1, so...I think perhaps something bad happens. 1.5.5 and 1.6.0
      Cheers!
      -r

        Activity

        Hide
        Hiroshi Nakamura added a comment -

        I didn't run the script with rspec but the following should be happening.

        • Timeout.timeout raises a Tmeout::Error
        • In CRuby 1.9, Timeout::Error is a StandardError so you can rescue it with the 'rescue' statement.
        • In CRuby 1.8, Timeout::Error is not a StandardError but a Interrupt which is a subclass of SignalException. So you can NOT rescue it with the 'rescue'.
        • In JRuby, regardless of it's 1.8 or 1.9, Timeout::Error is a Interrupt so it should behave like CRuby 1.8 at present.
        • You're comparing JRuby 1.8 with CRuby 1.9

        Right?

        Show
        Hiroshi Nakamura added a comment - I didn't run the script with rspec but the following should be happening. Timeout.timeout raises a Tmeout::Error In CRuby 1.9, Timeout::Error is a StandardError so you can rescue it with the 'rescue' statement. In CRuby 1.8, Timeout::Error is not a StandardError but a Interrupt which is a subclass of SignalException. So you can NOT rescue it with the 'rescue'. In JRuby, regardless of it's 1.8 or 1.9, Timeout::Error is a Interrupt so it should behave like CRuby 1.8 at present. You're comparing JRuby 1.8 with CRuby 1.9 Right?
        Hide
        Roger Pack added a comment -

        Interesting. It appears that MRI 1.8.7 does behave as jruby currently does.
        MRI 1.9.2 outputs:

        .

        Finished in 2.145 seconds

        1 example, 0 failures

        $ \dev\ruby\downloads\jruby\bin\jruby.exe --1.9 bad.rb
        $

        so I guess this is only a distinction between 1.9 mode and jruby. If it's "expected and what jruby wants" then go ahead and close this I suppose...

        Show
        Roger Pack added a comment - Interesting. It appears that MRI 1.8.7 does behave as jruby currently does. MRI 1.9.2 outputs: . Finished in 2.145 seconds 1 example, 0 failures $ \dev\ruby\downloads\jruby\bin\jruby.exe --1.9 bad.rb $ so I guess this is only a distinction between 1.9 mode and jruby. If it's "expected and what jruby wants" then go ahead and close this I suppose...
        Hide
        Hiroshi Nakamura added a comment -

        Confirmed that it's an incompatibility of Timeout::Error class hierarchy in 1.9 mode.

        Show
        Hiroshi Nakamura added a comment - Confirmed that it's an incompatibility of Timeout::Error class hierarchy in 1.9 mode.
        Hide
        Hiroshi Nakamura added a comment -

        I marked this as [1.9]. This change in CRuby was introduced by the discussion here: http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-core/15458?15182-15607+split-mode-vertical
        Is this change intended? Hmm.

        Show
        Hiroshi Nakamura added a comment - I marked this as [1.9] . This change in CRuby was introduced by the discussion here: http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-core/15458?15182-15607+split-mode-vertical Is this change intended? Hmm.
        Hide
        Charles Oliver Nutter added a comment -

        We should add a spec to RubySpec for the new error behavior. I'm unclear what the difference is. 1.9 introduced StandardTimeoutError and uses that instead of Timeout::Error?

        Show
        Charles Oliver Nutter added a comment - We should add a spec to RubySpec for the new error behavior. I'm unclear what the difference is. 1.9 introduced StandardTimeoutError and uses that instead of Timeout::Error?
        Hide
        Charles Oliver Nutter added a comment -

        Not sure where to go with this...

        Show
        Charles Oliver Nutter added a comment - Not sure where to go with this...
        Hide
        Charles Oliver Nutter added a comment -

        This was resolved at least by 1.6.2.

        jruby1_6 = 486a6b619854a569db69b39b7d6dc2aef2e98667

        master = 5275346ffbcd411cc5f81ea98b204491c3e209ab

        Show
        Charles Oliver Nutter added a comment - This was resolved at least by 1.6.2. jruby1_6 = 486a6b619854a569db69b39b7d6dc2aef2e98667 master = 5275346ffbcd411cc5f81ea98b204491c3e209ab
        Hide
        Roger Pack added a comment -

        appears fixed now thanks!

        Show
        Roger Pack added a comment - appears fixed now thanks!

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Roger Pack
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: