ruby-on-rails – 会话存储在memcached(Rails)中时,用户可以访问其他用户的会话

在Memcached存储我的会话时,我有一个非常奇怪的问题.有些用户会不时地进行其他用户的会话.例如.约翰,以玛丽亚,克里斯等人身份登录.

我使用Rails 2.3.4,但早期版本的Rails也发生了同样的问题.我只使用一个Memcache服务器,它在同一台机器上运行.调试这个问题是我无法重现它.

如果有人能指导我如何解决这个问题或调试它,我会很高兴的.如果您正在使用Memcached进行会话,并且分享您的示例配置,我也会很高兴.

这些是我的配置:

# memcache options
memcache_options = {
  :c_threshold => 10_000,:compression => false,:debug => false,:namespace => 'app_prod',:readonly => false,:urlencode => false,}
memcache_servers = ['localhost:11211']

CACHE = MemCache.new(memcache_options)
CACHE.servers = memcache_servers

config.cache_store = :mem_cache_store,memcache_servers,memcache_options
config.action_controller.session_store = :mem_cache_store
config.action_controller.session = {
  :session_key => '_appname',:cache => CACHE,#    :expires => 10,#    :session_expires => 10,:secret      => '5391aaaaaaaaaa56f8e8234beb638b97b32bbbbbbbbbbcc9dcae2beccccccccc89e8b508328def001a368da0678b061eb0e9d5a82a5ac94c8d35bd31a9a49e1'
}

先谢谢你,
斯坦

解决方法

我已经看到这一点,发现调试非常困难.

如果您正在使用乘客,您可能需要使用保守的方法来产生新的服务器.

默认方法具有共享单个套接字到内存缓存的服务器.

文档更详细地讨论.
http://www.modrails.com/documentation/Users%20guide%20Apache.html#_example_1_memcached_connection_sharing_harmful

相关文章

前言设计一个缓存系统,不得不要考虑的问题就是:缓存穿透、...
在192.168.80.100要联网关闭防火墙及SElinuxsystemctlstopfi...
Redis与Memcache对比:1.Memcache是一个分布式的内存对象缓存...
安装Mencache:关闭防火墙及SElinuxsystemctl  stop  fi...
#安装php的yaf模块,参考https://www.cnblogs.com/shifu204/...
win10下安装配置apache、php、mysql、redis、memcache资源官...