Django Potential Fork Bomb

Shakti Kumar shakti.shrivastava13 at gmail.com
Wed May 8 12:28:57 EDT 2019


Hello team,

I am using django runserver 0.0.0.0:<port> for one of my dev server.
However, I notice that a second query from the GUI executes any command in
my python app twice (I could see 2 prints), a third query executes it three
times, and so on.

This kept growing with each query and today my dev server stopped
responding due to too many processes. For any command I executed on my dev
server upon logging in, the error I received was,

Last login: Wed May 8 07:34:29 2019 from 2001:420:c0e0:1003::13b
-bash: fork: retry: No child processes
-bash: fork: retry: No child processes
-bash: fork: retry: No child processes
-bash: fork: retry: No child processes
-bash: fork: Resource temporarily unavailable

I was able to ask one of my colleagues to kill the django process, and
after that all the commands came back to life for me.

I suspect django spawned too many child processes, and consecutively I ran
out of resources on my dev server. How can I prevent this from happening?
And I am not able to understand why django should spawn (if it indeed is
spawning) incrementing processes with each query from the GUI.

Looking out for some suggestions/help.

Thanks,
Shakti

-- 
Shakti Kumar,
Grad Student,
Dept. of Computer Science,
University of Toronto



More information about the Python-list mailing list