Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subprocess leaking #185

Closed
ttill opened this issue Jul 30, 2018 · 3 comments
Closed

Subprocess leaking #185

ttill opened this issue Jul 30, 2018 · 3 comments

Comments

@ttill
Copy link

ttill commented Jul 30, 2018

  • uvloop version: 0.11.0
  • Python version: 3.6.6
  • Platform: Linux (Archlinux)
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: yes

A lot of subsequent failing calls to asyncio.create_subprocess_exec cause a Too many open files OS error. Using the standard event loop, I do not get an error thrown.

Here is a minimal example:

import asyncio
import uvloop

async def m():
    for i in range(0, 10000):
        try:
            await asyncio.create_subprocess_exec('nonexistant')
        except FileNotFoundError:
            print(i)
        await asyncio.sleep(.001)

asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
asyncio.get_event_loop().run_until_complete(m())

Output:

[…]
333
334
335
Traceback (most recent call last):
  File "uvseg.py", line 13, in <module>
    asyncio.get_event_loop().run_until_complete(m())
  File "uvloop/loop.pyx", line 1448, in uvloop.loop.Loop.run_until_complete
  File "uvseg.py", line 7, in m
    await asyncio.create_subprocess_exec('nonexistant')
  File "/usr/lib64/python3.6/asyncio/coroutines.py", line 110, in __next__
    return self.gen.send(None)
  File "/usr/lib64/python3.6/asyncio/subprocess.py", line 225, in create_subprocess_exec
    stderr=stderr, **kwds)
  File "uvloop/loop.pyx", line 2603, in subprocess_exec
  File "uvloop/loop.pyx", line 2563, in __subprocess_run
  File "uvloop/handles/process.pyx", line 580, in uvloop.loop.UVProcessTransport.new
  File "uvloop/handles/process.pyx", line 87, in uvloop.loop.UVProcess._init
OSError: [Errno 24] Too many open files

The same code runs until the end when removing asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()).

1st1 added a commit that referenced this issue Aug 1, 2018
1st1 added a commit that referenced this issue Aug 1, 2018
1st1 added a commit that referenced this issue Aug 2, 2018
1st1 added a commit that referenced this issue Aug 2, 2018
@1st1
Copy link
Member

1st1 commented Aug 2, 2018

Fixed in uvloop 0.11.1

@1st1 1st1 closed this as completed Aug 2, 2018
@1st1
Copy link
Member

1st1 commented Aug 2, 2018

Thanks for submitting this bug!

@ttill
Copy link
Author

ttill commented Aug 2, 2018

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants