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

Go Back   LiteSpeed Support Forums > External Applications > Ruby/Rails > LSAPI Session Problem...

Reply
 
Thread Tools Display Modes
  #1  
Old 09-19-2006, 05:30 AM
hugemikeyd hugemikeyd is offline
Member
 
Join Date: Mar 2006
Location: New York
Posts: 42
Default LSAPI Session Problem...

I am seeing an issue with the way LSAPI handles sessions in that it doesn't. On my site, i keep track of how many sessions have been updated in the last hour and i just see the count going up and up while i browse. It looks like the session is being recreated for every HTTP request just like when my cookies are disabled, it's just that my cookies are not disabled so i am not quite sure what is going on. I would really like to solve this b/c LSAPI is blazing fast over FCGI and i would prefer not to switch back

Thanks,

.: Michael :.
Reply With Quote
  #2  
Old 09-19-2006, 06:32 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
What kind of session storage are you using? Maybe there is a permission problem if file based session storage is used.

Can you please check the cookie value with Firefox LiveHeader, see if the value changes for every request?

Thanks.
Reply With Quote
  #3  
Old 09-19-2006, 06:47 AM
hugemikeyd hugemikeyd is offline
Member
 
Join Date: Mar 2006
Location: New York
Posts: 42
I'm using ActiveRecord to store my sessions, so no permission problems there.
Using LiveHTTPHeaders i was able to see that with LSAPI every request has a different session_id value for the session cookie whereas with FCGI the value remains the same for all requests.
Reply With Quote
  #4  
Old 09-19-2006, 06:54 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
ActiveRecord will store the session data into a backend DB, doesn't it?

Is there anything suspicious in the development.log if you start the app in development mode?
Reply With Quote
  #5  
Old 09-19-2006, 08:17 AM
hugemikeyd hugemikeyd is offline
Member
 
Join Date: Mar 2006
Location: New York
Posts: 42
Yes it does store in the DB, but there is a session cookie (_session_id) that is used to pair a user with their session in the DB. This cookie is not retaining the same value.

As for the logs i see this after every request which includes getting an image:

Processing Base#index (for xx.xx.xx.xx at 2006-09-19 06:43:08) [GET]
Session ID: 9d94c76ea32e9528df85f93be746901a
Parameters: {}

Processing Base#index (for xx.xx.xx.xx at 2006-09-19 06:43:08) [GET]
Session ID: 19904bfcbcb072e484cc29f46f604c1c
Parameters: {}

Processing Base#index (for xx.xx.xx.xx at 2006-09-19 06:43:08) [GET]
Session ID: 4cbfcc8fa23ff84172109a479a55cd99
Parameters: {}

I am getting error messages regarding that the images the server is trying to get do not actually exist, but that's b/c in Dev i have a seperate dir for images and i don't care if they show up or not in Dev. This has no effect on FCGI
Reply With Quote
  #6  
Old 09-19-2006, 10:35 AM
xing xing is offline
LiteSpeed Staff
 
Join Date: Oct 2003
Location: Los Angeles, California
Posts: 380
Mike,

Please Use live header extension to not only check the "response" headers which include new sesssion cookies but check also "sending" headers from the browser to see if the browser actually stored the cookies and sending it back to your app.

On the first request in question the browser should receive a session cookie. Subsequently the browser should then send to the server the same cookie/value for each following request. If the browser is sending back the session cookie but your app is sending back the a new and different session cookie, then we can confirm that the app is not reading the cookie correctly and isolate the problem.
Reply With Quote
  #7  
Old 09-19-2006, 11:40 AM
hugemikeyd hugemikeyd is offline
Member
 
Join Date: Mar 2006
Location: New York
Posts: 42
This is strange, it appears to be working for me just fine in windows maybe there is an issue with my firefox in linux? Maybe i was even stupid enough to disable cookies and not know it?

Either way i feel stupid, sorry

