LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > Ruby/Rails > Rack 1.0.1 don't works god with litespeed

Reply
 
Thread Tools Display Modes
  #1  
Old 10-23-2009, 02:52 AM
Grzegorz Derebecki Grzegorz Derebecki is offline
Senior Member
 
Join Date: Jun 2007
Posts: 92
Default Rack 1.0.1 don't works god with litespeed

I have installed rack 1.0.1 gem and it return error on every POST request.

The problem is in rack-1.0.1/lib/rack/handler/lsws.rb :
Code:
19: rack_input = RewindableInput.new($stdin.read.to_s)
in rack 1.0.0 it was something like this:
Code:
rack_input = StringIO.new($stdin.read.to_s)
after this change post request works again but i think lsws should check why it won't works with RewindableInput with is default for other handlers (exemple: fastcgi)

Here is error:

Code:
/!\ FAILSAFE /!\  Fri Oct 23 11:04:07 +0200 2009
  Status: 500 Internal Server Error
  undefined method `read' for #<String:0x47c7b68>
    /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/rewindable_input.rb:83:in `make_rewindable'
    /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/rewindable_input.rb:26:in `read'
    /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/rewindable_input.rb:11:in `method_missing'
    /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/request.rb:134:in `POST'
    /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/methodoverride.rb:15:in `call'
    /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/params_parser.rb:15:in `call'
    /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/rewindable_input.rb:25:in `call'
    /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/session/cookie_store.rb:93:in `call'
    /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/cache/strategy/local_cache.rb:24:in `call'
    /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/failsafe.rb:11:in `call'
    /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call'
    /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `synchronize'
    /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call'
    /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:106:in `call'
    /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/rack/static.rb:31:in `call'
    /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/content_length.rb:13:in `call'
    /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/lsws.rb:34:in `serve'
    /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/lsws.rb:9:in `run'
UPDATE:
RewindableInput class require IO as arg but in lsws.rb it passed $stdin.read.to_s also passing $stdin don't works but if we write

Code:
rack_input = RewindableInput.new StringIO.new($stdin.read.to_s)
All works correct.

Last edited by Grzegorz Derebecki; 10-23-2009 at 03:04 AM..
Reply With Quote
  #2  
Old 10-24-2009, 04:06 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
It is a bad idea to use both RewindableInput and StringIO. StringIO buffer the POST body in memory (in a string, bad for large post). RewindableInput buffer POST body in a temp file, which is very slow. Using both is like getting the worse part from both.

what error message do you get with
rack_input = RewindableInput.new($stdin)

Seems it work in my environment.
Reply With Quote
  #3  
Old 10-26-2009, 03:19 AM
Grzegorz Derebecki Grzegorz Derebecki is offline
Senior Member
 
Join Date: Jun 2007
Posts: 92
For me it don't works well.

exemple on developemnt machine i gets exception:
ActionController::InvalidAuthenticityToken
on production something like no body error

With StringIO all works ok.
Reply With Quote
  #4  
Old 11-04-2009, 03:39 AM
thbar thbar is offline
Member
 
Join Date: Sep 2006
Posts: 33
Default Same issue here ?

Hi!

I'm getting what seems to be the same error here:

Code:
 /var/sites/myapp/releases/20091104111639/vendor/rails/activesupport/lib/active_support/dependencies.rb:105:in `const_missing'
 : 
 uninitialized constant Rack::Handler::LSWS::RewindableInput
  (
 NameError
 )
 	from /usr/local/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/lsws.rb:19:in `serve'
 	from /usr/local/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/lsws.rb:9:in `run'
 	from /usr/local/lsws/fcgi-bin/RailsRunner.rb:60
My setup is:
- ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux]
- rails 2.3.4
- rack 1.0.1
- Ubuntu 8.04.3 LTS
- easy setup from litespeed

Is there anyone facing the same issue currently ? Is there a recommended fix ?

thanks for any hint - if there's anything I can do to help diagnose and fix the issue, please tell me.

cheers,

-- Thibaut
Reply With Quote
  #5  
Old 11-04-2009, 04:39 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,216
how about try rack 1.0.0 instead of 1.0.1?
Reply With Quote
  #6  
Old 11-04-2009, 05:07 AM
Grzegorz Derebecki Grzegorz Derebecki is offline
Senior Member
 
Join Date: Jun 2007
Posts: 92
rack 1.0 works rack 1.0.1 works too after fix that i provided
Reply With Quote
  #7  
Old 11-04-2009, 05:57 AM
thbar thbar is offline
Member
 
Join Date: Sep 2006
Posts: 33
hi,

thanks for the tips! Turns out things seem to work with rack 1.0.0 instead of 1.0.1.

Maybe there is something to investigate for the later releases of Litespeed though - in case the change brought by 1.0.1 becomes the rule.

If it helps, here are the release notes of 1.0.1.

Thanks!
Reply With Quote
  #8  
Old 12-03-2009, 03:38 AM
kule kule is offline
Member
 
Join Date: Oct 2008
Posts: 20
I haven't tried this yet - will be trying shortly though.

Just wanted to mention that the latest version of Rails (2.3.5) has a dependency of Rack 1.0.1 so this will need a fix.

LiteSpeed staff - is the fix suggested by Grzegorz recommended? Or you do you have a better solution?

Kind Regards
Luke
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:19 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.