Text of bugs.python.org › issue17367 as Styx crawled it on Nov 20, 2026. The page may have changed since. Only its words are kept, without pictures or layout.

Open the live page

Issue 17367: subprocess deadlock when read() is interrupted - Python tracker

Python Home About News Documentation Downloads Community Foundation Developer's Guide Issue Tracker Issues Search Random Issue Summaries Issues with patch Easy issues Stats User Administration User List Committer List Help Tracker Documentation Tracker Development Report Tracker Problem Issue17367 ➜ This issue tracker has been migrated to GitHub , and is currently read-only . For more information, see the GitHub FAQs in the Python's Developer Guide.

Created on 2013-03-06 12:07 by jszakmeister , last changed 2022-04-11 14:57 by admin . This issue is now closed . Files File name Uploaded Description Edit fix-subprocess-deadlock.patch jszakmeister , 2013-03-06 12:07 review Messages (5) msg183584 - (view) Author: John Szakmeister (jszakmeister) * Date: 2013-03-06 12:07 I discovered this issue while trying to track down why our upcoming release for Nose 1.3.0 was deadlocking under Ubuntu 12.04 with Python 3.3.

It turns out that the read() was being interrupted leaving data in the subprocess's output buffers, which ultimately means the subprocess is blocked. Since the thread was exiting, and the read was never retried, we were left in deadlock. The attached patch fixes the issue. It wraps the read call with _eintr_retry_call() around the read operation in _readerthread(). msg183585 - (view) Author: Richard Oudkerk (sbt) * Date: 2013-03-06 12:30 The change in your patch is in a Windows-only section -- a few lines before the chunk you can see _winapi.GetExitCodeProcess().

Since read() on Windows never fails with EINTR there is no need for _eintr_retry_call(). If you are using Linux then there must be some other reason for your deadlock. msg183586 - (view) Author: Richard Oudkerk (sbt) * Date: 2013-03-06 12:31 BTW, on threads are only used on Windows. On Unix select() or poll() is used. msg183588 - (view) Author: John Szakmeister (jszakmeister) * Date: 2013-03-06 12:35 Good grief... how did I miss that.

The problem has been flaky for me to induce. I'll take a closer look at the correct section. Thank you Richard. msg183593 - (view) Author: Richard Oudkerk (sbt) * Date: 2013-03-06 14:35 I will close the issue then. If you track the problem down to a bug in Python then you can open a new one. History Date User Action Args 2022-04-11 14:57:42 admin set github: 61569 2013-03-06 14:35:16 sbt set status: open -> closed resolution: not a bug messages: + msg183593 stage: resolved 2013-03-06 12:35:21 jszakmeister set messages: + msg183588 2013-03-06 12:31:37 sbt set messages: + msg183586 2013-03-06 12:30:24 sbt set nosy: + sbt messages: + msg183585 2013-03-06 12:07:50 jszakmeister create Supported by The Python Software Foundation , Powered by Roundup Copyright © 1990-2022, Python Software Foundation Legal Statements