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

session_start(): Failed to read session data: user (path: /var/lib/php/sessions) #17310

Open
AykutCevik opened this issue Aug 1, 2018 · 61 comments
Labels
Area: Framework Component: Framework/Session 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 Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: ready for dev Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. Triage: Done Has been reviewed and prioritized during Triage with Product Managers

Comments

@AykutCevik
Copy link

AykutCevik commented Aug 1, 2018

While viewing the orders page in the admin area and opening several orders I'm facing an error message.

Preconditions

  1. PHP 7.1.17-1
  2. Redis server v=3.0.6
  3. set redis as the session handler in env.php
    3.1 see session config:
`'session' => [
        'save' => 'redis',
        'redis' => [
            'host' => '<IP>',
            'port' => '<PORT>',
            'password' => '',
            'timeout' => '2.5',
            'persistent_identifier' => '',
            'database' => '0',
            'compression_threshold' => '2048',
            'compression_library' => 'gzip',
            'log_level' => '1',
            'max_concurrency' => '6',
            'break_after_frontend' => '5',
            'break_after_adminhtml' => '30',
            'first_lifetime' => '600',
            'bot_first_lifetime' => '60',
            'bot_lifetime' => '7200',
            'disable_locking' => '0',
            'min_lifetime' => '60',
            'max_lifetime' => '2592000'
        ]
    ],`
  1. have orders in your system

Steps to reproduce

  1. Browse the order pages in the admin area
  2. click on an order
  3. go back to the order list
  4. click on an other order again
  5. retry several times
  6. see error message in the admin area:
    image

Expected result

  1. Browsing pages in the admin area shouldn't throw an error

Actual result

Message in step 6 of reproduction appears, in the log I can find the following:

{"0":"Warning: session_start(): Failed to read session data: user (path: /var/lib/php/sessions) in /vendor/magento/framework/Session/SessionManager.php on line 193","1":"#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'session_start()...', '/home/cloudpane...', 193, Array)\n#1 /vendor/magento/framework/Session/SessionManager.php(193): session_start()\n#2 /generated/code/Magento/Backend/Model/Session/Interceptor.php(63): Magento\Framework\Session\SessionManager->start()\n#3 /vendor/magento/framework/Session/SessionManager.php(130): Magento\Backend\Model\Session\Interceptor->start()\n#4 /generated/code/Magento/Backend/Model/Session/Interceptor.php(14): Magento\Framework\Session\SessionManager->__construct(Object(Magento\Framework\App\Request\Http), Object(Magento\Framework\Session\SidResolver\Proxy), Object(Magento\Backend\Model\Session\AdminConfig), Object(Magento\Framework\Session\SaveHandler), Object(Magento\Framework\Session\Validator), Object(Magento\Framework\Session\Storage), Object(Magento\Framework\Stdlib\Cookie\PhpCookieManager), Object(Magento\Framework\Stdlib\Cookie\CookieMetadataFactory), Object(Magento\Framework\App\State))\n#5 /vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(111): Magento\Backend\Model\Session\Interceptor->__construct(Object(Magento\Framework\App\Request\Http), Object(Magento\Framework\Session\SidResolver\Proxy), Object(Magento\Backend\Model\Session\AdminConfig), Object(Magento\Framework\Session\SaveHandler), Object(Magento\Framework\Session\Validator), Object(Magento\Framework\Session\Storage), Object(Magento\Framework\Stdlib\Cookie\PhpCookieManager), Object(Magento\Framework\Stdlib\Cookie\CookieMetadataFactory), Object(Magento\Framework\App\State))\n#6 /vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(66): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Backend...', Array)\n#7 /vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Backend...')\n#8 /vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(144): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Backend...')\n#9 /vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(230): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\\Framewo...', NULL, 'session', 'Magento\\Store\\A...')\n#10 /vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Magento\\Store\\A...', Array, Array)\n#11 /vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\\Store\\A...', Array, Array)\n#12 /vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Store\\A...')\n#13 /vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(144): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Store\\A...')\n#14 /vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(230): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\\Framewo...', NULL, 'redirect', 'Magento\\Backend...')\n#15 /vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Magento\\Backend...', Array, Array)\n#16 /vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\\Backend...', Array, Array)\n#17 /vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Backend...')\n#18 /vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(144): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Backend...')\n#19 /vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(230): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\\Backend...', NULL, 'context', 'Magento\\Ui\\Cont...')\n#20 /vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Magento\\Ui\\Cont...', Array, Array)\n#21 /vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\\Ui\\Cont...', Array, Array)\n#22 /vendor/magento/framework/ObjectManager/ObjectManager.php(56): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Ui\\Cont...', Array)\n#23 /vendor/magento/framework/App/ActionFactory.php(40): Magento\Framework\ObjectManager\ObjectManager->create('Magento\\Ui\\Cont...')\n#24 /vendor/magento/framework/App/Router/Base.php(297): Magento\Framework\App\ActionFactory->create('Magento\\Ui\\Cont...')\n#25 /vendor/magento/framework/App/Router/Base.php(158): Magento\Framework\App\Router\Base->matchAction(Object(Magento\Framework\App\Request\Http), Array)\n#26 /vendor/magento/framework/App/FrontController.php(50): Magento\Framework\App\Router\Base->match(Object(Magento\Framework\App\Request\Http))\n#27 /vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))\n#28 /vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)\n#29 /vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n#30 /generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)\n#31 /vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n#32 /generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()\n#33 /vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http\Interceptor->launch()\n#34 /pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))\n#35 {main}","url":"/admin/mui/index/render/key/[MASKED]/order_id/[MASKED]]?namespace=payone_sales_order_view_transactionstatus_grid&sorting%5Bfield%5D=sequencenumber&sorting%5Bdirection%5D=asc&isAjax=true","script_name":"/index.php"}

The path /var/lib/php/sessions was never set anywhere. I actually can't understand why Magento is trying to use the path when redis is configured. It may be related to SessionManager->registerSaveHandler()?

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Aug 1, 2018
@magento-engcom-team
Copy link
Contributor

Hi @AykutCevik. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me {$VERSION} instance

where {$VERSION} is version tags (starting from 2.2.0+) or develop branches (2.2-develop +).
For more details, please, review the Magento Contributor Assistant documentation.

@AykutCevik do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@engcom-backlog-nickolas engcom-backlog-nickolas added the Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed label Aug 2, 2018
@engcom-backlog-nickolas
Copy link

Hello @AykutCevik, thank you for your report. I'm not able to reproduce this issue on 2.2-develop branch. Could you please specify magento version you use?

@ananth-iyer
Copy link
Member

@AykutCevik Can you tell us which link you followed to install Redis?

@AykutCevik
Copy link
Author

AykutCevik commented Aug 2, 2018

@engcom-backlog-nickolas I'm using Magento CE 2.2.5.
@ananth-iyer what do you mean by link and following it to install Redis?

@ananth-iyer
Copy link
Member

Yes, the website you followed to install Redis.

@josephmcdermott
Copy link
Contributor

Agree with @AykutCevik we have this appearing in var/report every now and then, its very difficult to track down and/or replicate but is happening. We are also using Redis for session saves.

I was able to replicate using the view order > view order grid as @AykutCevik suggested, for a split second I saw the error on the Order view page, before being taken to the order grid.

Here is the stack trace generated:

{"0":"Warning: session_start(): Failed to read session data: user (path: /var/session/) in /vendor/magento/framework/Session/SessionManager.php on line 189","1":"
0 [internal function]: Magento\\Framework\\App\\ErrorHandler->handler(2, 'session_start()...', '/var/www/vhosts...', 189, Array)\n
1 /vendor/magento/framework/Session/SessionManager.php(189): session_start()\n
2 /generated/code/Magento/Backend/Model/Session/Interceptor.php(24): Magento\\Framework\\Session\\SessionManager->start()\n
3 /vendor/magento/framework/Session/SessionManager.php(130): Magento\\Backend\\Model\\Session\\Interceptor->start()\n
4 /generated/code/Magento/Backend/Model/Session/Interceptor.php(14): Magento\\Framework\\Session\\SessionManager->__construct(Object(Magento\\Framework\\App\\Request\\Http), Object(Magento\\Framework\\Session\\SidResolver\\Proxy), Object(Magento\\Backend\\Model\\Session\\AdminConfig), Object(Magento\\Framework\\Session\\SaveHandler), Object(Magento\\Framework\\Session\\Validator), Object(Magento\\Framework\\Session\\Storage), Object(Magento\\Framework\\Stdlib\\Cookie\\PhpCookieManager), Object(Magento\\Framework\\Stdlib\\Cookie\\CookieMetadataFactory), Object(Magento\\Framework\\App\\State))\n
5 /vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(111): Magento\\Backend\\Model\\Session\\Interceptor->__construct(Object(Magento\\Framework\\App\\Request\\Http), Object(Magento\\Framework\\Session\\SidResolver\\Proxy), Object(Magento\\Backend\\Model\\Session\\AdminConfig), Object(Magento\\Framework\\Session\\SaveHandler), Object(Magento\\Framework\\Session\\Validator), Object(Magento\\Framework\\Session\\Storage), Object(Magento\\Framework\\Stdlib\\Cookie\\PhpCookieManager), Object(Magento\\Framework\\Stdlib\\Cookie\\CookieMetadataFactory), Object(Magento\\Framework\\App\\State))\n
6 /vendor/magento/framework/ObjectManager/Factory/Compiled.php(108): Magento\\Framework\\ObjectManager\\Factory\\AbstractFactory->createObject('Magento\\\\Backend...', Array)\n
7 /vendor/magento/framework/ObjectManager/Factory/Compiled.php(150): Magento\\Framework\\ObjectManager\\Factory\\Compiled->create('Magento\\\\Backend...')\n
8 /vendor/magento/framework/ObjectManager/Factory/Compiled.php(79): Magento\\Framework\\ObjectManager\\Factory\\Compiled->get('Magento\\\\Backend...')\n
9 /vendor/magento/framework/ObjectManager/Factory/Compiled.php(150): Magento\\Framework\\ObjectManager\\Factory\\Compiled->create('Magento\\\\Store\\\\A...')\n
10 /vendor/magento/framework/ObjectManager/Factory/Compiled.php(79): Magento\\Framework\\ObjectManager\\Factory\\Compiled->get('Magento\\\\Store\\\\A...')\n
11 /vendor/magento/framework/ObjectManager/Factory/Compiled.php(150): Magento\\Framework\\ObjectManager\\Factory\\Compiled->create('Magento\\\\Backend...')\n
12 /vendor/magento/framework/ObjectManager/Factory/Compiled.php(79): Magento\\Framework\\ObjectManager\\Factory\\Compiled->get('Magento\\\\Backend...')\n
13 /vendor/magento/framework/ObjectManager/ObjectManager.php(56): Magento\\Framework\\ObjectManager\\Factory\\Compiled->create('Magento\\\\Ui\\\\Cont...', Array)\n
14 /vendor/magento/framework/App/ActionFactory.php(40): Magento\\Framework\\ObjectManager\\ObjectManager->create('Magento\\\\Ui\\\\Cont...')\n
15 /vendor/magento/framework/App/Router/Base.php(297): Magento\\Framework\\App\\ActionFactory->create('Magento\\\\Ui\\\\Cont...')\n
16 /vendor/magento/framework/App/Router/Base.php(158): Magento\\Framework\\App\\Router\\Base->matchAction(Object(Magento\\Framework\\App\\Request\\Http), Array)\n
17 /vendor/magento/framework/App/FrontController.php(50): Magento\\Framework\\App\\Router\\Base->match(Object(Magento\\Framework\\App\\Request\\Http))\n
18 /vendor/magento/framework/Interception/Interceptor.php(58): Magento\\Framework\\App\\FrontController->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n
19 /vendor/magento/framework/Interception/Interceptor.php(138): Magento\\Framework\\App\\FrontController\\Interceptor->___callParent('dispatch', Array)\n
20 /vendor/magento/framework/Interception/Interceptor.php(153): Magento\\Framework\\App\\FrontController\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Framework\\App\\Request\\Http))\n
21 /generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\\Framework\\App\\FrontController\\Interceptor->___callPlugins('dispatch', Array, Array)\n
22 /vendor/magento/framework/App/Http.php(135): Magento\\Framework\\App\\FrontController\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n
23 /vendor/magento/framework/App/Bootstrap.php(256): Magento\\Framework\\App\\Http->launch()\n
24 /pub/index.php(37): Magento\\Framework\\App\\Bootstrap->run(Object(Magento\\Framework\\App\\Http\\Interceptor))\n
25 {main}","url":"/admin/mui/bookmark/save/key/0194bbb75ffe47f654ca4e5343628982d1264a99d6a680a341326e9111d89296/?isAjax=true","script_name":"/index.php"}

