Skip to content

bpo-33353: test_asyncio use set_write_buffer_limits() #7200

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

Merged
merged 2 commits into from
May 29, 2018
Merged

bpo-33353: test_asyncio use set_write_buffer_limits() #7200

merged 2 commits into from
May 29, 2018

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented May 29, 2018

Use transport.set_write_buffer_limits() in sendfile tests of
test_asyncio to make sure that the protocol is paused after sending
1024 bytes. Previously,
test_sendfile_fallback_close_peer_in_the_middle_of_receiving() failed
on FreeBSD if the DATA was smaller than the default limit of 64 KiB.

https://bugs.python.org/issue33353

Use transport.set_write_buffer_limits() in sendfile tests of
test_asyncio to make sure that the protocol is paused after sending
1024 bytes. Previously,
test_sendfile_fallback_close_peer_in_the_middle_of_receiving() failed
on FreeBSD if the DATA was smaller than the default limit of 64 KiB.
@vstinner
Copy link
Member Author

Crap, a test failed on AppVeyor:

FAIL: test_sendfile_close_peer_in_the_middle_of_receiving (test.test_asyncio.test_events.ProactorEventLoopTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\cpython\lib\test\test_asyncio\test_events.py", line 2506, in test_sendfile_close_peer_in_the_middle_of_receiving
    self.file.tell())
AssertionError: False is not true : 65536

@vstinner
Copy link
Member Author

... and the Travis CI job fails on test_asyncio.test_stdin_broken_pipe https://bugs.python.org/issue33531 and test_multiprocessing_forkserver.test_ignore(): https://bugs.python.org/issue33532 :-( Two failures unrelated to my change...

* Windows: use 128 KiB of data, instead of 64 KiB, to workaround
  issues on selector and proactor event loops
* FreeBSD: use 4 KiB, instead of 1 KiB, for the buffer size
@vstinner
Copy link
Member Author

With "Fix sendfile tests on Windows, commit 3758248":

  • test_asyncio sendfile tests pass on my Windows VM, FreeBSD VM and Linux

Timings:

  • Windows VM: 3 sec
  • FreeBSD: 17 sec
  • Linux: 3 sec

Once, sendfile tests took longer than 1 min on Windows. I interrupted the tests to check that I was on the correct branch, but then I was unable to reproduce the slowdown... Another strange issue...

@vstinner vstinner merged commit 9551f77 into python:master May 29, 2018
@vstinner vstinner deleted the asyncio_write_buflimit branch May 29, 2018 14:02
@miss-islington
Copy link
Contributor

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-7202 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 29, 2018
Use transport.set_write_buffer_limits() in sendfile tests of
test_asyncio to make sure that the protocol is paused after sending
4 KiB. Previously,
test_sendfile_fallback_close_peer_in_the_middle_of_receiving() failed
on FreeBSD if the DATA was smaller than the default limit of 64 KiB.
(cherry picked from commit 9551f77)

Co-authored-by: Victor Stinner <[email protected]>
miss-islington added a commit that referenced this pull request May 29, 2018
Use transport.set_write_buffer_limits() in sendfile tests of
test_asyncio to make sure that the protocol is paused after sending
4 KiB. Previously,
test_sendfile_fallback_close_peer_in_the_middle_of_receiving() failed
on FreeBSD if the DATA was smaller than the default limit of 64 KiB.
(cherry picked from commit 9551f77)

Co-authored-by: Victor Stinner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants