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
Redis based session for HHVM #2177
Comments
Here are my hhvm details: HipHop VM 3.0.0-dev+2014.03.21 (rel) |
@ptarjan Is this unsupported feature? If yes, is any other session store supported? |
@jmarrama is our local session expert |
This could be related to #1883 - to confirm, try setting those values in code via ini_set() after you have called something in the sessions module. |
@jmarrama Thanks! I shall try this. |
I've tested this extensively today with 2.4 and then 3.0.1. I can't get memcached or redis sessions to work at all. I started by configuring php.ini and adding session.save_handler = redis
session.save_path = "tcp://localhost:6379" or session.save_handler = memcache
session.save_path = "tcp://localhost:11211" With 2.4 and redis I got this error:
With 3.0.1 I get these in both cases (redis and memcached), so looks like my settings from php.ini are not read at all:
Then I tried doing the settings in my php file: ini_set('session.save_handler', 'memcache');
ini_set('session.save_path', 'tcp://127.0.0.1:11211'); would give
And redis: ini_set('session.save_handler', 'redis');
ini_set('session.save_path', 'tcp://localhost:6379'); result:
I'm using Ubuntu 12.04 and Nginx 1.5.12. With HHVM 2.4 I used hhvm-fastcgi. |
Having the same issue. Ubuntu 12.04 HHVM 3.0.1 |
#2075 still an issue for me as well. However using file based sessions. |
@craigcarnell if this is an issue with file based sessions, are using sessions currently possible with hhvm? What is the default save path if any? |
@craigcarnell @scragg0x File based sessions are working well for me right now. I hope that by the time we port our application to HHVM in my company, redis based sessions would be available. To make it work, you shall set session settings using ini_set. |
I think I will test this soon in our environment, as we plan to migrate to HHVM 2.4 or 3.0 soon. Some half a year ago, when we moved our production environment to hacked HHVM 2.2.0, Redis-based sessions were the only ones working without problems (see #1234 ). |
Currently default (file-based) sessions are not working for me either. I have nothing configured for sessions in php.ini or in the php file when starting the session. I get these errors:
I only have these two lines in my php-file to start the session: ini_set('session.hash_function', 'whirlpool');
session_start(); |
Try to remove ini_set('session.hash_function', 'whirlpool'); whirlpool has a large digest size. I think the default is sha1 |
Here is a work around I made until a proper fix is released. |
The default path I really hope the memcache/redis issue can be resolved soon. Also, is the garbage collector not supposed to clean old session files? Is there anyone else facing garbage collector issues? |
I created a separate issue #2289 for file based sessions so they don't get mixed up with the redis issue, but I think they might be related. |
@scragg0x I tried removing it, changing to md5 or sha1 but same error always. I tried accessing the page through different machines and I found it weird that every machine / browser gave error about same sess_number. Could this have something to do with nginx caching? I use sessions for a custom login on a wordpress site and I have enabled nginx caching there. Or can this be about hhvm caching? I understood that hhvm doesn't always compile the php-file if it thinks there are no changes, or am I wrong? I tried your workaround and it works. I monitored redis for a while and I can see GET, SETEX and DEL for PHPREDIS_SESSION when user logs in, browses and logs out. So thank you! |
Good, this might also work too, it's smaller, I haven't tested though. What do you have fastcgi_ignore_headers in nginx set to? |
The shorter workaround code works too, so currently HHVM code does not properly set the save_path. I have
|
Try removing Set-Cookie |
Removed it and restarted nginx and hhvm. Still errors from different hosts are about same sess_number. If I use Redis and monitor it the session numbers are different for different users so there's no actual problem. To begin with we shouldn't get any errors about sessions not working (even file-based), so I hope all should be fine when this issue is fixed. |
Justed tested with the following code (which works in HHVM 2.2.0): <?php
session_name('PHPSESSID');
ini_set('session.save_handler', 'redis');
ini_set('session.save_path', 'localhost:6379');
ini_set('session.gc_maxlifetime', 1440);
session_start(); Doesn't work with 3.0.1, but already fixed in master. |
Trying with the latest master ( e084186 ), save_path still does not work for me on Redis (unlike @kristapsk ). I get:
Without the tcp:// I get an additional error saying However, @scragg0x's short solution works fine. |
I too am using scragg0x's solution, after fighting with it for days. Bizarrely, i can't connect to redis with phpRedisAdmin either, so it looks like it could be an issue with the redis extension IMO |
I can connect to redis just fine using cache (magento) but not with sessions |
What is the content of your local.xml? Make sure you are not using persistent connections, I had problems with that before. |
|
Try using gzip compression also, I've heard there were some issues with the other ones. |
Thanks @danslo but compression is disabled with compression_threshold. I'll try it again tomorrow |
any news on this? |
I fixed this, please let me know the required steps in order to become a contributor and submit pull requests. |
@lbogdan this sounds great. Please read the section "Contributing" here https://github.com/facebook/hhvm . |
@sinaa Unfortunately I don't have a printer / scanner handy for the moment. Is there some other way? |
@lbogdan No facebook account either? You can do it online if you have one. |
@lbogdan Just go here and Agree: https://code.facebook.com/cla |
Dumb me, I only clicked on the "pdf" link. 😒 Is there a tag / branch I should base my pull request on, or master should be just fine? |
Master is best. |
Hi,
I was trying to configure Redis based session store for HHVM and made following changes to php.ini for HHVM.
session.save_handler = redis
session.save_path = "tcp://localhost:6379"
However, this is not working. Am I doing anything wrong here?
It is throwing error like
\nFatal error: Failed to initialize storage module: user (path: )
Thanks,
Vaibhav
The text was updated successfully, but these errors were encountered: