cancel
Showing results for 
Search instead for 
Did you mean: 

session_start hangs in Varien.php

session_start hangs in Varien.php

Hi,
I am using Magento 1.8.0.0. Everything was working ok until recently.
Suddenly the session_start() function started hanging (I found this from slow log.)
It happens atleast once in every week. When it happens, I have to restart php-fpm and mariadb server and reindex everything.
Then everything will be fine for around one week.
Once the session_start() starts hanging, all the call to API will hang and finally php-fpm stops responding.
The sessions are stored in the folder /var/www/catalog/var/sessions/ . There is no space or permission problem in this directory.
I found 575024 files in that directory, is that a problem? Can I clear everything in this directory? Is the session file supposed to get deleted when the http request ends?
I recently moved the database from mysql to mariadb, and after that only the problem started appearing. Is there any configuration I need to check in mariadb?

backtrace from slow log shows where the code hangs, it is below.

script_filename = /var/www/catalog/index.php
[0x00007f70016fb458] session_start() /var/appdata/catalog/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php:125
[0x00007f70016fb108] start() /var/appdata/catalog/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php:168
[0x00007f70016faf90] init() /var/appdata/catalog/app/code/core/Mage/Core/Model/Session/Abstract.php:84
[0x00007f70016fae08] init() /var/appdata/catalog/app/code/core/Mage/Core/Model/Session.php:42
[0x00007f70016faba8] __construct() /var/appdata/catalog/app/code/core/Mage/Core/Model/Config.php:1348
[0x00007f70016faa60] getModelInstance() /var/appdata/catalog/app/Mage.php:462
[0x00007f70016fa820] getModel() /var/appdata/catalog/app/Mage.php:476
[0x00007f70016f97f8] getSingleton() /var/appdata/catalog/app/code/core/Mage/Core/Controller/Varien/Action.php:493
[0x00007f70016f9650] preDispatch() /var/appdata/catalog/app/code/core/Mage/Core/Controller/Front/Action.php:64
[0x00007f70016f8908] preDispatch() /var/appdata/catalog/app/code/core/Mage/Core/Controller/Varien/Action.php:407
[0x00007f70016f74e8] dispatch() /var/appdata/catalog/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php:250
[0x00007f70016f6ec8] match() /var/appdata/catalog/app/code/core/Mage/Core/Controller/Varien/Front.php:172
[0x00007f70016f68a0] dispatch() /var/appdata/catalog/app/code/core/Mage/Core/Model/App.php:354
[0x00007f70016f5d90] run() /var/appdata/catalog/app/Mage.php:683
[0x00007f70016f5720] run() /var/appdata/catalog/index.php:88

 

- Regards,
Rajeev K

1 REPLY

Re: session_start hangs in Varien.php

I'd recommend setting up and using Redis for sessions. You're far less likely to run into performance issues over using the filesystem. 

----
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution" as appropriate. Thanks!