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

Created on 1 Aug 2018  路  48Comments  路  Source: magento/magento2

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()?

FrameworSession Clear Description Confirmed Format is valid Ready for Work P2 PR in progress Reproduced on 2.4.x S2 Done

Most helpful comment

We are still getting this issue even after increasing the max_concurrency to 18. We have set it now to 54 and are observing if this issue still occurs.

However - I still do not quite get why the native session fallback does not work. If I disable Redis for sessions, sessions with the native session storage work fine. But why does the fallback not work, when using Redis as the session storage?

All 48 comments

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

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?

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

@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?

Yes, the website you followed to install Redis.

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 :)

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)

@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.

@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

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

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

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

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)"} []

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: :point_down:

  • [x] 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.
  • [x] 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.

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 -> https://github.com/magento/magento2/pull/17608

@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.

@craigcarnell @werfu do you get these same symptoms in a vanilla install of the relevant versions of M2? If it is the introduction of custom code that is causing it then as per my comment I think this is certainly due to the limitation on max concurrency (usually only seen in the admin with multi tabs open). You should be able to trace the concurrent requests stemming from your code to work out what the max value needs to be to allow for it (or ideally reduce the number of requests).

This appears to be something that I've been suffering with lately. I have changed my max_concurrency from '6' to '20' _(technically I should be able to go to '25')_. However, I still get the Apache error emails through.

After changing max_concurrency in env.php, does anything need restarting for the changes to take affect? I'm currently in Production Mode.

@chris-pook This seems to have gone away after increasing max_concurrency but it is very worrying

I've been directed to post on here by Yireo as they think my problem is the same.

Firstly, I'm not brilliantly technical so apologies if this isn't clear.

On a live M2.2.5 site, running in production mode with docroot set to pub, I've started seeing errors in exception.log

[2019-03-03 10:50:36] main.CRITICAL: Report ID: webapi-5c7bb17c499c1; Message: Warning: session_start(): Failed to read session data: user (path: /dev/shm) in /chroot/home/myserver/mydomain.com/vendor/magento/framework/Session/SessionManager.php on line 189 {"exception":"[object] (Exception(code: 0): Report ID: webapi-5c7bb17c499c1; Message: Warning: session_start(): Failed to read session data: user (path: /dev/shm) in /chroot/home/myserver/mydomain.com/vendor/magento/framework/Session/SessionManager.php on line 189 at /chroot/home/myserver/mydomain.com/vendor/magento/framework/Webapi/ErrorProcessor.php:205, Exception(code: 0): Warning: session_start(): Failed to read session data: user (path: /dev/shm) in /chroot/home/myserver/mydomain.com/vendor/magento/framework/Session/SessionManager.php on line 189 at /chroot/home/myserver/mydomain.com/vendor/magento/framework/App/ErrorHandler.php:61)"} []

In addition, I'm seeing a report generated that reads

