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

test_pty: test_openpty() timed out after 3h 20min on aarch64 RHEL8 Refleaks 3.x: #110673

Closed
vstinner opened this issue Oct 11, 2023 · 2 comments
Closed
Labels
tests Tests in the Lib/test dir

Comments

@vstinner
Copy link
Member

vstinner commented Oct 11, 2023

Is os.write(fd, data) guaranteed to write all bytes of data? Or can it write only some (first) bytes of data?

Extract of the test:

        debug("Writing chunked output")
        os.write(slave_fd, TEST_STRING_2[:5])
        os.write(slave_fd, TEST_STRING_2[5:])
        s2 = _readline(master_fd) # <==== HERE LINE 181 ===
        self.assertEqual(b'For my pet fish, Eric.\n', normalize_output(s2))

with:

def _readline(fd):
    """Read one line.  May block forever if no newline is read."""
    reader = io.FileIO(fd, mode='rb', closefd=False)
    return reader.readline()

aarch64 RHEL8 Refleaks 3.x:

3:22:48 load avg: 0.00 [467/467/1] test_pty worker non-zero exit code (Exit code 1)
beginning 6 repetitions
123456
/home/buildbot/buildarea/3.x.cstratak-RHEL8-aarch64.refleak/build/Lib/pty.py:95: DeprecationWarning: This process (pid=502171) is multi-threaded, use of forkpty() may lead to deadlocks in the child.
  pid, fd = os.forkpty()
hi there
./home/buildbot/buildarea/3.x.cstratak-RHEL8-aarch64.refleak/build/Lib/pty.py:95: DeprecationWarning: This process (pid=502171) is multi-threaded, use of forkpty() may lead to deadlocks in the child.
  pid, fd = os.forkpty()
Timeout (3:20:00)!
Thread 0x0000ffff9f154590 (most recent call first):
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-aarch64.refleak/build/Lib/test/test_pty.py", line 68 in _readline
  File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-aarch64.refleak/build/Lib/test/test_pty.py", line 181 in test_openpty
  (...)

build: https://buildbot.python.org/all/#/builders/551/builds/883

cc @serhiy-storchaka

Linked PRs

@vstinner vstinner added the tests Tests in the Lib/test dir label Oct 11, 2023
@vstinner
Copy link
Member Author

Old issue, 2017: #75341

My previous abandoned attempt in 2017 for "writeall" and "short write": #3037

Short read issue was discussed in #73256 and fixed by commit e6f62f6.

vstinner added a commit to vstinner/cpython that referenced this issue Oct 11, 2023
Add write_all() helper function to test_pty to raise an exception on
short write: if os.writes() does not write all bytes. It should not
happen for a PTY. Let's check if this assumption is correct.
vstinner added a commit to vstinner/cpython that referenced this issue Oct 11, 2023
Add write_all() helper function to test_pty to raise an exception on
short write: if os.writes() does not write all bytes. It should not
happen for a PTY.
vstinner added a commit that referenced this issue Oct 11, 2023
Add write_all() helper function to test_pty to raise an exception on
short write: if os.writes() does not write all bytes. It should not
happen for a PTY.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 11, 2023
Add write_all() helper function to test_pty to raise an exception on
short write: if os.writes() does not write all bytes. It should not
happen for a PTY.
(cherry picked from commit b4e8049)

Co-authored-by: Victor Stinner <vstinner@python.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 11, 2023
Add write_all() helper function to test_pty to raise an exception on
short write: if os.writes() does not write all bytes. It should not
happen for a PTY.
(cherry picked from commit b4e8049)

Co-authored-by: Victor Stinner <vstinner@python.org>
vstinner added a commit that referenced this issue Oct 12, 2023
gh-110673: test_pty raises on short write (GH-110677)

Add write_all() helper function to test_pty to raise an exception on
short write: if os.writes() does not write all bytes. It should not
happen for a PTY.
(cherry picked from commit b4e8049)

Co-authored-by: Victor Stinner <vstinner@python.org>
vstinner added a commit that referenced this issue Oct 12, 2023
gh-110673: test_pty raises on short write (GH-110677)

Add write_all() helper function to test_pty to raise an exception on
short write: if os.writes() does not write all bytes. It should not
happen for a PTY.
(cherry picked from commit b4e8049)

Co-authored-by: Victor Stinner <vstinner@python.org>
@vstinner
Copy link
Member Author

I only saw that bug once. I added raise Exception(f"short write: os.write(...)"). So if the bug occurs again, next time we will know if a short write occurred, or if it didn't, to make progress in the analysis.

For now, I close the issue.

Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Add write_all() helper function to test_pty to raise an exception on
short write: if os.writes() does not write all bytes. It should not
happen for a PTY.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir
Projects
None yet
Development

No branches or pull requests

1 participant