Project

General

Profile

Actions

Bug #10567

closed

A fiber issue with `autoload`: `fiber called across stack rewinding barrier (FiberError)`

Added by qqshfox (Hanfei Shen) over 9 years ago. Updated almost 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby-2.1.5
[ruby-core:66685]

Description

We have two ruby files as following:

test.rb

autoload :User, './user.rb'

f = Fiber.new do
  p User
end
f.resume
f.resume

user.rb

class User
end

Fiber.yield # This line is important

If I run the test.rb, i got the a FiberError on Ruby 2.x but not on Ruby 1.9.3

$ rvm 1.9.3,2.0,2.1 do sh -c 'echo ==== $RUBY_VERSION; ruby test.rb'
==== ruby-1.9.3-p551
User
==== ruby-2.0.0-p598
user.rb:4:in `yield': fiber called across stack rewinding barrier (FiberError)
    from user.rb:4:in `<top (required)>'
    from test.rb:4:in `block in <main>'
==== ruby-2.1.5
user.rb:4:in `yield': fiber called across stack rewinding barrier (FiberError)
    from user.rb:4:in `<top (required)>'
    from test.rb:4:in `block in <main>'

More sample codes are in this repo:

https://github.com/qqshfox/test_fiber

Is this intentional?

Actions #1

Updated by jeremyevans0 (Jeremy Evans) almost 5 years ago

  • Status changed from Open to Closed

This issue was fixed between Ruby 2.2 and 2.3:

$ ruby23 test.rb  
User
$ ruby22 test.rb  
.../user.rb:4:in `yield': fiber called across stack rewinding barrier (FiberError)
        from .../user.rb:4:in `<top (required)>'
        from test.rb:4:in `block in <main>'
Actions

Also available in: Atom PDF

Like0
Like0