From searching online, it appears to be either
a) a red herring message and some session read data is being returned as NULL or FALSE instead of '',
b) or Magento is falling back to the native session handler in \Magento\Framework\Session\SaveHandlerFactory::create
c) or something else :)

@AykutCevik
Copy link
Author

AykutCevik commented Aug 3, 2018

May this be related to max_concurrency where the fallback is the default PHP session handling? 🤔
(https://devdocs.magento.com/guides/v2.2/config-guide/redis/redis-session.html)

@engcom-backlog-nickolas
Copy link

@AykutCevik, thanks for feedback, and @josephmcdermott for details. I've tested on 2.2.5 with order view and order grid. Also I've been trying other different manipulation and still couldn't get described error on screen nor in logs.
Looks like we still missing some important steps or details, to replicate and therefore to fix this issue.
I'm leaving this issue open and if you guys have any details, feel free to share in order to write specific steps to reproduce.

@chris-pook
Copy link
Contributor

chris-pook commented Aug 3, 2018

@AykutCevik I believe this is indeed due to the max_concurrency value in env.php under the session => redis section. Magento is failing to save/retrieve sessions from the redis back-end based on the value of this config. However the error that's being reported here is stating that having failed to access Redis, the session also couldn't be accessed from the native PHP session directory (it may not exist on the server in the php.ini specified location, have a check on your server).

@engcom-backlog-nickolas, to consistently replicate the issue please try the following steps:

Preconditions

  • Redis enabled for sessions
  • Sessions Redis env.php config as per defaults in M2 devdocs (Max_concurency => 6)

Steps to reproduce

  • Using Google Chrome, login to the admin area
  • Open 10 or more browser tabs with the orders grid page
  • Click the left most tab
  • Hold shift and click the right most tab (this selects all tabs)
  • Right click the right most tab and select "reload"
  • Check the tabs after they have all reloaded, only ~6 will successfully load, the rest will exhibit this error *
  • Check the var/report folder for the start_session error report relating to the tabs that failed.
  • Now modify the max_concurrency to a value greater than the number of tabs, reload them all again and none will fail.

* if you aren't seeing this error, check in your PHP sessions directory. It should be empty (as Redis is the session back-end of course), however if there are session files building up in the directory, you are seeing a symptom of the same problem here, although it hides the error because PHP handles the session as a fallback. @AykutCevik try a php -i | grep session and check your session save path is available and has the correct permissions. Once corrected you'll likely see PHP handling the sessions rather than your error.

This is all happening because of contention for accessing session data from single threaded Redis. The max_concurency config value defines the size of the queue that can form to access Redis and retrieve the session. In the event of lots of traffic hitting the server at once, some users will receive this behavior because the queue is full, so the request to access the Redis session back-end is denied. PHP session handling kicks in here and if configured correctly will start creating sessions (this is still an issue as Redis is meant to be doing this for a reason, PHP will be saving to local disk so sessions wont be available across multiple web servers etc).

This same error will happen also on the front-end of Magento2. Try it by opening 10 or more tabs of different pages; clear the FPC (or just disable full page cache to emulate hitting un-cached pages); reload all the tabs at once as above and again some will fail. This is particularly bad when you have items in your cart as the local storage is not synched, resulting in the "I have no items in my cart, but there are items in my mini-cart" scenario I'm sure you've come across.

I would suggest that "6" as a default for max_concurrency is no good for most sites and that a better explanation of how to derive the correct value for the config should be made available. The Devdocs state "at least 10% of the number of PHP processes" but not why. I would assume that with 10% covered, in the unlikely(ish) event all your users hit pages at the same time (think Flash sale, Black Friday etc), 90% would receive this behavior still. I'm guessing the 10% suggestion is a stab in the dark at the likely percentage of requests that might all hit at the same time. This value should probably be derived from the max_children / max_requests values of the server's PHP-FPM pools, looking to accommodate as many requests as might come in concurrently.

Would be great to get a view from Magento on this!

Thanks

@chris-pook
Copy link
Contributor

chris-pook commented Aug 6, 2018

Update on the above comment

Having looked further in to this, I think potentially my above comment may not be completely accurate. The key being the code implementation of the function below:

\Cm\RedisSession\Handler::read()

This function implements the locking mechanism and appears to hold the lock per $sessionId. So this issue is not a problem globally across multiple sessions after all. I.e on a flash sale day, it would not be the case that the first 6 concurrent requests globally would get through and the rest bounce. Instead you would see all requests served but for each individual user's session only 6 concurrent requests allowed through.

To test this, I have repeated the front-end mass concurrent reload steps from before (with max_concurrency set to 6 still) only this time using ab:

ab -c 100 -n 100 <M2-instance-domain>

Concurrency Level:      100
Time taken for tests:   6.037 seconds
Complete requests:      100
Failed requests:        0

Here 100 concurrent requests are served no problem with no failures despite sessions being started.

Having discovered this I am happy that the 10% of PHP processes (php-fpm max_children) suggestion is probably quite sound. You don't want a single user session hogging the Redis instance making everyone else wait, so better to serve them 503 errors beyond their first X concurrent requests.

The likelihood is that this limit will only ever be exceeded by admin users trying to do too much at once, or abuse of the front-end.

It would still be great to get a line from Magento here to confirm. Apologies if this is going back over old ground that may have been covered elsewhere.

Thanks

@engcom-backlog-nickolas

@AykutCevik, we are closing this issue due to inactivity. If you'd like to update it, please reopen the issue.

@AykutCevik
Copy link
Author

A Magento core dev may have a look since we can't provide any updates.

@werfu
Copy link

werfu commented Sep 18, 2018

I can confirm this is currently happening on our site (Magento 2.2.5). We're getting non-responsive checkout process randomly happening. The max_concurrency value was still at the default value of 6. I'm increasing it to 30. The permission for /var/lib/php/sessions are set to drwx-wx-wt root:root, which explains why the FPM pool cannot read in it, but it obviously shouldn't be trying as redis should be acting as session backend.

Warning: session_start(): Failed to read session data: user (path: /var/lib/php/sessions) in /var/www/vhosts/www.com/subdomains/shop/vendor/magento/framework/Session/SessionManager.php on line 189 {"exception":"[object] (Exception(code: 0): Warning: session_start(): Failed to read session data: user (path: /var/lib/php/sessions) in /var/www/vhosts/www.com/subdomains/shop/vendor/magento/framework/Session/SessionManager.php on line 189 at /var/www/vhosts/www.com/subdomains/shop/vendor/magento/framework/App/ErrorHandler.php:61)"} []

@werfu werfu reopened this Sep 18, 2018
@ghost ghost self-assigned this Sep 18, 2018
@magento-engcom-team
Copy link
Contributor

magento-engcom-team commented Sep 18, 2018

Hi @engcom-backlog-nazar. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label G1 Passed will be added to the issue automatically. Please, edit issue description if needed, until label G1 Passed appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add G2 Passed label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 6. Add label acknowledged once verification is complete.

  • 7. Make sure that automatic system confirms that report is acknowledged.

@ghost ghost added the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Sep 19, 2018
@ghost
Copy link

ghost commented Sep 19, 2018

HI @AykutCevik Thank you for you report, the fix for this issue has already available in 2.2-develop and 2.3-develop branch, fixed by this pr -> #17608

@ghost ghost closed this as completed Sep 19, 2018
@ghost ghost added 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 labels Sep 19, 2018
@csdougliss
Copy link
Contributor

csdougliss commented Feb 11, 2019

@engcom-backlog-nazar I am still seeing this issue in 2.3.0. I am using it for sessions and cache, both on different ports.

This is a major issue, as it causing payments to fail in dev environment - which makes it look like a coding issue with the plugin but I believe in fact it is due to Magento not being able to read session data.

Is Magento falling back to /var/lib/php/sessions? Would that cause a different session and therefore no quote? Is there a permission issue?

Is Magento 2 compatible with redis 5.0.x?

report:

{"0":"Warning: session_start(): Failed to read session data: user (path: \/var\/lib\/php\/sessions) in \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/Session\/SessionManager.php on line 191","1":"#0 [internal function]: Magento\\Framework\\App\\ErrorHandler->handler(2, 'session_start()...', '\/var\/www\/vhosts...', 191, Array)\n#1 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/Session\/SessionManager.php(191): session_start()\n#2 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/Interception\/Interceptor.php(58): Magento\\Framework\\Session\\SessionManager->start()\n#3 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/Interception\/Interceptor.php(138): Magento\\Framework\\Session\\Generic\\Interceptor->___callParent('start', Array)\n#4 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/Interception\/Interceptor.php(153): Magento\\Framework\\Session\\Generic\\Interceptor->Magento\\Framework\\Interception\\{closure}()\n#5 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/generated\/code\/Magento\/Framework\/Session\/Generic\/Interceptor.php(52): Magento\\Framework\\Session\\Generic\\Interceptor->___callPlugins('start', Array, Array)\n#6 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/Session\/SessionManager.php(127): Magento\\Framework\\Session\\Generic\\Interceptor->start()\n#7 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/generated\/code\/Magento\/Framework\/Session\/Generic\/Interceptor.php(14): Magento\\Framework\\Session\\SessionManager->__construct(Object(Magento\\Framework\\App\\Request\\Http), Object(Magento\\Framework\\Session\\SidResolver\\Proxy), Object(Magento\\Framework\\Session\\Config), Object(Magento\\Framework\\Session\\SaveHandler), Object(Magento\\Framework\\Session\\Validator), Object(Magento\\Framework\\Session\\Storage), Object(Magento\\Framework\\Stdlib\\Cookie\\PhpCookieManager), Object(Magento\\Framework\\Stdlib\\Cookie\\CookieMetadataFactory), Object(Magento\\Framework\\App\\State\\Interceptor))\n#8 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/AbstractFactory.php(116): Magento\\Framework\\Session\\Generic\\Interceptor->__construct(Object(Magento\\Framework\\App\\Request\\Http), Object(Magento\\Framework\\Session\\SidResolver\\Proxy), Object(Magento\\Framework\\Session\\Config), Object(Magento\\Framework\\Session\\SaveHandler), Object(Magento\\Framework\\Session\\Validator), Object(Magento\\Framework\\Session\\Storage), Object(Magento\\Framework\\Stdlib\\Cookie\\PhpCookieManager), Object(Magento\\Framework\\Stdlib\\Cookie\\CookieMetadataFactory), Object(Magento\\Framework\\App\\State\\Interceptor))\n#9 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/Dynamic\/Developer.php(66): Magento\\Framework\\ObjectManager\\Factory\\AbstractFactory->createObject('Magento\\\\Framewo...', Array)\n#10 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/ObjectManager.php(70): Magento\\Framework\\ObjectManager\\Factory\\Dynamic\\Developer->create('Magento\\\\Framewo...')\n#11 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/AbstractFactory.php(160): Magento\\Framework\\ObjectManager\\ObjectManager->get('Magento\\\\Framewo...')\n#12 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/AbstractFactory.php(246): Magento\\Framework\\ObjectManager\\Factory\\AbstractFactory->resolveArgument(Array, 'Magento\\\\Framewo...', NULL, 'session', 'Magento\\\\Framewo...')\n#13 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/Dynamic\/Developer.php(34): Magento\\Framework\\ObjectManager\\Factory\\AbstractFactory->resolveArgumentsInRuntime('Magento\\\\Framewo...', Array, Array)\n#14 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/Dynamic\/Developer.php(59): Magento\\Framework\\ObjectManager\\Factory\\Dynamic\\Developer->_resolveArguments('Magento\\\\Framewo...', Array, Array)\n#15 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/ObjectManager.php(70): Magento\\Framework\\ObjectManager\\Factory\\Dynamic\\Developer->create('Magento\\\\Framewo...')\n#16 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/AbstractFactory.php(160): Magento\\Framework\\ObjectManager\\ObjectManager->get('Magento\\\\Framewo...')\n#17 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/AbstractFactory.php(246): Magento\\Framework\\ObjectManager\\Factory\\AbstractFactory->resolveArgument(Array, 'Magento\\\\Framewo...', NULL, 'formKey', 'Magento\\\\Framewo...')\n#18 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/Dynamic\/Developer.php(34): Magento\\Framework\\ObjectManager\\Factory\\AbstractFactory->resolveArgumentsInRuntime('Magento\\\\Framewo...', Array, Array)\n#19 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/Dynamic\/Developer.php(59): Magento\\Framework\\ObjectManager\\Factory\\Dynamic\\Developer->_resolveArguments('Magento\\\\Framewo...', Array, Array)\n#20 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/ObjectManager.php(70): Magento\\Framework\\ObjectManager\\Factory\\Dynamic\\Developer->create('Magento\\\\Framewo...')\n#21 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/AbstractFactory.php(160): Magento\\Framework\\ObjectManager\\ObjectManager->get('Magento\\\\Framewo...')\n#22 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/AbstractFactory.php(246): Magento\\Framework\\ObjectManager\\Factory\\AbstractFactory->resolveArgument(Array, 'Magento\\\\Framewo...', NULL, 'formKeyValidato...', 'CsrfRequestVali...')\n#23 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/Dynamic\/Developer.php(34): Magento\\Framework\\ObjectManager\\Factory\\AbstractFactory->resolveArgumentsInRuntime('CsrfRequestVali...', Array, Array)\n#24 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/Dynamic\/Developer.php(59): Magento\\Framework\\ObjectManager\\Factory\\Dynamic\\Developer->_resolveArguments('CsrfRequestVali...', Array, Array)\n#25 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/ObjectManager.php(70): Magento\\Framework\\ObjectManager\\Factory\\Dynamic\\Developer->create('CsrfRequestVali...')\n#26 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/AbstractFactory.php(196): Magento\\Framework\\ObjectManager\\ObjectManager->get('CsrfRequestVali...')\n#27 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/AbstractFactory.php(172): Magento\\Framework\\ObjectManager\\Factory\\AbstractFactory->parseArray(Array)\n#28 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/AbstractFactory.php(246): Magento\\Framework\\ObjectManager\\Factory\\AbstractFactory->resolveArgument(Array, NULL, NULL, 'validators', 'RequestValidato...')\n#29 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/Dynamic\/Developer.php(34): Magento\\Framework\\ObjectManager\\Factory\\AbstractFactory->resolveArgumentsInRuntime('RequestValidato...', Array, Array)\n#30 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/Dynamic\/Developer.php(59): Magento\\Framework\\ObjectManager\\Factory\\Dynamic\\Developer->_resolveArguments('RequestValidato...', Array, Array)\n#31 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/ObjectManager.php(70): Magento\\Framework\\ObjectManager\\Factory\\Dynamic\\Developer->create('RequestValidato...')\n#32 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/App\/FrontController.php(71): Magento\\Framework\\ObjectManager\\ObjectManager->get('RequestValidato...')\n#33 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/generated\/code\/Magento\/Framework\/App\/FrontController\/Interceptor.php(14): Magento\\Framework\\App\\FrontController->__construct(Object(Magento\\Framework\\App\\RouterList), Object(Magento\\Framework\\App\\Response\\Http\\Interceptor), NULL, NULL, NULL)\n#34 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/AbstractFactory.php(116): Magento\\Framework\\App\\FrontController\\Interceptor->__construct(Object(Magento\\Framework\\App\\RouterList), Object(Magento\\Framework\\App\\Response\\Http\\Interceptor), NULL, NULL, NULL)\n#35 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/Factory\/Dynamic\/Developer.php(66): Magento\\Framework\\ObjectManager\\Factory\\AbstractFactory->createObject('Magento\\\\Framewo...', Array)\n#36 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/ObjectManager\/ObjectManager.php(70): Magento\\Framework\\ObjectManager\\Factory\\Dynamic\\Developer->create('Magento\\\\Framewo...')\n#37 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/App\/Http.php(134): Magento\\Framework\\ObjectManager\\ObjectManager->get('Magento\\\\Framewo...')\n#38 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/generated\/code\/Magento\/Framework\/App\/Http\/Interceptor.php(24): Magento\\Framework\\App\\Http->launch()\n#39 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/vendor\/magento\/framework\/App\/Bootstrap.php(258): Magento\\Framework\\App\\Http\\Interceptor->launch()\n#40 \/var\/www\/vhosts\/vax-uk2-dev\/releases\/20190208104332\/pub\/index.php(37): Magento\\Framework\\App\\Bootstrap->run(Object(Magento\\Framework\\App\\Http\\Interceptor))\n#41 {main}","url":"\/newsletter\/subscriber\/checkEmail","script_name":"\/index.php"}

redis-cli -v

redis-cli 4.0.11

ls -la /var/lib/php/

drwxrwxrwx  2 root root 98304 Feb 11 09:41 sessions

There are session files in the folder.

php-fpm7.2 -i | grep session

igbinary session support => yes
redis.session.lock_expire => 0 => 0
redis.session.lock_retries => 10 => 10
redis.session.lock_wait_time => 2000 => 2000
redis.session.locking_enabled => 0 => 0
session
session.auto_start => Off => Off
session.cache_expire => 180 => 180
session.cache_limiter => nocache => nocache
session.cookie_domain => no value => no value
session.cookie_httponly => no value => no value
session.cookie_lifetime => 0 => 0
session.cookie_path => / => /
session.cookie_secure => 0 => 0
session.gc_divisor => 1000 => 1000
session.gc_maxlifetime => 1440 => 1440
session.gc_probability => 1 => 1
session.lazy_write => On => On
session.name => PHPSESSID => PHPSESSID
session.referer_check => no value => no value
session.save_handler => files => files
session.save_path => /var/lib/php/sessions => /var/lib/php/sessions
session.serialize_handler => php => php
session.sid_bits_per_character => 4 => 4
session.sid_length => 32 => 32
session.upload_progress.cleanup => On => On
session.upload_progress.enabled => On => On
session.upload_progress.freq => 1% => 1%
session.upload_progress.min_freq => 1 => 1
session.upload_progress.name => PHP_SESSION_UPLOAD_PROGRESS => PHP_SESSION_UPLOAD_PROGRESS
session.upload_progress.prefix => upload_progress_ => upload_progress_
session.use_cookies => 1 => 1
session.use_only_cookies => 1 => 1
session.use_strict_mode => 0 => 0
session.use_trans_sid => 0 => 0
session.trans_sid_hosts => no value => no value
session.trans_sid_tags => a=href,area=href,frame=src,form= => a=href,area=href,frame=src,form=

max_concurrency is 6 in app/etc/env.php, max_children in php7.2-fpm is 15.

@csdougliss csdougliss reopened this Feb 11, 2019
@engcom-November engcom-November added Area: Framework Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch and removed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch labels Aug 25, 2021
@github-jira-sync-bot
Copy link

❌ Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.magento.com/browse/AC-791

@Morgy93
Copy link
Member

Morgy93 commented Oct 4, 2021

Just came here to see that the issue is not resolved for over 3 years. 😔

This happens for me sometimes on the frontend product page.
Magento 2.4.3 with redis-server 6.2.5

'session' => [
        'save' => 'redis',
        'redis' => [
            'host' => '127.0.0.1',
            'port' => '6379',
            'password' => '',
            'timeout' => '2.5',
            'persistent_identifier' => '',
            'database' => '2',
            'compression_threshold' => '2048',
            'compression_library' => 'gzip',
            'log_level' => '4',
            'max_concurrency' => '6',
            'break_after_frontend' => '5',
            'break_after_adminhtml' => '30',
            'first_lifetime' => '600',
            'bot_first_lifetime' => '60',
            'bot_lifetime' => '7200',
            'disable_locking' => '0',
            'min_lifetime' => '60',
            'max_lifetime' => '2592000',
            'sentinel_master' => '',
            'sentinel_servers' => '',
            'sentinel_connect_retries' => '5',
            'sentinel_verify_master' => '0'
        ]
    ],
Error:
Warning: session_start(): Failed to read session data: user (path: /var/lib/php/sessions) in vendor/magento/framework/Session/SessionManager.php on line 204

Trace:
#1 session_start() called at [vendor/magento/framework/Session/SessionManager.php:204]
#2 Magento\Framework\Session\SessionManager->start() called at [generated/code/Magento/Customer/Model/Session/Interceptor.php:23]
#3 Magento\Customer\Model\Session\Interceptor->start() called at [vendor/magento/framework/Session/SessionManager.php:141]
#4 Magento\Framework\Session\SessionManager->__construct() called at [vendor/magento/module-customer/Model/Session.php:180]
#5 Magento\Customer\Model\Session->__construct() called at [generated/code/Magento/Customer/Model/Session/Interceptor.php:14]
#6 Magento\Customer\Model\Session\Interceptor->__construct() called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121]
#7 Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:108]
#8 Magento\Framework\ObjectManager\Factory\Compiled->create() called at [vendor/magento/framework/ObjectManager/ObjectManager.php:56]
#9 Magento\Framework\ObjectManager\ObjectManager->create() called at [generated/code/Magento/Customer/Model/SessionFactory.php:43]
#10 Magento\Customer\Model\SessionFactory->create() called at [vendor/amasty/mostviewed/Model/Customer/GroupValidator.php:36]
#11 Amasty\Mostviewed\Model\Customer\GroupValidator->validate() called at [vendor/amasty/mostviewed/Model/Repository/GroupRepository.php:192]
#12 Amasty\Mostviewed\Model\Repository\GroupRepository->validateGroup() called at [vendor/amasty/mostviewed/Model/Repository/GroupRepository.php:136]
#13 Amasty\Mostviewed\Model\Repository\GroupRepository->getGroupByIdAndPosition() called at [vendor/amasty/mostviewed/Model/ProductProvider.php:167]
#14 Amasty\Mostviewed\Model\ProductProvider->modifyCollection() called at [vendor/amasty/mostviewed/Plugin/Community/AbstractProduct.php:74]
#15 Amasty\Mostviewed\Plugin\Community\AbstractProduct->prepareCollection() called at [vendor/amasty/mostviewed/Plugin/Community/Related.php:24]
#16 Amasty\Mostviewed\Plugin\Community\Related->afterGetItems() called at [vendor/magento/framework/Interception/Interceptor.php:146]
#17 Magento\Catalog\Block\Product\ProductList\Related\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#18 Magento\Catalog\Block\Product\ProductList\Related\Interceptor->___callPlugins() called at [generated/code/Magento/Catalog/Block/Product/ProductList/Related/Interceptor.php:23]
#19 Magento\Catalog\Block\Product\ProductList\Related\Interceptor->getItems() called at [vendor/magento/module-catalog/Block/Product/ProductList/Related.php:147]
#20 Magento\Catalog\Block\Product\ProductList\Related->getIdentities() called at [vendor/magento/module-page-cache/Model/Layout/LayoutPlugin.php:96]
#21 Magento\PageCache\Model\Layout\LayoutPlugin->afterGetOutput() called at [vendor/magento/framework/Interception/Interceptor.php:146]
#22 Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#23 Magento\Framework\View\Layout\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:41]
#24 Magento\Framework\View\Layout\Interceptor->getOutput() called at [vendor/magento/framework/View/Result/Page.php:260]
#25 Magento\Framework\View\Result\Page->render() called at [vendor/magento/framework/View/Result/Layout.php:171]
#26 Magento\Framework\View\Result\Layout->renderResult() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#27 Magento\Framework\View\Result\Page\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#28 Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magezon/module-core/Plugin/View/Result/Layout.php:24]
#29 Magezon\Core\Plugin\View\Result\Layout->aroundRenderResult() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#30 Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#31 Magento\Framework\View\Result\Page\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/View/Result/Page/Interceptor.php:23]
#32 Magento\Framework\View\Result\Page\Interceptor->renderResult() called at [vendor/magento/framework/App/Http.php:120]
#33 Magento\Framework\App\Http->launch() called at [vendor/magento/framework/App/Bootstrap.php:264]
#34 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:29]

Any help?

@jlnarvaez
Copy link
Contributor

I tried to increase max_concurrency value up to 100, but the problem persist. I check logs, and before that error, Magento throw the next error:

Session size of 1086976 exceeded allowed session max size of 256000.

(In my case I have these values)

To solve the error, I set max_session_size_admin to a value higher than 1086976, with this command:

bin/magento config:set system/security/max_session_size_admin 1500000

I hope it helps some of you.

@t-heuser
Copy link

Having the same issue after adding several user roles (acl). Now the adminhtml is insane slow and sometimes this error occurs and a error page is shown. We're using 2.4.3-p1.
If I delete the user roles, everything is fine again. We're also using redis.

@t-heuser
Copy link

Related to #3374

@pkarsai
Copy link

pkarsai commented Mar 30, 2022

After reading through this thread multiple times and looking into the relevant Magento code, I think that the following is going on:

  • Magento can fall back to file based session handling, when Redis is not available at all (see \Magento\Framework\Session\SaveHandler::callSafely), but cannot handle the situation when the session is already created in Redis, but it can't be read from, due to a concurrency issue. Looking at \Magento\Framework\Session\SaveHandler\Redis::read, we can see that on ConcurrentConnectionsExceededException Magento immediately redirects to a 503 page. It doesn't even try to fall back to the file based session handling.
  • The error that we get (Warning: session_start(): Failed to read session data: user) is not related to permission issues. When configuring Magento save the sessions to files, instead of redis, it can perfectly read and write from/to the same location.

Considering all this, I ended up subclassing \Magento\Framework\Session\SaveHandler\Redis, and I added some logic to retry the read on ConcurrentConnectionsExceededException, with exponential backoff. This is what I came up with: https://gist.github.com/pkarsai/0dcc35294870c057b9be9803cba891b6. The tests look promising so far, but it's not yet in production. BTW, max_concurrency was set to 30 and were still having this problem, that's why I ended up implementing this custom solution.

@ndlinh-celtic
Copy link

We also meet same problem, increase max_concurrency did not solve the problem. Our setup using same redis instance for caching and session. We are thinking about move caching and session to separated instances.

@tuyennn
Copy link
Member

tuyennn commented Jun 29, 2022

@engcom-November Could we have update status of this ticket

@schmengler
Copy link
Contributor

FWIW, it still happened here in a 2.4.3 installation which was not even live yet, so there was not much concurrent traffic. But at least increasing max_concurrency seemed to help

@tuyennn
Copy link
Member

tuyennn commented Jul 6, 2022

FWIW, it still happened here in a 2.4.3 installation which was not even live yet, so there was not much concurrent traffic. But at least increasing max_concurrency seemed to help

Sure, but this was just a workaround, was there any further investment on the others solutions

@Djohn12
Copy link

Djohn12 commented Mar 10, 2023

Still reproducing this on a 2.4.3-p3 instance using the default session redis config with a 'max_concurrency' => '6'.

Is there anyone from magento team working on this ?

@phtmgt
Copy link

phtmgt commented May 2, 2023

2.4.2 here, can't fix it.

@adarshkhatri
Copy link
Contributor

Happening in 2.4.6-p2 as well.

@engcom-Hotel engcom-Hotel moved this to Ready for Development in High Priority Backlog Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Framework Component: Framework/Session 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 Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: ready for dev Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. Triage: Done Has been reviewed and prioritized during Triage with Product Managers
Projects
Status: Ready for Development