Report this

What is the reason for this report?

Long script blocks other requests in PHP-FPM / Nginx

Posted on January 28, 2016

Hi all,

I’m facing an issue I don’t manage to resolve. I have a PHP application which executes FFMPEG to convert videos. This script is quite long to execute because of FFMPEG conversion time. The problem is, while this script is executing, all other requests sent to Nginx / PHP-FPM are waiting and don’t execute, and I can’t find the proper configuration to make this work.

In nginx.conf, I have this:

worker_processes 2;
worker_connections 768;
multi_accept on;
keepalive_timeout 65;

In PHP-FPM www.conf:

pm.max_children = 10

The application is developed with Symfony2.8 and you’ll find below the typical error message I get, which is a MySQL timeout but digging a bit on the internet, I narrowed the problem to a server configuration issue:

SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction

Does any of you have any idea what could prevent requests to be executed when a PHP script is already running?

Thanks for your help, Best regards, Romain

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.