Skip to content

Save session to redis error when configured on php level (Exception' with message 'Warning: SessionHandler::read()) #1735

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

Closed
biotech opened this issue Aug 24, 2015 · 7 comments
Labels
Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@biotech
Copy link

biotech commented Aug 24, 2015

If php configured to save session on Redis instead of files - error below appear during the installation process. I use PHP 5.6 and https://github.com/phpredis/phpredis for store session in Redis, after change storage to files - everything works well. It looks like Magento not check if php session storage configured as files and trying to write sessions there. In my case this pretty confusing because i have configured like that

session.save_handler = redis
session.save_path = "/tmp/redis.sock"

So save_patch in that case it's location of Redis socket and Magento trying to write sessions just around that which is for sure cause error. This can cause issue with any other session storage like Memcached etc. I suppose Magento should check session storage type during the installation before write there and maybe support Redis and Memcached by default or if it's not possible (?) - recommend set files as save_handler in php.

nbhjxzx4ogqs3pz9pvs2vpzwbwtecl5cx0pcgh8hfxo

Installing user configuration...
[ERROR] exception 'Exception' with message 'Warning: SessionHandler::read(): open(/tmp/php-sessions/sess_sbiru6o2s28e3b0gq6v6hhlp83, O_RDWR) failed: No such file or directory (2) in /var/www/magento2demo.firebearstudio.com/magento2/lib/internal/Magento/Framework/Session/SaveHandler.php on line 74' in /var/www/magento2demo.firebearstudio.com/magento2/lib/internal/Magento/Framework/App/ErrorHandler.php:67
Stack trace: #0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'SessionHandler:...', '/var/www/magent...', 74, Array)
#1 /var/www/magento2demo.firebearstudio.com/magento2/lib/internal/Magento/Framework/Session/SaveHandler.php(74): SessionHandler->read('sbiru6o2s28e3b0...')
#2 [internal function]: Magento\Framework\Session\SaveHandler->read('sbiru6o2s28e3b0...')
#3 /var/www/magento2demo.firebearstudio.com/magento2/lib/internal/Magento/Framework/Session/SessionManager.php(189): session_start()

biotech added a commit to biotech/devdocs that referenced this issue Aug 24, 2015
All details on files, also issue created for discuss that magento/magento2#1735 , but this is huge change which will take some time to resolve and issue could be common problem for users who configure session storage at redis or memcached
@vpelipenko vpelipenko added the PS label Aug 25, 2015
@mazhalai
Copy link
Contributor

@biotech thank you for reporting this error, we have created MAGETWO-42059 to track a fix for this.

@mazhalai mazhalai added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Aug 25, 2015
@piotrekkaminski
Copy link
Contributor

This was fixed and should be published soon.

@biotech
Copy link
Author

biotech commented Oct 10, 2015

Great job thanks !

@magenx
Copy link

magenx commented Dec 18, 2016

in fact this error is still there

@siliconalchemy
Copy link

+1 still an issue

magento-team pushed a commit that referenced this issue Nov 20, 2017
@AndreiAghenii
Copy link

Hello, I believe it is still an issue...
Processing configurations data from configuration file...
Import failed: Warning: SessionHandler::read(): open(${WEB_ROOT}/var/session/sess_cnkdti2mv2r35qc34n5qq2u5q6, O_RDWR) failed: No such file or directory (2) in /var/www/html/Magento2/vendor/magento/framework/Session/SaveHandler/Native.php on line 22
PHP Fatal error: Uncaught Exception: Warning: SessionHandler::write(): open(${WEB_ROOT}/var/session/sess_cnkdti2mv2r35qc34n5qq2u5q6, O_RDWR) failed: No such file or directory (2) in /var/www/html/Magento2/vendor/magento/framework/Session/SaveHandler.php on line 105 in /var/www/html/Magento2/vendor/magento/framework/App/ErrorHandler.php:61
Stack trace:
#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'SessionHandler:...', '/var/www/html/s...', 105, Array)
#1 /var/www/html/Magento2/vendor/magento/framework/Session/SaveHandler.php(105): SessionHandler->write('cnkdti2mv2r35qc...', '')
#2 [internal function]: Magento\Framework\Session\SaveHandler->write('cnkdti2mv2r35qc...', '')
#3 {main}
thrown in /var/www/html/Magento2/vendor/magento/framework/App/ErrorHandler.php on line 61
Any help would be appreciated.

@AndreiAghenii
Copy link

Hey Guys, I fixed this issue, by providing correct path in php.ini:

'session' =>
array (
'save' => 'files',
'save_path' => '/var/www/session', ** if directory does not exist please create one.**
),

Hope this helps someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests

7 participants