Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JRuby hangs at Fiber#resume #3500

Closed
rockuw opened this issue Nov 26, 2015 · 1 comment
Closed

JRuby hangs at Fiber#resume #3500

rockuw opened this issue Nov 26, 2015 · 1 comment

Comments

@rockuw
Copy link

rockuw commented Nov 26, 2015

jruby 9.0.3.0 (2.2.2) 2015-10-21 633c9aa Java HotSpot(TM) 64-Bit Server VM 24.45-b08 on 1.7.0_45-b18 +jit [darwin-x86_64]

It happens when my tests involve netdown.
Here is the code snippet:

    def read(bytes = nil, outbuf = nil)
      ret = ""
      loop do
        c = @chunks.shift
        ret << c if c && !c.empty?
        break if bytes && ret.size >= bytes
        if @producer.alive?
          @producer.resume                        # hangs at this line
        else
          break
        end
      end

      if outbuf
        # WARNING: Using outbuf = '' here DOES NOT work!
        outbuf.clear
        outbuf << ret
      end

      # Conform to IO#read(length[, outbuf]):
      # At end of file, it returns nil or "" depend on
      # length. ios.read() and ios.read(nil) returns
      # "". ios.read(positive-integer) returns nil.
      return nil if ret.empty? && !bytes.nil? && bytes > 0

      ret
    end

    def write(chunk)
      @chunks << chunk
      Fiber.yield
      self
    end

Here are the stack trace:

"Ruby-0-Thread-8: /Users/rockuw/Downloads/ruby-sdk/lib/aliyun/oss/upload.rb:51" daemon prio=5 tid=0x00007fd814529800 nid=0x5603 waiting on condition [0x0000700002252000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000007e3398298> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
at java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:374)
at org.jruby.ext.thread.Queue$1.run(Queue.java:59)
at org.jruby.ext.thread.Queue$1.run(Queue.java:56)
at org.jruby.RubyThread.executeTask(RubyThread.java:1352)
at org.jruby.ext.thread.Queue.pop(Queue.java:195)
at org.jruby.ext.thread.Queue.pop(Queue.java:164)
at org.jruby.ext.fiber.ThreadFiber.exchangeWithFiber(ThreadFiber.java:108)
at org.jruby.ext.fiber.ThreadFiber.resume(ThreadFiber.java:86)
at org.jruby.ext.fiber.ThreadFiber$INVOKER$i$0$0$resume.call(ThreadFiber$INVOKER$i$0$0$resume.gen)
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodN.call(JavaMethod.java:713)
at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:189)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:129)
at Users.rockuw.Downloads.ruby_minus_sdk.lib.aliyun.oss.http.invokeOther10:resume(/Users/rockuw/Downloads/ruby-sdk/lib/aliyun/oss/http.rb)
at Users.rockuw.Downloads.ruby_minus_sdk.lib.aliyun.oss.http.RUBY$block$read$0(/Users/rockuw/Downloads/ruby-sdk/lib/aliyun/oss/http.rb:57)
at java.lang.invoke.LambdaForm$DMH/1598639304.invokeStatic_LLLLLLL_L(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/1861629557.invokeExact_MT(LambdaForm$MH)
at org.jruby.runtime.CompiledIRBlockBody.commonYieldPath(CompiledIRBlockBody.java:70)
at org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:99)
at org.jruby.runtime.IRBlockBody.yieldSpecific(IRBlockBody.java:67)
at org.jruby.runtime.Block.yieldSpecific(Block.java:116)
at org.jruby.RubyKernel.loop(RubyKernel.java:1291)
at org.jruby.RubyKernel$INVOKER$s$0$0$loop.call(RubyKernel$INVOKER$s$0$0$loop.gen)
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:494)
at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:77)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:83)
at org.jruby.ir.instructions.CallBase.interpret(CallBase.java:419)
at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:322)
at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:77)
at org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:83)
at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:197)
at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:183)
at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:197)
at org.jruby.RubyClass.finvoke(RubyClass.java:756)

@enebo
Copy link
Member

enebo commented May 17, 2017

I guess we never dug into this because we cannot run partial snippets to reproduce the issue. @rockuw if you can still see this with 9.1.9.0 can you maybe strip down your example to give us something we can use to debug this more easily?

Since this has been a long time since it has been reported I am closing as invalid, but please re-open if you can still see this issue.

@enebo enebo closed this as completed May 17, 2017
@enebo enebo added this to the Invalid or Duplicate milestone May 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants