Author Manoj C
Recipients Manoj C, asvetlov, yselivanov
Date 2019-09-11.10:12:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I have been using asyncio to run subprocess calls in a separate thread. For this purpose I start an event loop in my main thread as per the recommendation - .

Now when I use a normal subprocess call in the main thread, I start getting following file descriptor error after few iterations:

Exception ignored when trying to write to the signal wakeup fd:
BlockingIOError: [Errno 11] Resource temporarily unavailable

I have reproduced the problem in a small script and am seeing that the error goes away if I do not start the even loop in the main thread.

import asyncio
import subprocess
import time

def try_error():
    for i in range(1,500):
  ["ls", "-l"], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        except subprocess.CalledProcessError as e:
            print(f"Exception raised {e.stderr}\nOutput {e.stdout}")

def definite_error():
    w = asyncio.get_child_watcher()
    l = asyncio.get_event_loop()

if __name__ == "__main__":

This is the smallest subset of the code which can reproduce the error. In the original code, I run a asyncio.create_subprocess_exec in a parallel thread. The normal subprocess call is part of third party code which call from the main thread and hence cannot modify it.
Date User Action Args
2019-09-11 10:12:22Manoj Csetrecipients: + Manoj C, asvetlov, yselivanov
2019-09-11 10:12:22Manoj Csetmessageid: <>
2019-09-11 10:12:22Manoj Clinkissue38104 messages
2019-09-11 10:12:21Manoj Ccreate