Skip to content

test_ftplib: test_storlines() fails randomly #109845

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

Closed
vstinner opened this issue Sep 25, 2023 · 4 comments
Closed

test_ftplib: test_storlines() fails randomly #109845

vstinner opened this issue Sep 25, 2023 · 4 comments
Assignees
Labels
tests Tests in the Lib/test dir

Comments

@vstinner
Copy link
Member

vstinner commented Sep 25, 2023

s390x RHEL7 Refleaks 3.x:

0:00:19 load avg: 3.25 [ 17/463/1] test_ftplib failed (1 failure)
beginning 6 repetitions
123456
..test test_ftplib failed -- Traceback (most recent call last):
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.refleak/build/Lib/test/test_ftplib.py", line 634, in test_storlines
    self.check_data(self.server.handler_instance.last_received_data, RETR_DATA)
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.refleak/build/Lib/test/test_ftplib.py", line 505, in check_data
    self.assertEqual(len(received), len(expected))
AssertionError: 12019 != 12018

build: https://buildbot.python.org/all/#/builders/129/builds/890

I can reproduce the failure locally on Linux with command:

vstinner@mona$ ./python -m test test_ftplib -m test_storlines -u all -j10 --forever -R 3:3 
(...)
0:00:10 load avg: 24.24 [ 11/1] test_ftplib failed (1 failure)
beginning 6 repetitions
123456
..test test_ftplib failed -- Traceback (most recent call last):
  File "/home/vstinner/python/main/Lib/test/test_ftplib.py", line 634, in test_storlines
    self.check_data(self.server.handler_instance.last_received_data, RETR_DATA)
  File "/home/vstinner/python/main/Lib/test/test_ftplib.py", line 505, in check_data
    self.assertEqual(len(received), len(expected))
AssertionError: 12019 != 12018

Linked PRs

@vstinner vstinner added the tests Tests in the Lib/test dir label Sep 25, 2023
@serhiy-storchaka serhiy-storchaka self-assigned this Sep 26, 2023
@serhiy-storchaka
Copy link
Member

I found the cause and am writing a fix.

@vstinner
Copy link
Member Author

vstinner commented Sep 26, 2023

I looked at the issue but I didn't see anything obvious 🤷🏻‍♂️ Also, I got scared when I saw that the server is implemented with asyncore, the zombie module 😱

serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Sep 26, 2023
recv() can return partial data cut in the middle of a multibyte
character. Test raw binary data instead of data incorrectly decoded by parts.
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Sep 26, 2023
recv() can return partial data cut in the middle of a multibyte
character. Test raw binary data instead of data incorrectly decoded by parts.
@serhiy-storchaka
Copy link
Member

Other unstable tests are test_storbinary and test_encoding_param.

I changed also test_retrbinary, test_retrbinary_rest and test_transfer which potentially can fail for same reason, although I cannot reproduce this.

serhiy-storchaka added a commit that referenced this issue Sep 26, 2023
recv() can return partial data cut in the middle of a multibyte
character. Test raw binary data instead of data incorrectly decoded by parts.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Sep 26, 2023
…9912)

recv() can return partial data cut in the middle of a multibyte
character. Test raw binary data instead of data incorrectly decoded by parts.
(cherry picked from commit 2ef2fff)

Co-authored-by: Serhiy Storchaka <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Sep 26, 2023
…9912)

recv() can return partial data cut in the middle of a multibyte
character. Test raw binary data instead of data incorrectly decoded by parts.
(cherry picked from commit 2ef2fff)

Co-authored-by: Serhiy Storchaka <[email protected]>
serhiy-storchaka added a commit that referenced this issue Sep 26, 2023
…GH-109920)

recv() can return partial data cut in the middle of a multibyte
character. Test raw binary data instead of data incorrectly decoded by parts.
(cherry picked from commit 2ef2fff)

Co-authored-by: Serhiy Storchaka <[email protected]>
csm10495 pushed a commit to csm10495/cpython that referenced this issue Sep 28, 2023
…9912)

recv() can return partial data cut in the middle of a multibyte
character. Test raw binary data instead of data incorrectly decoded by parts.
@vstinner
Copy link
Member Author

Thanks for the fix @serhiy-storchaka.

Yhg1s pushed a commit that referenced this issue Oct 2, 2023
…#109919)

gh-109845: Make test_ftplib more stable under load (GH-109912)

recv() can return partial data cut in the middle of a multibyte
character. Test raw binary data instead of data incorrectly decoded by parts.
(cherry picked from commit 2ef2fff)

Co-authored-by: Serhiy Storchaka <[email protected]>
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
…9912)

recv() can return partial data cut in the middle of a multibyte
character. Test raw binary data instead of data incorrectly decoded by parts.
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

2 participants