From the docs using Popen.wait() may:
deadlock when using stdout=PIPE and/or stderr=PIPE and the child process generates enough output to a pipe such that it blocks waiting for the OS pipe buffer to accept more data. Use communicate() to avoid that.
In communicate docs it's written that:
The data read is buffered in memory, so do not use this method if the data size is large or unlimited
How to reproduce such a problematic behavior and see that using Popen.communicate() fixes it?
Deadlock means some circular wait between processes holding resources happens and is stuck forever. What is the circular dependency here? Python process which waits for the child process to terminate is one wait. What's the other? Who waits for what in the below scenario?
it blocks waiting for the OS pipe buffer to accept more data