My site is now using LSAPI and it's blazing fast as well as keeping track of sessions without issue.

Thanks for the support!
Reply With Quote
  #8  
Old 09-19-2006, 02:04 PM
hugemikeyd hugemikeyd is offline
Member
 
Join Date: Mar 2006
Location: New York
Posts: 42
I noticed something new, this seems to only apply to the Development environment. I have the Rails tab setup to be Production, but in my Virtual Host i have it set to Development and it does not seem to be working. I think the issue is that Rails is unaware as to what environment to use, but Production seems to work.

I think there may be an issue with the Environment setting. I made a change to one of my layouts to test at it affected Production, which should NOT happen.
Reply With Quote
  #9  
Old 09-19-2006, 08:56 PM
hugemikeyd hugemikeyd is offline
Member
 
Join Date: Mar 2006
Location: New York
Posts: 42
I got the sessions to work better buy uninstalling the ruby-lsapi gem and then installing rather than just upgrading.

I still think there is a problem with the RAILS_ENV setting, i am unable to print the value of it from within my website using:

<%= ENV['RAILS_ENV'] %>

but i can if i use:

<%= RAILS_ENV %>

with FCGI i can use either one, here is what i get for LSAPI (i removed the cookies) when i print ENV:

SERVER_NAME: stage.domain.com
HTTP_X_PROTOTYPE_VERSION: 1.5.0_rc0
HTTP_USER_AGENT: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.3) Gecko/20060523 Ubuntu/dapper Firefox/1.5.0.3
CONTENT_LENGTH: "0"
HTTP_ACCEPT_ENCODING: gzip,deflate
SERVER_PROTOCOL: HTTP/1.1
SCRIPT_NAME: /dispatch.lsapi
SERVER_ADDR: xx.xx.xx.xx
HTTP_CACHE_CONTROL: no-cache
HTTP_HOST: stage.domain.com
HTTP_ACCEPT_LANGUAGE: en-us,en;q=0.5
SERVER_SOFTWARE: LiteSpeed
REMOTE_ADDR: xx.xx.xx.xx
CONTENT_TYPE: HTTP_ACCEPT_CHARSET: ISO-8859-1,utf-8;q=0.7,*;q=0.7 REQUEST_URI: /someurl
DOCUMENT_ROOT: /docroot
HTTP_KEEPALIVE: "300"
RAW_POST_DATA: ""
SERVER_PORT: "80"
QUERY_STRING: ""
REMOTE_PORT: "60557"
HTTP_PRAGMA: no-cache
HTTP_ACCEPT: text/javascript, text/html, application/xml, text/xml, */*
PATH: /bin:/usr/bin
REQUEST_METHOD: POST
HTTP_X_REQUESTED_WITH: XMLHttpRequest
HTTP_CONNECTION: close

With FCGI:

--- !ruby/object {}

So something is going on here...

Last edited by hugemikeyd; 09-19-2006 at 09:03 PM..
Reply With Quote
  #10  
Old 09-19-2006, 09:17 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
ENV['RAILS_ENV'] has been unset in LSAPI after the initialization. RAILS_ENV should be used whenever you need to reference it.

You can change ext/lsapi/lsruby.c to let LSAPI keep that environment variable.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Setup for Rails via Litespeed Ruby LSAPI Justin Ruby/Rails 2 12-08-2007 07:19 PM
Ruby LSAPI 2.4 and PHP LSAPI 3.1 released mistwang News 0 04-24-2007 03:35 PM
LSAPI Ruby v1.12, PHP v2.4 Released mistwang News 0 01-10-2007 01:18 PM
LSWS Ruby LSAPI zoom Install/Configuration 2 05-14-2006 04:50 PM
Problem with LSAPI 1.8/PHP in 2.1.11? jburks725 Install/Configuration 3 02-16-2006 06:48 PM


All times are GMT -7. The time now is 08:40 PM.



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