Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / 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

end of thread, other threads:[~2011-12-30 17:17 UTC | newest]

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)

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/rainbows.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).