strace can shed light on what is happening.
Assuming you cannot reproduce the problem using cli, I would recommend limiting the number of processes to 1 (MaxRequestWorkers for mod_php and max_children for php_fpm), bind strace to the process and check where it hangs.
For example, in the case of php_fpm:
open /etc/php5/fpm/pool.d/www.conf and make sure the settings
pm = static pm.max_children = 1
restart php_fpm and nginx
grep aux | php grep aux | php to find out the process idsudo strace -p followed by the process id- try to reproduce the problem.
If it is stored for several minutes with a single system call, you will clearly see the blocker directly in stdout strace. If there is no single blocker, but rather a long cycle of repeated system calls, you probably need to write it to a file and parse it later. For instance. sudo strace -p {pid} | tee /tmp/strace.log sudo strace -p {pid} | tee /tmp/strace.log .
If the problem does not reproduce with a single worker, try increasing the number of workers and fixing strace for all processes.
source share