A
A
Alexander Pankov2017-08-23 17:26:27
PHP
Alexander Pankov, 2017-08-23 17:26:27

How to fix PHP Fatal error: Out of memory error?

Hello
, my server is down, error 502 for 25 minutes, I see the following in the logs:

2017/08/19 19:36:30 [error] 7652#0: *978 upstream sent unexpected FastCGI record: 3 while reading response header from upstream, client: 207.46.13.158, server: vamdodoma.ru, request: "GET /catalog/2-mestnye-divany/S39861885.html/ HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/14617404421463.sock/socket:", host: "vamdodoma.ru"

2017/08/19 19:36:31 [error] 7651#0: *622 FastCGI sent in stderr: "PHP Fatal error: Out of memory (allocated 262144) (tried to allocate 8589938688 bytes) in Unknown on line 0" while reading response header from upstream, client: 46.237.19.175, server: vamdodoma.ru, request: "GET /api/app.getCities HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/14617404421463.sock/socket:", host: "vamdodoma.ru"

2017/08/19 19:36:31 [error] 7651#0: *622 upstream sent unexpected FastCGI record: 3 while reading response header from upstream, client: 46.237.19.175, server: vamdodoma.ru, request: "GET /api/app.getCities HTTP/1.1", upstream: "fastcgi://unix:/var/php-nginx/14617404421463.sock/socket:", host: "vamdodoma.ru"

server PHP, NGINX, MySQL
в php.ini memory_limit = 48000M
Why is there not enough memory, how can I overcome this problem so that the site does not lie for 25 minutes?
Thanks in advance for your help!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Puma Thailand, 2017-08-23
@opium

Well, it’s also written there that you are trying to allocate eight gigabytes of memory, if you just increase the memory in a stupid way, in the phpfpm logs there is usually a stack of function calls to understand what is wrong

E
Egor Kazantsev, 2017-08-23
@saintbyte

Optimize the code, for example, change gd to imagemagick

X
xmoonlight, 2017-08-23
@xmoonlight

When processing - give up cycles and use generators.
Most likely - a large amount of data gets into the array after sampling from the database and ... prev!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question