GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Revert "gh-129005: _pyio.BufferedIO remove copy on readall (#129454)" by cmaloney · Pull Request #129500 · python/cpython

Conversation

@cmaloney

@cmaloney cmaloney commented Jan 31, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This reverts commit e1c4ba9.

This seems to be the commit where bots started failing. Not sure why.

cc: @vstinner

  • Issue: Reduce copies when reading files in pyio, match behavior of _io #129005

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cmaloney
Revert "pythongh-129005: _pyio.BufferedIO remove copy on readall (pyt…
c37b122
…hon#129454)"

This reverts commit e1c4ba9.
@bedevere-app bedevere-app Bot added the awaiting review label Jan 31, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Jan 31, 2025
Reduce copies when reading files in pyio, match behavior of _io #129005
Closed
@vstinner
vstinner merged commit 3ebe3d7 into python:main Jan 31, 2025
@bedevere-app bedevere-app Bot removed the awaiting review label Jan 31, 2025
@vstinner

vstinner commented Jan 31, 2025

Copy link
Copy Markdown
Member

Ok, let's revert until the issue is understood and fixed.

cmaloney reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Jan 31, 2025

Copy link
Copy Markdown
Member

Example of failure, PPC64LE Fedora Stable 3.x: https://buildbot.python.org/#/builders/90/builds/5505

ERROR: test_nonblock_pipe_write_bigbuf (test.test_io.PyMiscIOTest.test_nonblock_pipe_write_bigbuf)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 1250, in write
    self._flush_unlocked()
    ~~~~~~~~~~~~~~~~~~~~^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 1282, in _flush_unlocked
    raise BlockingIOError(
        errno.EAGAIN,
        "write could not complete without blocking", 0)
BlockingIOError: [Errno 11] write could not complete without blocking

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/test/test_io.py", line 4453, in _test_nonblock_pipe_write
    wf.write(msg)
    ~~~~~~~~^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 1258, in write
    raise BlockingIOError(e.errno, e.strerror, written)
BlockingIOError: [Errno 11] write could not complete without blocking

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 1250, in write
    self._flush_unlocked()
    ~~~~~~~~~~~~~~~~~~~~^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 1282, in _flush_unlocked
    raise BlockingIOError(
        errno.EAGAIN,
        "write could not complete without blocking", 0)
BlockingIOError: [Errno 11] write could not complete without blocking

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/test/test_io.py", line 4462, in _test_nonblock_pipe_write
    wf.write(msg)
    ~~~~~~~~^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 1258, in write
    raise BlockingIOError(e.errno, e.strerror, written)
BlockingIOError: [Errno 11] write could not complete without blocking

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/test/test_io.py", line 4421, in test_nonblock_pipe_write_bigbuf
    self._test_nonblock_pipe_write(16*1024)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/test/test_io.py", line 4446, in _test_nonblock_pipe_write
    with rf, wf:
             ^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 482, in __exit__
    self.close()
    ~~~~~~~~~~^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 1309, in close
    self.flush()
    ~~~~~~~~~~^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 1270, in flush
    self._flush_unlocked()
    ~~~~~~~~~~~~~~~~~~~~^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 1282, in _flush_unlocked
    raise BlockingIOError(
        errno.EAGAIN,
        "write could not complete without blocking", 0)
BlockingIOError: [Errno 11] write could not complete without blocking

======================================================================
ERROR: test_nonblock_pipe_write_smallbuf (test.test_io.PyMiscIOTest.test_nonblock_pipe_write_smallbuf)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 1250, in write
    self._flush_unlocked()
    ~~~~~~~~~~~~~~~~~~~~^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 1282, in _flush_unlocked
    raise BlockingIOError(
        errno.EAGAIN,
        "write could not complete without blocking", 0)
BlockingIOError: [Errno 11] write could not complete without blocking

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/test/test_io.py", line 4453, in _test_nonblock_pipe_write
    wf.write(msg)
    ~~~~~~~~^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 1258, in write
    raise BlockingIOError(e.errno, e.strerror, written)
BlockingIOError: [Errno 11] write could not complete without blocking

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 1250, in write
    self._flush_unlocked()
    ~~~~~~~~~~~~~~~~~~~~^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 1282, in _flush_unlocked
    raise BlockingIOError(
        errno.EAGAIN,
        "write could not complete without blocking", 0)
BlockingIOError: [Errno 11] write could not complete without blocking

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/test/test_io.py", line 4462, in _test_nonblock_pipe_write
    wf.write(msg)
    ~~~~~~~~^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 1258, in write
    raise BlockingIOError(e.errno, e.strerror, written)
BlockingIOError: [Errno 11] write could not complete without blocking

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/test/test_io.py", line 4427, in test_nonblock_pipe_write_smallbuf
    self._test_nonblock_pipe_write(1024)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/test/test_io.py", line 4446, in _test_nonblock_pipe_write
    with rf, wf:
             ^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 482, in __exit__
    self.close()
    ~~~~~~~~~~^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 1309, in close
    self.flush()
    ~~~~~~~~~~^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 1270, in flush
    self._flush_unlocked()
    ~~~~~~~~~~~~~~~~~~~~^^
  File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-ppc64le/build/Lib/_pyio.py", line 1282, in _flush_unlocked
    raise BlockingIOError(
        errno.EAGAIN,
        "write could not complete without blocking", 0)
BlockingIOError: [Errno 11] write could not complete without blocking
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cmaloney

cmaloney commented Jan 31, 2025

Copy link
Copy Markdown
Contributor Author

The test does a lot of writes until it blocks, catches that exception, then does a "readall" from the pipe (to get it so a write shouldn't block) followed by a small write of "BLOCKED" which is expected to never block. That write blocks, which raises an exception and gets the pile of stack traces. As the test exits, close / flush happens on each of the objects which tries to flush the buffers, resulting in more writes, which also block (and get to the full set of exceptions).

Makes it feel to me like either the .read() / .readall() isn't emptying the pipe, or the fact the pipe is no longer full isn't updating before the next write() occurs. Nothing concrete though. The shortcut made a bit faster, but I'm pretty sure _io.BufferedIO is still faster than _pyio.BufferedIO, and _io.BufferedIO is also run through this test...)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cmaloney
cmaloney deleted the revert_bufferedio_readall branch January 31, 2025 09:02
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Feb 7, 2025
@cmaloney @srinivasreddy
Revert "pythongh-129005: _pyio.BufferedIO remove copy on readall (pyt…
ae72910
…hon#129454)" (python#129500)

This reverts commit e1c4ba9.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@cmaloney @vstinner
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.