Problem "Allowed memory size of xxxxx bytes exhausted (tried to allocate xxxx bytes) in php" when I dispatch a job in Laravel

0

I'm having memory problems with Laravel jobs and queues. The problem I have arises the following. I'm working with images like PNG, JPG and PSD. These last ones weigh much more, and it has very long chains of type base64 that is the encode with which I work.

I have prepared some jobs that are responsible for taking the base64 data received by post and save it in a file using the file_put_contents function (In laravel Storage :: put-> ...). With the png and jpg files everything works correctly. When I send to the job the data base64 gives memory error and in some cases I fail to insert the job in DB, but I have read that the capacity is brutal for a field type long_text.

 LONGTEXT | 4,294,967,295 (232−1) bytes =  4 GiB

I doubt that it is exceeding this size since the image weighs about 24 mb and uses 178 mb of memory when receiving it by post and writing it in a file.

By doing tests, the memory usage by php when handling the psd is 178 MB. I have in the php.ini memory_limit: 1 GB, max_file_size, post_max_size to 1GB too.

Do you think it may be happening?

I'm not sure if it can be a memory problem with queues jobs that do not accept these string dimensions so long, memory of these queues ?. For the moment I left the script without sending it to the queue.

Additional information: I am using a basic amazon AWS test machine, a gb of RAM, to solve this and that this was not the problem, I created a swap unit of about 2GB but the problem persists.

    
asked by Albert Sanchez Guerrero 12.03.2018 в 11:23
source

0 answers