Skip to content
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

Web Setup Wizard 500 error when session storage is configured to use memcache #9633

Closed
dotsoa opened this issue May 15, 2017 · 13 comments
Closed
Labels
bug report Component: Framework/Cache Component: Setup Event: MMNY17 Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@dotsoa
Copy link

dotsoa commented May 15, 2017

Preconditions

  1. Magento Version: 2.1.6
  2. PHP-FPM - Specific pool is currently using 7.0.17
  3. Apache 2.2.31

Steps to reproduce

  1. Perform a fresh installation of Magento 2.1.6
  2. Switch and configure session storage method to memcache in env.php
  3. Log into admin and navigate to System > Tools > Web Setup Wizard

Expected result

  1. The Setup Wizard page loading successfully

Actual result

  1. Page returns an HTTP ERROR 500. Additionally here is the error from the PHP logs when this occurs:

[15-May-2017 07:22:26 UTC] PHP Fatal error: Uncaught Exception: Warning: SessionHandler::read(): open(unix:///var/tmp/memcached.magetwot.216.mage2test.com_sessions.sock?persistent=1&weight=2&timeout=10&retry_interval=0/sess_cvud2fpo9dbmofdhld3fap3682, O_RDWR) failed: No such file or directory (2) in /chroot/home/magetwot/216.mage2test.com/html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22 in /chroot/home/magetwot/216.mage2test.com/html/vendor/magento/framework/App/ErrorHandler.php:61 Stack trace: #0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'SessionHandler:...', '/chroot/home/ma...', 22, Array) #1 /chroot/home/magetwot/216.mage2test.com/html/vendor/magento/framework/Session/SaveHandler/Native.php(22): SessionHandler->read('cvud2fpo9dbmofd...') #2 /chroot/home/magetwot/216.mage2test.com/html/vendor/magento/framework/Session/SaveHandler.php(93): Magento\Framework\Session\SaveHandler\Native->read('cvud2fpo9dbmofd...') #3 [internal function]: Magento\Framework\Session\SaveHandler->read('cvud2fpo9dbmofd...') #4 in /chroot/home/magetwot/216.mage2test.com/html/vendor/magento/framework/App/ErrorHandler.php on line 61

[15-May-2017 07:22:26 UTC] PHP Fatal error: Uncaught Exception: Warning: SessionHandler::write(): open(unix:///var/tmp/memcached.magetwot.216.mage2test.com_sessions.sock?persistent=1&weight=2&timeout=10&retry_interval=0/sess_cvud2fpo9dbmofdhld3fap3682, O_RDWR) failed: No such file or directory (2) in /chroot/home/magetwot/216.mage2test.com/html/vendor/magento/framework/Session/SaveHandler.php on line 105 in /chroot/home/magetwot/216.mage2test.com/html/vendor/magento/framework/App/ErrorHandler.php:61 Stack trace: #0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'SessionHandler:...', '/chroot/home/ma...', 105, Array) #1 /chroot/home/magetwot/216.mage2test.com/html/vendor/magento/framework/Session/SaveHandler.php(105): SessionHandler->write('cvud2fpo9dbmofd...', '') #2 [internal function]: Magento\Framework\Session\SaveHandler->write('cvud2fpo9dbmofd...', '') #3 {main} thrown in /chroot/home/magetwot/216.mage2test.com/html/vendor/magento/framework/App/ErrorHandler.php on line 61

As the title states. When the session storage method is set to memcache an 500 error happens when navigating to the Web Setup Wizard. With the session method set to files it loads as intended. Based off the error it seems like it's still trying to write/read the session as a file even though magento is configured to use the memcache socket.

I've found as a workaround if i specifically set php_value[session.save_handler] = memcache in the PHP-FPM pool configuration file for this pool then the Setup Wizard page loads successfully. In the past this change has not been needed. Simply configuring memcache in env.php was enough.

@kozmikyak
Copy link

I can verify that the same thing happens (500 error on using the web wizard) with PHP 7.0.18 on Centos 7, and the latest install of Magento (from 2 days ago) in mod_php mode.

@digitalredefned
Copy link

I'm having the same issue as well on 2.1.7.

@TomashKhamlai
Copy link
Contributor

Hello and thank you for your submission! Internal ticket MAGETWO-70986 was created to address this issue.

@veloraven veloraven added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Jul 25, 2017
@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Component: Framework/Cache Component: Setup Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed G1 Passed labels Sep 5, 2017
@magento-engcom-team magento-engcom-team added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed and removed 2.1.x labels Oct 3, 2017
@magento-engcom-team
Copy link
Contributor

@dotsoa, thank you for your report.
We've created internal ticket(s) MAGETWO-70986 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.1.x Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release labels Oct 3, 2017
@magento-engcom-team magento-engcom-team added the Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release label Oct 3, 2017
@ghost
Copy link

ghost commented Oct 16, 2017

Working on this for #squashtoberfest !

Though so far it seems that the setup wizard just never sets the session.save_handler value at all and doesn't include memcache as an option anywhere.

So what happens is it defaults to files but still uses the path and the tcp://... isn't a file.

@okorshenko
Copy link
Contributor

Hi @sylink could you please accept the invitation to join magento2 repository on the GitHub?

@okorshenko okorshenko assigned ghost Oct 16, 2017
@ghost
Copy link

ghost commented Oct 16, 2017

No solution at the moment, we see the admin/setup and the frontend both set the save_handler differently and not explicitly? So a simple fix if you force the init_set but the code side appears to be a lot more complex than expected.

@ghost
Copy link

ghost commented Oct 21, 2017

The issue is somewhere in the config where it gets the IniOptions in SessionManager.php , line 579

*/ private function initIniOptions() { foreach ($this->sessionConfig->getOptions() as $option => $value) { $result = ini_set($option, $value); if ($result === false) { $error = error_get_last(); throw new \InvalidArgumentException( sprintf('Failed to set ini option "%s" to value "%s". %s', $option, $value, $error['message']) ); } }

A manual ini_set for memcache before the foreach allows setup to work with memcache, as in other locations, but only 7 values are set in that loop and none are session.save_handler

This leads me to Session/Config.php which gets these options but has no code to get the handler, so I think it needs added there ?

All in vendor/magento/framework/Session

@ghost
Copy link

ghost commented Oct 21, 2017

Add this to constructor for vendor/magento/framework/Session/Config.php
, say line 137 or so:

$saveHandler=$deploymentConfig->get(self::PARAM_SESSION_SAVE_METHOD);
		if ($saveHandler) {
			$this->setOption('session.save_handler', $saveHandler);
		}

It looks like in that file this constant is set -

const PARAM_SESSION_SAVE_METHOD = 'session/save';

Then never utilized at all, so I added the block to grab the value from the deployment config. If that is blank it should default to files as expected.

@sivajik34
Copy link
Contributor

@okorshenko
Copy link
Contributor

@dotsoa
The issue has been fixed and delivered in 2.2-develop branch. Will be available with upcoming patch release.

@okorshenko okorshenko added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Dec 4, 2017
@AlexisEvo
Copy link

@sivajik34 This is a separate problem which is unrelated to this issue. Please see #12742

@magento-engcom-team
Copy link
Contributor

Hi @dotsoa. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1296 by @magento-engcom-team in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming patch release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Jan 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Framework/Cache Component: Setup Event: MMNY17 Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

9 participants