{"0":"Warning: session_start(): Failed to read session data: user (path: \/dev\/shm) in \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/Session\/SessionManager.php on line 189","1":"#0 [internal function]: Magento\\Framework\\App\\ErrorHandler->handler(2, 'session_start()...', '\/chroot\/home\/a8...', 189, Array)\n#1 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/Session\/SessionManager.php(189): session_start()\n#2 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/Interception\/Interceptor.php(58): Magento\\Framework\\Session\\SessionManager->start()\n#3 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/Interception\/Interceptor.php(138): Magento\\Framework\\Session\\Generic\\Interceptor->___callParent('start', Array)\n#4 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/Interception\/Interceptor.php(153): Magento\\Framework\\Session\\Generic\\Interceptor->Magento\\Framework\\Interception\\{closure}()\n#5 \/chroot\/home\/myserver\/mydomain.com\/generated\/code\/Magento\/Framework\/Session\/Generic\/Interceptor.php(26): Magento\\Framework\\Session\\Generic\\Interceptor->___callPlugins('start', Array, Array)\n#6 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/Session\/SessionManager.php(130): Magento\\Framework\\Session\\Generic\\Interceptor->start()\n#7 \/chroot\/home\/myserver\/mydomain.com\/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))\n#8 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/ObjectManager\/Factory\/AbstractFactory.php(111): 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))\n#9 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/ObjectManager\/Factory\/Compiled.php(108): Magento\\Framework\\ObjectManager\\Factory\\AbstractFactory->createObject('Magento\\\\Framewo...', Array)\n#10 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/ObjectManager\/Factory\/Compiled.php(150): Magento\\Framework\\ObjectManager\\Factory\\Compiled->create('Magento\\\\Framewo...')\n#11 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/ObjectManager\/Factory\/Compiled.php(79): Magento\\Framework\\ObjectManager\\Factory\\Compiled->get('Magento\\\\Framewo...')\n#12 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/ObjectManager\/Factory\/Compiled.php(150): Magento\\Framework\\ObjectManager\\Factory\\Compiled->create('Magento\\\\Store\\\\A...')\n#13 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/ObjectManager\/Factory\/Compiled.php(79): Magento\\Framework\\ObjectManager\\Factory\\Compiled->get('Magento\\\\Store\\\\A...')\n#14 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/ObjectManager\/Factory\/Compiled.php(150): Magento\\Framework\\ObjectManager\\Factory\\Compiled->create('Magento\\\\Framewo...')\n#15 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/ObjectManager\/Factory\/Compiled.php(79): Magento\\Framework\\ObjectManager\\Factory\\Compiled->get('Magento\\\\Framewo...')\n#16 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/ObjectManager\/ObjectManager.php(56): Magento\\Framework\\ObjectManager\\Factory\\Compiled->create('Magento\\\\Custome...', Array)\n#17 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/App\/ActionFactory.php(40): Magento\\Framework\\ObjectManager\\ObjectManager->create('Magento\\\\Custome...')\n#18 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/App\/Router\/Base.php(297): Magento\\Framework\\App\\ActionFactory->create('Magento\\\\Custome...')\n#19 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/App\/Router\/Base.php(158): Magento\\Framework\\App\\Router\\Base->matchAction(Object(Magento\\Framework\\App\\Request\\Http), Array)\n#20 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/App\/FrontController.php(50): Magento\\Framework\\App\\Router\\Base->match(Object(Magento\\Framework\\App\\Request\\Http))\n#21 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/Interception\/Interceptor.php(58): Magento\\Framework\\App\\FrontController->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#22 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/Interception\/Interceptor.php(138): Magento\\Framework\\App\\FrontController\\Interceptor->___callParent('dispatch', Array)\n#23 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/module-store\/App\/FrontController\/Plugin\/RequestPreprocessor.php(94): Magento\\Framework\\App\\FrontController\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Framework\\App\\Request\\Http))\n#24 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/Interception\/Interceptor.php(135): Magento\\Store\\App\\FrontController\\Plugin\\RequestPreprocessor->aroundDispatch(Object(Magento\\Framework\\App\\FrontController\\Interceptor), Object(Closure), Object(Magento\\Framework\\App\\Request\\Http))\n#25 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/module-page-cache\/Model\/App\/FrontController\/BuiltinPlugin.php(73): Magento\\Framework\\App\\FrontController\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Framework\\App\\Request\\Http))\n#26 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/Interception\/Interceptor.php(135): Magento\\PageCache\\Model\\App\\FrontController\\BuiltinPlugin->aroundDispatch(Object(Magento\\Framework\\App\\FrontController\\Interceptor), Object(Closure), Object(Magento\\Framework\\App\\Request\\Http))\n#27 \/chroot\/home\/myserver\/mydomain.com\/app\/code\/Infortis\/Cgen\/Plugin\/Magento\/Framework\/App\/FrontController.php(32): Magento\\Framework\\App\\FrontController\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Framework\\App\\Request\\Http))\n#28 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/Interception\/Interceptor.php(135): Infortis\\Cgen\\Plugin\\Magento\\Framework\\App\\FrontController->aroundDispatch(Object(Magento\\Framework\\App\\FrontController\\Interceptor), Object(Closure), Object(Magento\\Framework\\App\\Request\\Http))\n#29 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/Interception\/Interceptor.php(153): Magento\\Framework\\App\\FrontController\\Interceptor->Magento\\Framework\\Interception\\{closure}(Object(Magento\\Framework\\App\\Request\\Http))\n#30 \/chroot\/home\/myserver\/mydomain.com\/generated\/code\/Magento\/Framework\/App\/FrontController\/Interceptor.php(26): Magento\\Framework\\App\\FrontController\\Interceptor->___callPlugins('dispatch', Array, NULL)\n#31 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/App\/Http.php(135): Magento\\Framework\\App\\FrontController\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#32 \/chroot\/home\/myserver\/mydomain.com\/vendor\/magento\/framework\/App\/Bootstrap.php(256): Magento\\Framework\\App\\Http->launch()\n#33 \/chroot\/home\/myserver\/mydomain.com\/pub\/index.php(37): Magento\\Framework\\App\\Bootstrap->run(Object(Magento\\Framework\\App\\Http\\Interceptor))\n#34 {main}","url":"\/customer\/section\/load\/?sections=yireo-gtm-quote%2Cyireo-gtm-order&_=1551874746963","script_name":"\/index.php"}

