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

Allowed memory size exhausted #78

Open
gaxweb opened this issue Oct 23, 2023 · 3 comments
Open

Allowed memory size exhausted #78

gaxweb opened this issue Oct 23, 2023 · 3 comments

Comments

@gaxweb
Copy link

gaxweb commented Oct 23, 2023

Content of $response:

Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in <b>/var/www/html/test/shopware6/vendor/shopware/core/Framework/Struct/JsonSerializableTrait.php</b> on line <b>15</b>   
Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 65536 bytes) in <b>Unknown</b> on line <b>0</b>

Happened while executing \Vin\ShopwareSdk\Repository\EntityRepository::search(). Doesn't throw an exception, so difficult to spot. It tried to assign more than 256MB.

Which is strange because I had set ini_set('memory_limit', '1G') earlier. So I guess it's happening on the server side?

$response = $this->decodeResponse($response) just returns an empty response which then causes a misleading exception to be thrown in $aggregations = new AggregationResultCollection($response['aggregations']).

@vienthuong
Copy link
Owner

from the log I'd say it's the error from the Shopware's platform

@gaxweb
Copy link
Author

gaxweb commented Oct 24, 2023

The point is that I had to dig in and find out why it breaks, and the actual reason wasn't what the thrown exception suggested. I think this might be worth handling by throwing an exception, if the response contains the words "fatal error", so people don't waste time debugging. Or at least trigger an E_USER_WARNING or something, 'cause it might be a valid sub-string in the user data.

@vienthuong
Copy link
Owner

That totally makes sense :)
Feel free to create a PR or I might take care of it later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants