JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-5842

NullPointerException when calling any method on Fiber.current if not explicitly in a created Fiber

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6.2
    • Fix Version/s: JRuby 1.7.0.pre1
    • Component/s: Core Classes/Modules
    • Labels:
      None
    • Environment:
      Snow leopard 10.6.7 on a 2011 Macbook Pro
    • Number of attachments :
      0

      Description

      I created the following "test.rb":

      require 'fiber'
      ::Fiber.current.object_id

      Executing jruby --1.9 test.rb results in:

      CachingCallSite.java:388:in `pollAndGetClass': java.lang.NullPointerException
      from CachingCallSite.java:100:in `call'
      from test.rb:2:in `_file_'
      from test.rb:-1:in `load'
      from Ruby.java:671:in `runScript'
      from Ruby.java:575:in `runNormally'
      from Ruby.java:424:in `runFromMain'
      from Main.java:278:in `doRunFromMain'
      from Main.java:198:in `internalRun'
      from Main.java:164:in `run'
      from Main.java:148:in `run'
      from Main.java:128:in `main'

      Note: this seems to happen only if not actually in a fiber block. Also, merely calling Fiber.current does not trigger the NPE. Only when you call a method (any method, it seems) on the resulting object do you get the NPE.

      MRI seems to have a valid "global fiber" that gets returned when you call Fiber.current outside a fiber block.

        Activity

        Hide
        Nick Sieger added a comment -

        Fixed in trunk for now, in 28414b7. Thanks for the report!

        Show
        Nick Sieger added a comment - Fixed in trunk for now, in 28414b7. Thanks for the report!

          People

          • Assignee:
            Nick Sieger
            Reporter:
            Daniel Azuma
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: