lsegal / yard

YARD is a Ruby Documentation tool. The Y stands for "Yay!"
http://yardoc.org
MIT License
1.94k stars 397 forks source link

FiberError: uninitialized fiber () #434

Closed ghost closed 12 years ago

ghost commented 12 years ago

ruby 1.9.1 installed with homebrew

removed ~/.yard*

when generating documentation from stdlib:

$ yardoc -o doc-core
....
/usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/yard-0.7.4/lib/yard/handlers/processor.rb:125:in `each_with_index': uninitialized fiber (FiberError)
from /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/yard-0.7.4/lib/yard/handlers/processor.rb:125:in `process'
from /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/yard-0.7.4/lib/yard/parser/source_parser.rb:492:in `post_process'
from /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/yard-0.7.4/lib/yard/parser/source_parser.rb:439:in `parse'
from /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/yard-0.7.4/lib/yard/parser/source_parser.rb:361:in `parse_in_order'
from /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/yard-0.7.4/lib/yard/parser/source_parser.rb:89:in `block in parse'
from /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/yard-0.7.4/lib/yard/logging.rb:66:in `enter_level'
from /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/yard-0.7.4/lib/yard/parser/source_parser.rb:88:in `parse'
from /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/yard-0.7.4/lib/yard.rb:18:in `parse'
from /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/yard-0.7.4/lib/yard/cli/yardoc.rb:215:in `run'
from /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/yard-0.7.4/lib/yard/cli/command.rb:13:in `run'
from /usr/local/Cellar/ruby/1.9.3-p0/lib/ruby/gems/1.9.1/gems/yard-0.7.4/bin/yardoc:4:in `<top (required)>'
from /usr/local/Cellar/ruby/1.9.3-p0/bin/yardoc:19:in `load'
from /usr/local/Cellar/ruby/1.9.3-p0/bin/yardoc:19:in `<main>'
brentkirby commented 12 years ago

I'm having the same issue, ruby 1.9.3p0 (installed via rvm), same backtrace as above.

I actually had this problem a few weeks back and somehow got around it, unfortunately I can't remember that now :)

trkoch commented 12 years ago

Same here :/

bsodmike commented 12 years ago

This is what I'm getting

$ yard
/Users/mdesilva/.rvm/gems/ruby-1.9.3-p0@railsdocs/gems/yard-0.7.4/lib/yard/handlers/processor.rb:125:in `each_with_index': uninitialized fiber (FiberError)
    from /Users/mdesilva/.rvm/gems/ruby-1.9.3-p0@railsdocs/gems/yard-0.7.4/lib/yard/handlers/processor.rb:125:in `process'
    from /Users/mdesilva/.rvm/gems/ruby-1.9.3-p0@railsdocs/gems/yard-0.7.4/lib/yard/parser/source_parser.rb:492:in `post_process'
    from /Users/mdesilva/.rvm/gems/ruby-1.9.3-p0@railsdocs/gems/yard-0.7.4/lib/yard/parser/source_parser.rb:439:in `parse'
    from /Users/mdesilva/.rvm/gems/ruby-1.9.3-p0@railsdocs/gems/yard-0.7.4/lib/yard/parser/source_parser.rb:361:in `parse_in_order'
    from /Users/mdesilva/.rvm/gems/ruby-1.9.3-p0@railsdocs/gems/yard-0.7.4/lib/yard/parser/source_parser.rb:89:in `block in parse'
    from /Users/mdesilva/.rvm/gems/ruby-1.9.3-p0@railsdocs/gems/yard-0.7.4/lib/yard/logging.rb:66:in `enter_level'
    from /Users/mdesilva/.rvm/gems/ruby-1.9.3-p0@railsdocs/gems/yard-0.7.4/lib/yard/parser/source_parser.rb:88:in `parse'
    from /Users/mdesilva/.rvm/gems/ruby-1.9.3-p0@railsdocs/gems/yard-0.7.4/lib/yard.rb:18:in `parse'
    from /Users/mdesilva/.rvm/gems/ruby-1.9.3-p0@railsdocs/gems/yard-0.7.4/lib/yard/cli/yardoc.rb:215:in `run'
    from /Users/mdesilva/.rvm/gems/ruby-1.9.3-p0@railsdocs/gems/yard-0.7.4/lib/yard/cli/command.rb:13:in `run'
    from /Users/mdesilva/.rvm/gems/ruby-1.9.3-p0@railsdocs/gems/yard-0.7.4/lib/yard/cli/command_parser.rb:68:in `run'
    from /Users/mdesilva/.rvm/gems/ruby-1.9.3-p0@railsdocs/gems/yard-0.7.4/lib/yard/cli/command_parser.rb:50:in `run'
    from /Users/mdesilva/.rvm/gems/ruby-1.9.3-p0@railsdocs/gems/yard-0.7.4/bin/yard:4:in `<top (required)>'
    from /Users/mdesilva/.rvm/gems/ruby-1.9.3-p0@railsdocs/bin/yard:19:in `load'
    from /Users/mdesilva/.rvm/gems/ruby-1.9.3-p0@railsdocs/bin/yard:19:in `<main>'
lsegal commented 12 years ago

@ben-skelton, @brentkirby, @trkoch and @bsodmike: what OS are you all on? and is there anything else about your environment that might be of note? rvm? XCode version? etc.

The output of the following would help:

$ uname -a
$ gcc -v

I can't reproduce this on my Lion machine (gcc 4.2.1), but I am not using rvm.

brentkirby commented 12 years ago

OSX 10.7.2, rvm, ruby 1.9.3-p0

Installing 0.7.2 works fine, having trouble with 7.3 or 7.4.

Heres the uname and gcc if it helps:

Darwin MacBook.local 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64

Target: i686-apple-darwin11 Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/src/configure --disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1 Thread model: posix gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

lsegal commented 12 years ago

@brentkirby, did you compile Ruby using --with-gcc=clang by any chance? Can you list the results of:

$ cat ~/.rvm/log/ruby-1.9.3-p0/make.log

if CC = clang, it's most likely an issue with Ruby, as I reproduced bus errors when compiling with clang: https://gist.github.com/1602493

brentkirby commented 12 years ago

Looks like it was gcc

cat ~/.rvm/log/ruby-1.9.3-p0/make.log | grep CC
CC = /usr/bin/gcc
lsegal commented 12 years ago

One last test:

$ ruby -rfiber -e 'f = Fiber.new { }; f.resume'

What does that do?

lsegal commented 12 years ago

Oh wait, @brentkirby, you mentioned you worked around it and no longer have the crash issue in yard? Then your results might not be all that interesting :) (the gcc thing might actually be how you worked around it?)

brentkirby commented 12 years ago

That runs fine (used irb if it matters)

Nah sorry, I was thinking wrong :) My workaround was just downgrading to 0.7.2. That runs without a hitch.

bsodmike commented 12 years ago

I uninstalled my install of 1.9.3 and first installed the GCC tools for 10.7. Once this was done I checked to see that gcc-4.2 was listed


$ ls /usr/bin | grep gcc
gcc
gcc-4.2
i686-apple-darwin11-gcc-4.2.1
i686-apple-darwin11-llvm-gcc-4.2
llvm-gcc
llvm-gcc-4.2

The install was rather easy then


$ rvm install 1.9.3
Fetching yaml-0.1.4.tar.gz to /Users/mdesilva/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/mdesilva/.rvm/src
Configuring yaml in /Users/mdesilva/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/mdesilva/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/mdesilva/.rvm/usr
Installing Ruby from source to: /Users/mdesilva/.rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)...

ruby-1.9.3-p0 - #fetching 
ruby-1.9.3-p0 - #extracted to /Users/mdesilva/.rvm/src/ruby-1.9.3-p0 (already extracted)
ruby-1.9.3-p0 - #configuring 
ruby-1.9.3-p0 - #compiling 
ruby-1.9.3-p0 - #installing 
Removing old Rubygems files...
Installing rubygems-1.8.10 for ruby-1.9.3-p0 ...
Installation of rubygems completed successfully.
ruby-1.9.3-p0 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.9.3-p0 - #importing default gemsets (/Users/mdesilva/.rvm/gemsets/)
Install of ruby-1.9.3-p0 - #complete 

I'm able to generate docs via YARD now in Lion.

lsegal commented 12 years ago

I'm unfortunately going to have to mark this as a third party issue for the 0.7 branch. Note that in 0.8 we no longer rely on continuations, so once that is out, this error will disappear. Also, once ruby gets better with clang support, this issue will disappear in 0.7 too.

After doing some research, it seems that there are confirmed reports that:

a. Ruby 1.9.3 compiles with clang, but not 100% correctly: [1] b. There are known issues with Ruby trunk and clang on the Ruby issue tracker. It seems to be official policy that clang should not be used to compile Ruby: [2]

This is all assuming that the compilation issues are coming from clang. @brentkirby, I know that you supposedly reproduced this with gcc, but I helped someone else on IRC in your same situation (still had Fiber errors even though make log showed gcc) and it turned out that they had an environment issue-- flushing all Ruby installs and recompiling with gcc seemed to fix it for them. I think your situation might have been a similar environment problem.

I should point out that the osx-gcc-installer was used, not Apple's XCode gcc. I recommend compiling Ruby with osx-gcc-installer under OSX. Hopefully Ruby core will fix and backport clang support, but this should be taken up on the Ruby issue tracker, not here-- and even if it is a gcc issue.

Thanks all for reporting this issue, though! If this starts hitting more people, we may take a second look at this. But right now, it seems unwise to invest effort for us to workaround compiler compatibility issues in the underlying Ruby language.

Bodacious commented 12 years ago

Just for the record, it's hitting more people :(