I don't know what the cause is but the tech support guys @ Yireo asked me to add it to this post in case someone could help me or that it helps someone else.

@wjpbill This appears to be related to your session handler such as Redis or Varnish. Perhaps they aren't configured to take on your increase in site traffic? I'd focus my investigation into that.

I had a similar issue, which has been discussed above. Where my Redis max_concurrency was left as default. I had to do some calculations to work out what I could increase it to, then set it to that. Since then I don't recall seeing this issue popup _(touch wood)_.

@wjpbill This appears to be related to your session handler such as Redis or Varnish. Perhaps they aren't configured to take on your increase in site traffic? I'd focus my investigation into that.
I had a similar issue, which has been discussed above. Where my Redis max_concurrency was left as default. I had to do some calculations to work out what I could increase it to, then set it to that. Since then I don't recall seeing this issue popup (touch wood).

Thanks for replying DigitalStatupUK, very much appreciated.

My hosting company got someone to work on it and they've increase max_concurrency to 20.

Fingers crossed it handles it all. It does seem a bit short sighted by Magento though not to flag it anywhere.

@wjpbill Awesome. Please, give us an update in the future to confirm the fix. Others would find that very useful to know.

Hi @DigitalStartupUK Hi @wjpbill so this issue related to max_concurrency ?

Hello everyone and @engcom-backlog-nazar

I got some help from senior engineers at the company I host with.

They agreed and changed max_concurrency from 6 to 20.

Since then, I haven't seen the problem again - fingers crossed!

Apologies for not replying sooner.

Hi folks, thanks @wjpbill for explanation, i'm will close this one, as problem related to php-configs, but if someone found another reason, feel free to reopen this one. thanks for collaboration :+1:

We are still getting this issue even after increasing the max_concurrency to 18. We have set it now to 54 and are observing if this issue still occurs.

However - I still do not quite get why the native session fallback does not work. If I disable Redis for sessions, sessions with the native session storage work fine. But why does the fallback not work, when using Redis as the session storage?

I am having a similar issue on 2.2.8. On our Redis setup in the env.php from our hosting provider, there was no max_concurrency...So I've added it and made it 50. We're a fairly high traffic site, so I will be able to get a good idea and report back how it works! :)

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

Did this not fix the issue? What 2.3 release was this in?

Answered my own question. Looks like it is in at least 2.3.1. We are getting the error with the above patch. Bumped max_concurrency to 20 from 6 to see what happens.

@qrider Did this solve your issue?

I am also experiencing this error in magento 2.3.2 while in developer mode. Why doesnt the fallback from redis to files work?

Hi everyone, increased from 6 to 20 seems to resolve the issue for us! Let's monitor things now.

This issue is, in principle, still happening in Magento 2.3.2. If you set max_concurrency to a low value, the fallback still does not work and any subsequent concurrent request for the same sessions ends in a 503.

This issue still happening in Magento 2.3.4 @magento-engcom-team please give us your opinion.

Hi folks, thanks @wjpbill for explanation, i'm will close this one, as problem related to php-configs, but if someone found another reason, feel free to reopen this one. thanks for collaboration 馃憤

This is not due to php config, its a wrong default configuration that is shipped with magento. It would be enough to just increase the value.

