I have a site built in Drupal 7 on a nginx server. A few times a week when I edit any content and press save, or when I log in to the site, or when I change some configuration, I get a white screen with the message "502 Bad gateway". The error is never showed to anonymous visitors, only when logged in and saving changes. It doesn't seem to matter what kind of changes I do. I can press the back button in the browser, which takes me back to the edit screen and press save again, and save the change successfully.
The error happened again this morning at 08:09, so I looked at the PHP log:
2016/10/20 08:09:00 [error] 20703#20703: *3297348 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 18.104.22.168, server: www.example.com, request: "POST /node/88/edit HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "www.example.com", referrer: "http://www.example.com/node/88/edit"
And here is the nginx log at that same time:
[20-Oct-2016 08:09:00] WARNING: [pool www0] child 10909, script '/srv/www/example/public_html/index.php' (request: "POST /index.php") execution timed out (8189.954999 sec), terminating [20-Oct-2016 08:09:00] WARNING: [pool www0] child 10909 exited on signal 15 (SIGTERM) after 19080.476683 seconds from start [20-Oct-2016 08:09:00] NOTICE: [pool www0] child 13002 started
Can anyone see what is happening here?