Skip to content

Runtime errors when launching many shell subprocesses. #93

Closed
@ghost

Description

Here's the code to reproduce those issues:

import uvloop
from asyncio import set_event_loop_policy, create_subprocess_shell, gather, get_event_loop
from asyncio.subprocess import PIPE

async def run_cmd():
    length = 1000000
    process = await create_subprocess_shell("head -c %s /dev/urandom" % length, stdout=PIPE)
    output, err = await process.communicate()
    assert len(output) == length

set_event_loop_policy(uvloop.EventLoopPolicy())
loop = get_event_loop()
loop.set_debug(True)
runners = [run_cmd() for i in range(50)]
loop.run_until_complete(gather(*runners))

The exact runtime error raised depends on where I run it:

This raises multiple RuntimeError: Cannot pause_reading() when closing:

  • uvloop version: 0.8.0
  • Python version: 3.6.1
  • Platform: linux 4.7.8-1 i686 pae, backport, Debian 8
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: yes

On the same system with python 3.5.3 this runtime error isn't raised but the assertion fails.

This raises multiple exceptions such as RuntimeError: unable to perform operation on <ReadUnixTransport closed=True reading=False 0x7efe0d848d00>; the handler is closed when using /dev/zero instead of /dev/urandom and only needs 2 parallel subprocesses (1 works):

  • uvloop version: 0.8.0
  • Python version: 3.6.1
  • Platform: linux 3.16.0-4-amd64, Debian 8
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: yes

It also raises multiple times RuntimeError: Cannot pause_reading() when closing if run_cmd is launched 200 times instead of 50. Note that this system is on a server with 16G of RAM, while the first one only has 4G (if that makes any difference).

Running the same code with asyncio's default loop works in any case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions