Random 500 Internal Server Error

Hello,

Suddenly i start to receive a 500 Error . The problem occurs randomly .

I've checked the error logs and it seems that there is a problem with the session variables ?

Here is the log:

[28-May-2020 08:55:08 UTC] PHP Notice:  Undefined index: settings in app/Tygh/Session.php on line 257
[28-May-2020 08:55:08 UTC] PHP Warning:  session_decode(): Cannot call session save handler in a recursive manner in app/Tygh/Web/Session.php on line 653
[28-May-2020 08:55:08 UTC] PHP Warning:  session_decode(): Session object destruction failed in app/Tygh/Web/Session.php on line 653
[28-May-2020 08:55:08 UTC] PHP Warning:  session_decode(): Failed to decode session object. Session has been destroyed in app/Tygh/Web/Session.php on line 653
[28-May-2020 08:55:08 UTC] PHP Notice:  Undefined index: settings in app/Tygh/Session.php on line 257
[28-May-2020 08:55:08 UTC] PHP Warning:  session_decode(): Failed to decode session object. Session has been destroyed in app/Tygh/Web/Session.php on line 653
[28-May-2020 08:55:08 UTC] PHP Notice:  Undefined index: settings in app/Tygh/Session.php on line 257
[28-May-2020 08:55:08 UTC] PHP Fatal error:  Allowed memory size of 5368709120 bytes exhausted (tried to allocate 12288 bytes) in app/Tygh/Backend/Database/Mysqli.php on line 91
Does anyone have the same problem ?
Thank you for your time.

How do you store your sessions?

Hello,

I use the database for backend session.

I've tried to clear the cache and repair the session tables in mysql.

we use CS-cart version 4.7.4 with php 7.1

We host the website on a dedicated server.

Thank you for your response.

Perhaps try using a solution like redis, its a bit less intensive on the database so it should reduce IO of MySQL.

Hi,

No luck with this, I am still getting the following errors:

session_decode(): Cannot call session save handler in a recursive manner  in /app/Tygh/Web/Session.php on line 653

session_decode(): Session object destruction failed in /app/Tygh/Web/Session.php on line 653

session_decode(): Failed to decode session object. Session has been destroyed in app/Tygh/Web/Session.php on line 653
Undefined index: settings in app/Tygh/Session.php on line 257

Hi,

No luck with this, I am still getting the following errors:

session_decode(): Cannot call session save handler in a recursive manner  in /app/Tygh/Web/Session.php on line 653

session_decode(): Session object destruction failed in /app/Tygh/Web/Session.php on line 653

session_decode(): Failed to decode session object. Session has been destroyed in app/Tygh/Web/Session.php on line 653
Undefined index: settings in /usr/www/users/vdfnyp/app/Tygh/Session.php on line 257

Then there is no other way to say it, but you most likely have a faulty addon installed.

Hi again,

To anyone has the same problem i've found a solution by truncating the sessions table.

I can not understand why the problem exists in that table. - maybe corrupted data ?

Making a simple test by creating a clone of the website helped me to realize the issue.