Python subprocess.Popen slow under uWSGI

I installed the Cherokee development server on Fedora 14, using uWSGI to interact with my WSGI application.

When the application hits the first request, I create a process like this:

from subprocess import Popen
Popen(['bash'])  # bash is just an example; the problem happens with all programs

The first request takes 10-15 seconds to complete (the next request takes less than a second). Without creating a Popen object, the first request takes only 2-3 seconds. When I execute the same Popen request from the Python shell, it is instant.

What could be causing this behavior? Am I missing something obvious?

+3
source share
2 answers

--close-on-exec

Otherwise, your new process will inherit the socket.

(this is standard UNIX behavior)

+10
source

python, close_fds = True "Popen" (), .

+3

Source: https://habr.com/ru/post/1795010/


All Articles