I confirm, this issue exists in Magento 2.3.5-p1.

Re-opening this issue due to reports #17310 (comment) #17310 (comment) #17310 (comment) and possible solution in #29140

That's not really a solution to the original problem. The problem is, that the _fallback_ is not working, in case the max concurrency limit is reached. Magento should not rely upon this limit being high enough, should it?

Re-opening this issue due to reports #17310 (comment) #17310 (comment) #17310 (comment) and possible solution in #29140

That's not really a solution to the original problem. The problem is, that the _fallback_ is not working, in case the max concurrency limit is reached. Magento should not rely upon this limit being high enough, should it?

Could you please explain which fallback doesn鈥檛 work? If you mean fallback to files - seems like it鈥檚 wrong direction, as sessions should have only one shared storage, otherwise it will not work correctly when you have multiple web nodes

Could you please explain which fallback doesn鈥檛 work? If you mean fallback to files

Yes, the automatic fallback to the native session storage.

seems like it鈥檚 wrong direction, as sessions should have only one shared storage, otherwise it will not work correctly when you have multiple web nodes

Sure, seems like a valid point, but if that is the case, then Magento should not try to fall back to the native session storage in the first place, should it?

@fritzmg i think it鈥檚 good idea. Please create pull request with your suggestion, will definitely review it! Anyway - even increasing max concurrency should fix the issue and it鈥檚 just simpler solution.

Please create pull request with your suggestion, will definitely review it!

Unfortunately I still know very little about Magento's session handling implementation at this point, so it might take some time ;).

:white_check_mark: Confirmed by @engcom-Alfa
Thank you for verifying the issue. Based on the provided information internal tickets MC-36187 were created

Issue Available: @engcom-Alfa, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._

I also face the same issue every time I clone my Magento Directory.

This is a temporary fix that works.

add the marked line in session place in app/etc/env.php file.

'session' => [
'save' => 'files',
'save_path' => '/absoluteMagentoPath/var/session'

save path should be the absolute path for Magento directory.

Why this is P4 ? this issue is easy reproduce in any page just pressing multiple times F5 button and then we got
Screenshot_2020-10-12 Screenshot

Hi,

Due to this issue, we faced a few issues in the custom extensions that were resulting in the _partially broken product page_ (custom options and add to cart blocks) were missing AND then _cached in Varnish_.

How it happened - in the view file we had the code $block->isLoggedIn(), that inside was creating customer session and checking if the customer is logged in.

In the custom extension we had code similar to this:

        if ($this->customerSessionFactory->create()->isLoggedIn()) {
            $customerGroup = $this->customerSessionFactory->create()->getCustomer()->getGroupId();
        }

I strongly believe we should change severity & priority to S1 P2.
@sidolov @gabrieldagama what do you think?


The investigation showed that basically when you're just creating any session object - it tries to start the session and as result tries to connect to Redis.

In the constructor, it just executes the start method:
https://github.com/magento/magento2/blob/caefb4e63f0c726c996118c2707afaf63ed3c665/lib/internal/Magento/Framework/Session/SessionManager.php#L117-L142

This method runs session_start.
https://github.com/magento/magento2/blob/caefb4e63f0c726c996118c2707afaf63ed3c665/lib/internal/Magento/Framework/Session/SessionManager.php#L179-L222

It means example code from the extension that had just 2 lines were doing session_start 2 times.


Unfortunately, I found a similar code in many places in Magento.
https://github.com/magento/magento2/blob/a31f4a35c018ad09654e5bd5871086b73fbd3d2d/app/code/Magento/Persistent/Observer/RenewCookieObserver.php#L83-L87
https://github.com/magento/magento2/blob/a31f4a35c018ad09654e5bd5871086b73fbd3d2d/app/code/Magento/Persistent/Observer/ClearExpiredCronJobObserver.php#L54


Seems like the correct fix for this issue would be one of those options, or maybe even both:

  1. Implement the removal of session auto-start during the session object creation
  2. Implementing optimistic locks for sessions

@ihor-sviziev thanks for investigation and detailed report! I changed priority to P2

Was this page helpful?
0 / 5 - 0 ratings