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.communicate never returns when the subprocess outputs more than 0xFFFF + 1 bytes #363

Closed
riouh opened this issue Oct 12, 2020 · 9 comments

Comments

@riouh
Copy link

riouh commented Oct 12, 2020

  • uvloop version: uvloop==0.14.0
  • Python version: Python 3.8.6
  • Platform: MacOS
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: yes
  • Does uvloop behave differently from vanilla asyncio? How?: yes. vanilla asyncio just works

The following code never returns with uvloop :

import asyncio
from asyncio.subprocess import PIPE
import uvloop
import logging

logging.basicConfig(level=logging.DEBUG)


async def main():
    proc = await asyncio.create_subprocess_exec("/bin/cat", stdin=PIPE, stderr=PIPE, stdout=PIPE)
    stdin = b'x' * 65_537
    stdout, stderr = await proc.communicate(stdin)
    print(stdout)


uvloop.install()
asyncio.run(main())

changing 65_537 to 65_536 makes the script work as expected and returns immediately.

The debug output is :

 % PYTHONASYNCIODEBUG=1 python xxx.py
DEBUG:asyncio:<Process 13746> communicate: feed stdin (65537 bytes)
DEBUG:asyncio:<Process 13746> communicate: close stdin
DEBUG:asyncio:<Process 13746> communicate: read stdout
DEBUG:asyncio:<Process 13746> communicate: read stderr
@lovasoa
Copy link
Contributor

lovasoa commented Oct 13, 2020

I can reproduce the issue with the latest version of uvloop published on pypi (v0.14.0, which is almost one year old), but I cannot reproduce it with the latest development version ( 6ef69a7 ). It looks like the issue has been fixed by some other change. It would be nice if a new version could be published on pypi soon.

lovasoa added a commit to lovasoa/uvloop that referenced this issue Oct 13, 2020
lovasoa added a commit to lovasoa/uvloop that referenced this issue Oct 13, 2020
fantix pushed a commit to lovasoa/uvloop that referenced this issue Feb 5, 2021
fantix pushed a commit to lovasoa/uvloop that referenced this issue Feb 5, 2021
fantix pushed a commit that referenced this issue Feb 5, 2021
@fantix
Copy link
Member

fantix commented Feb 5, 2021

Closed by #364. Please feel free to reopen if the issue persists.

@fantix fantix closed this as completed Feb 5, 2021
@lovasoa
Copy link
Contributor

lovasoa commented Feb 5, 2021

@fantix : The issue was already fixed in master when it was opened. The problem is that the latest released version is old and contains the bug: https://pypi.org/project/uvloop/#history

@fantix
Copy link
Member

fantix commented Feb 5, 2021

Right, thanks for the reminder - this links to how we close issues. I'm leaning towards marking issues closed to reflect the situation in the master branch, and PyPI releases could reference the issues fixed in each version. People with the same issue could still find this ticket and understand the release by comparing the Git tags in logs. But @1st1 may have a different opinion

@1st1
Copy link
Member

1st1 commented Feb 5, 2021

But @1st1 may have a different opinion

Closing as soon as it's fixes in master is IMO ok, but then I typically add a comment saying when the release is scheduled and then go back and update the issue again once the release has been made.

@lovasoa
Copy link
Contributor

lovasoa commented Feb 6, 2021

Yes, I also think this is the right thing to do. So, is there a new release planned ? The last one was in November 2019.

@fantix
Copy link
Member

fantix commented Feb 7, 2021

Yes! I'll push for a new release after the first 3 columns on this board are cleared.

This was referenced Feb 10, 2021
@fantix
Copy link
Member

fantix commented Feb 10, 2021

The fix is included in 0.15.0.

@lovasoa
Copy link
Contributor

lovasoa commented Feb 10, 2021

Thank you @fantix !

Olaf1022 pushed a commit to Olaf1022/Ultra-fast-asyncio that referenced this issue Aug 13, 2023
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

4 participants