Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: JRuby 1.4
    • Fix Version/s: None
    • Component/s: Windows
    • Labels:
      None
    • Number of attachments :
      0

      Description

      This code fails in jruby on doze

      require 'timeout'
      out = nil
      begin
      Timeout::timeout(ARGV[1].to_i)

      { out = IO.popen ARGV[2..-1].join(' ') Process.wait out.pid # <----- this line fails in jruby, not in MRI. }

      rescue Timeout::Error
      puts 'timed out'
      Process.kill "KILL", out.pid
      end

      jruby: C:/dev/ruby/ruby-benchmark-suite/utils/timeout2.rb:16: waitpid unsupported on this platform (NotImplementedError)

      ruby MRI works.
      Thanks.
      -r

        Activity

        Hide
        Vladimir Sizikov added a comment -

        See waitpid() implementation in win32/win32.c in MRI sources. Tricky!

        Show
        Vladimir Sizikov added a comment - See waitpid() implementation in win32/win32.c in MRI sources. Tricky!
        Hide
        Vladimir Sizikov added a comment -

        Leads to multiple Process' RubySpec failures on Windows:

        jruby 1.5.0.dev (ruby 1.8.7 patchlevel 174) (2010-01-25 c933515) (Java HotSpot(TM) Client VM 1.6.0_18) [x86-java]
        
        
        1)
        An exception occurred during: before :all ERROR
        NotImplementedError: wait unsupported on this platform
        D:/work/jruby-dev/rubyspec.git/core/process/wait_spec.rb:5
        D:/work/jruby-dev/rubyspec.git/core/process/wait_spec.rb:3
        D:/work/jruby-dev/rubyspec.git/core/process/wait_spec.rb:55:in `load'
        D:/work/jruby-dev/mspec.git/bin/mspec-ci:8
        
        2)
        An exception occurred during: before :all ERROR
        NotImplementedError: wait unsupported on this platform
        D:/work/jruby-dev/rubyspec.git/core/process/wait2_spec.rb:7
        D:/work/jruby-dev/rubyspec.git/core/process/wait2_spec.rb:3
        D:/work/jruby-dev/rubyspec.git/core/process/wait2_spec.rb:55:in `load'
        D:/work/jruby-dev/mspec.git/bin/mspec-ci:8
        
        3)
        An exception occurred during: before :all ERROR
        NotImplementedError: wait unsupported on this platform
        D:/work/jruby-dev/rubyspec.git/core/process/waitall_spec.rb:5
        D:/work/jruby-dev/rubyspec.git/core/process/waitall_spec.rb:3
        D:/work/jruby-dev/rubyspec.git/core/process/waitall_spec.rb:55:in `load'
        D:/work/jruby-dev/mspec.git/bin/mspec-ci:8
        
        Show
        Vladimir Sizikov added a comment - Leads to multiple Process' RubySpec failures on Windows: jruby 1.5.0.dev (ruby 1.8.7 patchlevel 174) (2010-01-25 c933515) (Java HotSpot(TM) Client VM 1.6.0_18) [x86-java] 1) An exception occurred during: before :all ERROR NotImplementedError: wait unsupported on this platform D:/work/jruby-dev/rubyspec.git/core/process/wait_spec.rb:5 D:/work/jruby-dev/rubyspec.git/core/process/wait_spec.rb:3 D:/work/jruby-dev/rubyspec.git/core/process/wait_spec.rb:55:in `load' D:/work/jruby-dev/mspec.git/bin/mspec-ci:8 2) An exception occurred during: before :all ERROR NotImplementedError: wait unsupported on this platform D:/work/jruby-dev/rubyspec.git/core/process/wait2_spec.rb:7 D:/work/jruby-dev/rubyspec.git/core/process/wait2_spec.rb:3 D:/work/jruby-dev/rubyspec.git/core/process/wait2_spec.rb:55:in `load' D:/work/jruby-dev/mspec.git/bin/mspec-ci:8 3) An exception occurred during: before :all ERROR NotImplementedError: wait unsupported on this platform D:/work/jruby-dev/rubyspec.git/core/process/waitall_spec.rb:5 D:/work/jruby-dev/rubyspec.git/core/process/waitall_spec.rb:3 D:/work/jruby-dev/rubyspec.git/core/process/waitall_spec.rb:55:in `load' D:/work/jruby-dev/mspec.git/bin/mspec-ci:8
        Hide
        Roger Pack added a comment -

        another example:

        irb(main):001:0> IO.popen("false")

        {|pipe| Process.waitpid2 pipe.pid }

        NotImplementedError: waitpid unsupported on this platform
        from (irb):2

        Show
        Roger Pack added a comment - another example: irb(main):001:0> IO.popen("false") {|pipe| Process.waitpid2 pipe.pid } NotImplementedError: waitpid unsupported on this platform from (irb):2
        Hide
        Roger Pack added a comment -

        I guess what MRI does is maintain a weakref map of PID's to handles so it can do an equivalent of a waitFor on them...

        Show
        Roger Pack added a comment - I guess what MRI does is maintain a weakref map of PID's to handles so it can do an equivalent of a waitFor on them...
        Hide
        Roger Pack added a comment -

        My current work around (for followers) is to loop doing Process.kill(0, pid) until it raises an exception, which means the process has ended.

        Show
        Roger Pack added a comment - My current work around (for followers) is to loop doing Process.kill(0, pid) until it raises an exception, which means the process has ended.

          People

          • Assignee:
            Unassigned
            Reporter:
            Roger Pack
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: