Rainbows! Rack HTTP server user/dev discussion
 help / color / Atom feed
* Weird app error: uninitialized fiber (FiberError)
@ 2011-12-30  0:28 Lin Jen-Shin (godfat)
       [not found] ` <CAA2_N1vcNCgKKr8RQ7QDmsudShHD6g5ONnAhzCxocDyBkTesVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Lin Jen-Shin (godfat) @ 2011-12-30  0:28 UTC (permalink / raw)
  To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw; +Cc: Lin Jen-Shin \(godfat\)

Hello Rainbows,

I was trying to `use :CoolioFiberSpawn` with `Rainbows.sleep`
to simulate asynchrony HTTP requests. However, I keep seeing
weird "app error: uninitialized fiber (FiberError)".

I spent a few hours (ouch) tracking down to a simple case.
Suppose I have a Rack app which has `Rainbows.sleep`
inside a each block:
https://gist.github.com/1536857 (I am running Ruby 1.9.3)

class Weird
  def call env=nil
    [1].each{ # if you comment out the each block, then it works
      Rainbows.sleep 2
    }
    [200, {}, ["ok\n"]]
  end
end

Then `run Weird.new` would always cause

    app error: uninitialized fiber (FiberError)

But if I took out the each block
inside Weird#call, such like:

class Weird
  def call env=nil
    Rainbows.sleep 2
    [200, {}, ["ok\n"]]
  end
end

Then it works fine. Moreover, if I run the app like this:

    run lambda{ |env| Weird.new.call }

Then both with or without the each block would work.

Could you please explain this for me? Or is it a bug somewhere?
Thanks!!
_______________________________________________
Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
http://rubyforge.org/mailman/listinfo/rainbows-talk
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Weird app error: uninitialized fiber (FiberError)
       [not found] ` <CAA2_N1vcNCgKKr8RQ7QDmsudShHD6g5ONnAhzCxocDyBkTesVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-12-30  0:44   ` Eric Wong
       [not found]     ` <20111230004413.GA12870-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Wong @ 2011-12-30  0:44 UTC (permalink / raw)
  To: Rainbows! list; +Cc: Lin Jen-Shin \(godfat\)

"Lin Jen-Shin (godfat)" <godfat-hOE/xeEBYYIdnm+yROfE0A@public.gmane.org> wrote:
> I was trying to `use :CoolioFiberSpawn` with `Rainbows.sleep`
> to simulate asynchrony HTTP requests. However, I keep seeing
> weird "app error: uninitialized fiber (FiberError)".

<snip>

> Could you please explain this for me? Or is it a bug somewhere?

This looks like a Ruby bug, possibly related to combining Fibers with
fork()...

Can you reproduce this with zbatery?  (zbatery is Rainbows!, without fork()),
just s/rainbows/zbatery/ in the command-line).

This may be related to https://bugs.ruby-lang.org/issues/5700
_______________________________________________
Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
http://rubyforge.org/mailman/listinfo/rainbows-talk
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Weird app error: uninitialized fiber (FiberError)
       [not found]     ` <20111230004413.GA12870-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
@ 2011-12-30  0:55       ` Lin Jen-Shin (godfat)
       [not found]         ` <CANhhkiGe7Eqw1CupBY0JSkzD1MMuuX6aN7hUGoMHK3F43fcbCA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Lin Jen-Shin (godfat) @ 2011-12-30  0:55 UTC (permalink / raw)
  To: Rainbows! list; +Cc: Eric Wong, Lin Jen-Shin \(godfat\)

On Fri, Dec 30, 2011 at 8:44 AM, Eric Wong <normalperson@yhbt.net> wrote:
> This looks like a Ruby bug, possibly related to combining Fibers with
> fork()...
>
> Can you reproduce this with zbatery?  (zbatery is Rainbows!, without fork()),
> just s/rainbows/zbatery/ in the command-line).
>
> This may be related to https://bugs.ruby-lang.org/issues/5700

Thanks for the quick response.

I can reproduce this under zbatery as well, so I guess this is
not related to fork()? My ruby and gem versions:

ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]
zbatery (4.1.2)
rainbows (4.3.1)
unicorn (4.1.1)
cool.io (1.1.0)

I am not sure if I should be happy if this is really a ruby's bug.
I thought I just couldn't figure out how do fibers work, looking
through a lot of sources and doing a lot of experiments.
_______________________________________________
Rainbows! mailing list - rainbows-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/rainbows-talk
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Weird app error: uninitialized fiber (FiberError)
       [not found]         ` <CANhhkiGe7Eqw1CupBY0JSkzD1MMuuX6aN7hUGoMHK3F43fcbCA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-12-30  1:35           ` Eric Wong
       [not found]             ` <20111230013547.GA30808-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Wong @ 2011-12-30  1:35 UTC (permalink / raw)
  To: Lin Jen-Shin (godfat); +Cc: Rainbows! list, Lin Jen-Shin \(godfat\)

"Lin Jen-Shin (godfat)" <godfat-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> I can reproduce this under zbatery as well, so I guess this is
> not related to fork()? My ruby and gem versions:
> 
> ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]

It may be an issue with LLVM/GCC on your platform, I've seen
several issues on the ruby-core list related to that setup.

Maybe recompiling Ruby (and all extensions) with a non-LLVM
version of GCC will solve this.

> I am not sure if I should be happy if this is really a ruby's bug.
> I thought I just couldn't figure out how do fibers work, looking
> through a lot of sources and doing a lot of experiments.

Can you reproduce the issue on a GNU/Linux system?
I cannot support non-Free platforms, anyways.
_______________________________________________
Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
http://rubyforge.org/mailman/listinfo/rainbows-talk
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Weird app error: uninitialized fiber (FiberError)
       [not found]             ` <20111230013547.GA30808-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
@ 2011-12-30  2:20               ` Lin Jen-Shin (godfat)
  2011-12-30 17:03               ` Lin Jen-Shin (godfat)
  1 sibling, 0 replies; 6+ messages in thread
From: Lin Jen-Shin (godfat) @ 2011-12-30  2:20 UTC (permalink / raw)
  To: Eric Wong; +Cc: Lin Jen-Shin \(godfat\), Rainbows! list

On Fri, Dec 30, 2011 at 9:35 AM, Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org> wrote:
> Maybe recompiling Ruby (and all extensions) with a non-LLVM
> version of GCC will solve this.

I'll try to recompile Ruby (and all extensions) tomorrow. (I really need to
sleep now) It seems now Apple does not provide a non-LLVM GCC now.
My /usr/bin/gcc is a link to llvm-gcc-4.2.

> Can you reproduce the issue on a GNU/Linux system?
> I cannot support non-Free platforms, anyways.

I should have thought this. Just tried on my Arch Linux:
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
I can't reproduce that on the machine.

That's a good news. We're deploying to Linux anyway.
Thanks!

(I am not sure how to narrow this down further to file a
bug on Ruby's issue tracker. Maybe I'll just show them
what I have now)
_______________________________________________
Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
http://rubyforge.org/mailman/listinfo/rainbows-talk
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Weird app error: uninitialized fiber (FiberError)
       [not found]             ` <20111230013547.GA30808-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
  2011-12-30  2:20               ` Lin Jen-Shin (godfat)
@ 2011-12-30 17:03               ` Lin Jen-Shin (godfat)
  1 sibling, 0 replies; 6+ messages in thread
From: Lin Jen-Shin (godfat) @ 2011-12-30 17:03 UTC (permalink / raw)
  To: Eric Wong; +Cc: Lin Jen-Shin \(godfat\), Rainbows! list

On Fri, Dec 30, 2011 at 9:35 AM, Eric Wong <normalperson-rMlxZR9MS24@public.gmane.org> wrote:
> It may be an issue with LLVM/GCC on your platform, I've seen
> several issues on the ruby-core list related to that setup.
>
> Maybe recompiling Ruby (and all extensions) with a non-LLVM
> version of GCC will solve this.

Just want to let you know, after trying GCC 4.6 without LLVM
involved and reinstalling all binary extensions, I can no longer
reproduce this.

What's amazing is, when I switch back to the old Ruby which
is compiled with Apple's llvm-gcc, I can't reproduce that either!

O_o

Maybe it's restarting the computer would really solve everything,
or I just did something wrong somewhere... Then I guess I shouldn't
file a bug for this.

Thanks for your help!
_______________________________________________
Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
http://rubyforge.org/mailman/listinfo/rainbows-talk
Do not quote signatures (like this one) or top post when replying


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-30  0:28 Weird app error: uninitialized fiber (FiberError) Lin Jen-Shin (godfat)
     [not found] ` <CAA2_N1vcNCgKKr8RQ7QDmsudShHD6g5ONnAhzCxocDyBkTesVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-12-30  0:44   ` Eric Wong
     [not found]     ` <20111230004413.GA12870-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2011-12-30  0:55       ` Lin Jen-Shin (godfat)
     [not found]         ` <CANhhkiGe7Eqw1CupBY0JSkzD1MMuuX6aN7hUGoMHK3F43fcbCA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-12-30  1:35           ` Eric Wong
     [not found]             ` <20111230013547.GA30808-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2011-12-30  2:20               ` Lin Jen-Shin (godfat)
2011-12-30 17:03               ` Lin Jen-Shin (godfat)

Rainbows! Rack HTTP server user/dev discussion

Archives are clonable:
	git clone --mirror http://bogomips.org/rainbows-public
	git clone --mirror http://ou63pmih66umazou.onion/rainbows-public

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.rainbows
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.rainbows

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git