git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Work around performance bug in subprocess.Popen.communicate()

From
CMCatalin Marinas <catalin.marinas@gmail.com>
Date
Jul 31, 2009, 11:27 UTC
Message-ID
<b0943d9e0907310427r7e59aa5fi5e5ff5e3f3c03819@mail.gmail.com>
In-Reply-To
<20090731093632.7018.24435.stgit@october.e.vtech>
2009/7/31 Karl Wiberg <kha@virtutech.com>:
Show 11 quoted lines
> @@ -110,7 +110,9 @@ class Run:
>                                  stdin = subprocess.PIPE,
>                                  stdout = subprocess.PIPE,
>                                  stderr = subprocess.PIPE)
> -            outdata, errdata = p.communicate(self.__indata)
> +            if self.__indata:
> +                p.stdin.write(self.__indata)
> +            outdata, errdata = p.communicate()
>             self.exitcode = p.returncode
>         except OSError, e:
>             raise self.exc('%s failed: %s' % (self.__cmd[0], e))

But can this not lead to a deadlock if the __indata is big? The stdout of the created process is only processed once the whole __indata is written. I thought communicate() was created to avoid this issue.

-- 
Catalin
Previous: Karl WibergNext: Karl Wiberg
Message 2 of 7 in “Work around performance bug in subprocess.Popen.communicate()”
  1. Work around performance bug in subprocess.Popen.communicate()Karl Wiberg, Jul 31, 2009
  2. Catalin MarinasJul 31, 2009
  3. Karl WibergAug 4, 2009
  4. Catalin MarinasAug 13, 2009
  5. Karl WibergAug 14, 2009
  6. Erik SandbergAug 14, 2009
  7. Karl WibergAug 14, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.