This project is archived and is in readonly mode.
Memcache session store + litespeed (and i think passenger)
-
jerrett
Ooops, link got mangled... Mod rails memcache conncetion sharing harmful
-
jerrett
If there was a way to access the instance of Memcache used by the session store, this would be even easier to fix and could probably even be fixed by default by servers like litespeed and passenger... perhaps I missed something, but I couldn't find a way to access the Memcache instance
-
Jon Jensen
Yeah, confirmed this happens in passenger as well (rails 2.3.2 in my case). When you use the same memcache object for sessions and cache-money, not only do you get the fun session hijacking behavior described above, you also see stuff like Apple.find(123) => #<Orange:0x0000face>
-
Aaron Gibralter
Anyone know if this is changing in Rails 3?
-
Aaron Gibralter
- Tag set to mem_cache_store
Yup... still seems like it's there: http://github.com/rails/rails/blob/master/actionpack/lib/action_dis...
-
Aaron Gibralter
Hmm well now it doesn't seem like it's a Rails 3.0.x issue anymore; however, it's definitely still in Rails 2.3.x.
As for 3.0.x, the relevant code has been moved into Rack::Session::Memcache (http://github.com/rack/rack/blob/master/lib/rack/session/memcache.r....
There is still the problem that the session store opens a connection to memcached during the app initialization, thus causing problems for servers (like Passenger and Thin) that fork off copies of the app.
-
Rohit Arondekar
- State changed from new to open
- Milestone changed from 3.x to 2.x
- Importance changed from to Low
Can you write a patch with tests to solve this issue? Or try and debug it further? That would be super helpful! Also thanks for the quick reply! :)
-
Aaron Gibralter
... Well is it desirable to check for the memcache servers during intialization? Or would it be ok for Rails to raise an exception on the first app request that tries to connect to memcache for session storage and fails? Alternatively, Rails could check that the servers are there but then temporarily close the connections until they're needed:
@pool.servers.any? { |s| s.alive? && s.close }But I'm wondering... maybe Rails should stop supporting MemCacheStore out-of-the box... I understand CookieStore and ActiveRecordStore as default options because they're based entirely within Rails. But there are so many other stores out there and Ruby gems that support them; e.g.:
http://github.com/mperham/dalli
http://github.com/jodosha/redis-storePerhaps MemCacheStore should just be deprecated in favor of dalli?
-
Rohit Arondekar
Aaron, there is already a ticket open regarding dalli. Could you please review the patch and give feedback here: #5588 Integrate support for Dalli
-
Ryan Bigg
Automatic cleanup of spam.
-
Aaron Gibralter
Rohit, it doesn't seem like Mike's patch addresses the session store... I updated that ticket though to raise the possibility.
I think that if they do decide to use Dalli for a session store, they should make sure that this ticket's issue is addressed. I also think that in 3.x, the Rails built in memcache session store should be deprecated... I'm not really sure what to do about 2.3.x though...
-
Santiago Pastorino
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino
- State changed from open to stale
-
Aaron Gibralter
This has been moved into Rack::Session::Memcache: https://github.com/rack/rack/blob/master/lib/rack/session/memcache....
I think we can close it for Rails. I'll re-open on Rack's github issues page.