Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruby server demo from website crashes. #25

Closed
ssoroka opened this issue Aug 27, 2010 · 12 comments
Closed

ruby server demo from website crashes. #25

ssoroka opened this issue Aug 27, 2010 · 12 comments

Comments

@ssoroka
Copy link

ssoroka commented Aug 27, 2010

Copying the demo from the website, I have:

require 'faye'
faye_server = Faye::RackAdapter.new(:mount => '/faye', :timeout => 45)
run faye_server

then I copy the client demo and run it, but the server dies with:

Rack::Lint::LintError: Status must be >=100 seen as integer
/Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/rack-1.2.1/lib/rack/lint.rb:19:in assert' /Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/rack-1.2.1/lib/rack/lint.rb:425:incheck_status'
/Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/rack-1.2.1/lib/rack/lint.rb:50:in _call' /Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/rack-1.2.1/lib/rack/lint.rb:36:incall'
/Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/rack-1.2.1/lib/rack/showexceptions.rb:24:in call' /Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/rack-1.2.1/lib/rack/commonlogger.rb:18:incall'
/Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/rack-1.2.1/lib/rack/content_length.rb:13:in call' /Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/rack-1.2.1/lib/rack/chunked.rb:15:incall'
/Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/thin-1.2.7/lib/thin/connection.rb:76:in pre_process' /Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/thin-1.2.7/lib/thin/connection.rb:74:incatch'
/Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/thin-1.2.7/lib/thin/connection.rb:74:in pre_process' /Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/thin-1.2.7/lib/thin/connection.rb:57:inprocess'
/Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/faye-0.5.2/lib/thin_extensions.rb:44:in receive_data' /Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:inrun_machine'
/Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in run' /Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/thin-1.2.7/lib/thin/backends/base.rb:57:instart'
/Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/thin-1.2.7/lib/thin/server.rb:156:in start' /Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/rack-1.2.1/lib/rack/handler/thin.rb:14:inrun'
/Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/rack-1.2.1/lib/rack/server.rb:213:in start' /Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/rack-1.2.1/lib/rack/server.rb:100:instart'
/Users/steven/.rvm/gems/ree-1.8.7-2010.02/gems/rack-1.2.1/bin/rackup:4
/Users/steven/.rvm/gems/ree-1.8.7-2010.02/bin/rackup:19:in `load'
/Users/steven/.rvm/gems/ree-1.8.7-2010.02/bin/rackup:19
127.0.0.1 - - [27/Aug/2010 13:22:17] "POST /faye HTTP/1.1" 500 62371 0.0206

@jcoglan
Copy link
Collaborator

jcoglan commented Aug 27, 2010

That's because Rack's development middleware doesn't work with Thin async responses. You can run your app in production mode to prune out the Lint middleware:

rackup -s thin -E production config.ru

Maybe I need to make this more prominent on the website; you're not the first person to report this problem.

@ssoroka
Copy link
Author

ssoroka commented Aug 27, 2010

Good to know. I actually was using -E production .. I wasn't seeing any output, so I switched to development thinking it'd log the errors. If those errors aren't related, I'll have to figure out why it wasn't working...

@ssoroka
Copy link
Author

ssoroka commented Aug 27, 2010

seems to be working now. I must have made a simple mistake.

@KieranP
Copy link

KieranP commented Jun 27, 2011

OH! Please!! I spent hours trying to track this down. :-( Please kill the server with a meaningful error if it doesn't work in development.

e.g.

raise NotSupported.new("Please run in production mode") if RACK_ENV != 'production'

@jcoglan
Copy link
Collaborator

jcoglan commented Jul 3, 2011

The issue is really the the middleware that Rack uses in development mode happens not to understand Thin async responses. To make this really robust you would need to detect the presence of such middlewares higher up the stack, since the user may add them manually even if Rack does not. Just checking for production environment is too removed from the real problem to be of use.

This is the sort of thing that is best worked around with clear documentation -- does the website need clarifying?

@axyjo
Copy link

axyjo commented Jul 7, 2011

I just ran into this again, please do document this on the website stating that even in development, production mode should (rather, must) be used.

@jcoglan
Copy link
Collaborator

jcoglan commented Jul 7, 2011

It's here in the docs: http://faye.jcoglan.com/ruby.html. Where else should I put it so this stops happening?

@axyjo
Copy link

axyjo commented Jul 7, 2011

I see that the command:

rackup config.ru -s thin -E production

is present in the documentation. However, I assumed that the environment option was merely to be used in deployment, so I omitted that on my development machine. I think that the fact that it must be run in production mode even on development machines should be documented. Thanks!

@andrewhavens
Copy link

What am I supposed to do if I am mounting the Faye::RackAdapter as part of my Sinatra application? I can't run my application in production mode when it's supposed to be running in development.

@jcoglan
Copy link
Collaborator

jcoglan commented May 26, 2012

@andrewhavens Run that app using thin start -R config.ru. This will not add the Rack development middlewares that cause async requests to fail.

@mattconnolly
Copy link

I looked in that above linked documentation page. Then I came across the error, then this thread. There is no mention of "production", "development" nor "environment" in that docs page in its current version.

@jcoglan
Copy link
Collaborator

jcoglan commented Nov 17, 2013

@mattconnolly The docs link to this page that explains how to run Faye with various different web servers. This thread dates from a time when we only supported Thin.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants