Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prestashop 1.6.1.11 (500) Internal server error (Associations) bytes exhausted

I've had a question posted on the Prestashop forums for some time regarding an issue that I'm not sure how to resolve. I'll post the link below to the original question, any assistance I can get regarding this issue would be greatly appreciated.

Initial Prestashop Forum Question.


Prestashop 1.6.1.11: Everytime I access certain products and try to edit thier associations I receive an error notice;

(500 Internal Server Error)

A server error occurred while loading the tabs: some tabs could not be loaded. Please try again by refreshing the page. If you are still encountering this problem, please check your server logs or contact your hosting provider for assistance.

I completed a few steps to try to identify the error as shown below in my code snippet, a result of which I was able to return a few details regarding the error.

<php

// I enabled dev mode via config/defines.inc.php
if (!defined('_PS_MODE_DEV_')) {
define('_PS_MODE_DEV_', true);
}

?>

Re-tracing the steps I tried to reccur the error.

This was my result...

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 8192 bytes) in /classes/cache/CacheFs.php on line 69

I took a few steps forward in hopes of correcting this issue but all to no avail. I'll list the steps I've attempted below;

  • Adjusted my php.ini to allow the full memory limit, I'll post a full copy of which below. (memory_limit = 128M)
  • Contacted my hosting provider to have the 'xCache' caching module installed on my sever in hopes of worming my around the default caching solution and finding a possible fix. However this is not possible at this time.
  • Checked for recently installed module issues. (None found)


I have done some further digging on the web but most solutions seem exstensive, such as rebuilding the code to be less memory intensive. Sadly, I'm not confident enough in my ability to reliably resolve this issue with my current knowledge and I'm seeking some advice on how to go about resolving this error.

Regards, -B

EDIT

After further digging and after disabling caching, my error location has changedto; Adapter/Adapter_EntityMapper.php on line 98.

like image 337
Beaniie Avatar asked Oct 17 '22 15:10

Beaniie


1 Answers

You have exhausted 128M and also exhausted 1024M, which is ludicrous (actually, 128M is pretty ludicrous in its own right).

This isn't likely to be a standard leak; looks more like a looped allocation. It's almost as if the entity mapper found a link to another entity that, by a commodius vicus of recirculation, brought back to the first entity. When trying to resolve the Entity-Relationship-Attribute graph, each loops allocates more memory in a nested structure, until all available memory is exhausted.

Just as an example, and not even in PHP:

ProductA: {
    Name: "Phone charger",
    Details: {
         Accessories: {
             ProductB: {
                 Name: "Phone charger cable",
                 Details: {
                     Accessories: {
                         ProductA: {
                             Name: "Phone charger",
                             Details: {
                                 ...

Can you verify whether your product attribute structure is identical between one of the products that work, and one that does not?

like image 123
LSerni Avatar answered Oct 21 '22 06:10

LSerni