A few weeks ago I noticed in the Google Webmaster tools that a few of my URL's were returning 502's.
One such URL is http://www.sau.com.au/forums/topic/437438-around-the-bay-wrap-up/
This URL returns the 502 for any desktop skin but works fine when on mobile (different skin)
Note that it returns the 502 very quickly, suggesting to me that it is not an execution or some form of timeout.
Besides a few more like this, all other URL's on the site are fine.
The only log entry to help at all is this one;
2015/06/29 09:33:39 [error] 19650#0: *4431763 upstream prematurely closed FastCGI stdout while reading response header from upstream, client: 94.228.34.203, server: sau.com.au, request: "GET /forums/topic/437438-around-the-bay-wrap-up/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/php-fpm.sock:", host: "www.sau.com.au", referrer: "http://www.sau.com.au/forums/forum/100-victoria/"
I have also restarted APC which didn't help. It had only 1.5% fragmentation.
I can't find any limit-reached entries. The server is specced quite high so PHP has a lot of memory, request sizes and also long timeouts.
I tried the following that I read about but no diff.
fastcgi_buffer_size 10240k;
fastcgi_buffers 4 10240k;
I'm reluctant to make any big changes because this is only on some pages. One thread suggested updating PHP to 5.5.
I dont know where to look now for further assistance. What should my next step be?
Some info;
nginx version: nginx/1.6.2
PHP 5.3.3 (fpm-fcgi) (built: Oct 30 2014 20:14:56)
UPDATE 1
PHP error log has nothing written to it. Error logging is enabled though;
php_admin_value[error_log] = /var/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on
UPDATE 2
dmesg doesn't seem to be updating and there is no kernel.log;
-rw-r--r-- 1 root root 41179 Dec 18 2014 dmesg
RESOLVED
I was installing XDebug as proposed by @sa289 in this answer and to do so I needed to update from PHP 5.3 to PHP 5.5. I was hoping that would fix the issue on its own, but it didn't. So, I installed XDebug and added the zend_extension to php.ini, restarted PHP and voilà the 502's are gone. I commented out the zend extension again and the 502's returned. XDebug to the rescue. No firm grasp on the cause or true resolution but this is good enough for me.
I'd see where it might be crashing by using Xdebug. Xdebug can be used to do something called tracing where it will tell you every line of code that executes and this way you can see the last line of code that was run before crashing so it will point you in the right direction. You can have it only trace when a certain cookie is set so you aren't generating trace logs for every request. Check out especially the following configuration settings:
xdebug.trace_enable_trigger
xdebug.trace_output_dir
xdebug.collect_params
xdebug.trace_output_name
(I like "trace.%p.%t" because it puts the PID in the filename which can be helpful in certain cases)See http://xdebug.org/docs/all_settings for details on these configuration parameters as well as others.