Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
From: "Lin Jen-Shin (godfat)" <godfat-hOE/xeEBYYIdnm+yROfE0A@public.gmane.org>
To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
Cc: "Lin Jen-Shin \(godfat\)"
	<godfat-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Weird app error: uninitialized fiber (FiberError)
Date: Fri, 30 Dec 2011 08:28:25 +0800	[thread overview]
Message-ID: <CAA2_N1vcNCgKKr8RQ7QDmsudShHD6g5ONnAhzCxocDyBkTesVg@mail.gmail.com> (raw)

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


             reply	other threads:[~2011-12-30  0:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-30  0:28 Lin Jen-Shin (godfat) [this message]
     [not found] ` <CAA2_N1vcNCgKKr8RQ7QDmsudShHD6g5ONnAhzCxocDyBkTesVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-12-30  0:44   ` Weird app error: uninitialized fiber (FiberError) 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)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/rainbows/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAA2_N1vcNCgKKr8RQ7QDmsudShHD6g5ONnAhzCxocDyBkTesVg@mail.gmail.com \
    --to=godfat-hoe/xeebyyidnm+yrofe0a@public.gmane.org \
    --cc=godfat-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).