D
D
Dmitry Sonko2015-12-22 17:10:07
PHP
Dmitry Sonko, 2015-12-22 17:10:07

Error 502 Bad Gateway on POST requests. Why?

In the admin panel there is an image uploader and their resize. It was on post requests to download images that 502 errors began to appear in the logs.
ab -n 1000 -c 10 host - does not issue any. Where in which direction to dig?
listen.backlog, sysctl net.core.somaxconn, worker_connections are all set to 1024.
There is no memory shortage.
The following is thrown into the logs
[22-Dec-2015 17:15:03] WARNING: [pool takeguru] child 3275 exited on signal 9 (SIGKILL) after 89.296408 seconds from start
[22-Dec-2015 17:15:03] NOTICE: [pool takeguru] child 3299 started
2015/12/22 17:15:03 [error] 3097#0: *146 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 5.140.73.87, server: cp.takeguru. com, request: "POST /image/upload?guru_id=9 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-takeguru.sock:", host: "cp.takeguru. com", referrer: " cp.takeguru.com/image/create?guru_id=9 "

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey, 2015-12-22
@VladimirAndreev

what do the backend logs say?

Y
Yuri, 2015-12-22
@xtreme

child 3275 exited on signal 9 (SIGKILL) after 89.296408 seconds from start

PHP does something with the file you uploaded for as long as 90 seconds, after which fpm successfully kills it, as if it had hung. See processing a picture file in a POST request. Perhaps you should not process it right away, but first save the original in order to release the connection, and only then perform some magical actions on it in the form of cropping, converting, watermarking, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question