Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
bpo-47015: Update test_os from asyncore to asyncio#31876
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
arhadthedev commented Mar 14, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
ae7f8bb to 815cc75Comparearhadthedev commented Mar 15, 2022
Note to myself: despite
, it creates an IPv6-only listening socket if possible. As a result, not only Now, I'm sorting out what and why leaks all connected sockets (as Address sanitizer reports) failing all non-Windows runners:
|
f106b3a to 0e19efbCompare0e19efb to 04cd9eeCompare04cd9ee to df82a87Comparedf82a87 to 9882dafComparearhadthedev commented Mar 18, 2022
The failure was a combination of client-side blocking wait of a server and a missing asyncio loop policy. Both problems are fixed. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
bedevere-bot commented Mar 18, 2022
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase And if you don't make the requested changes, you will be poked with soft cushions! |
Without the grouping, reading code as a prose becomes harder: > Start the server. For a client, create a socket, set it nonblocking, > get a server name that is a name of its listening port, connect to the > server. instead of: > Start the server, its name is a name of its listening port. For > a client, create a socket, set it nonblocking, connect to the server.
| deftearDownModule(): | ||
| asyncio.set_event_loop_policy(None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line that set a loop policy is not present any more, so this cleanup step doesn’t seem to apply anymore.
arhadthedevMar 19, 2022 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand a failed pre-policy run correctly, the policy must either be manually set to something before any case is runned or be returned back to None before the suit exits. I've chosen the first variant, Andrew proposed to switch to the second.
0:04:29 load avg: 3.56 [300/433/1] test_os failed (env changed) -- running: test_asyncio (1 min 10 sec), test_concurrent_futures (1 min 57 sec) [a bunch of oks and skips follow] [...] 423 tests OK. 10 slowest tests: - test_tools: 4 min 44 sec - test_concurrent_futures: 3 min 30 sec - test_peg_generator: 2 min 57 sec - test_multiprocessing_spawn: 2 min 27 sec - test_gdb: 1 min 51 sec - test_asyncio: 1 min 50 sec - test_multiprocessing_forkserver: 1 min 38 sec - test_multiprocessing_fork: 1 min 22 sec - test_regrtest: 1 min 12 sec - test_statistics: 49.1 sec 1 test altered the execution environment: test_os 9 tests skipped: test_devpoll test_ioctl test_kqueue test_msilib test_startfile test_winconsoleio test_winreg test_winsound test_zipfile64 Total duration: 11 min 50 sec Tests result: ENV CHANGED make: *** [Makefile:1795: buildbottest] Error 3 Error: Process completed with exit code 2. bedevere-bot commented Mar 19, 2022
asvetlov commented Mar 19, 2022
LGTM. Let's wait for the buildbots fleet to finish to make sure that everything works smoothly. |
arhadthedev commented Mar 19, 2022
@asvetlov I fixed a forgotten The second runner, ARM64 macOS, failed on
Considering that the failed |
arhadthedev commented Mar 19, 2022
GitHub Ubuntu runner failed with |
asvetlov commented Mar 19, 2022
I see. Test failures seem unrelated. |
bedevere-bot commented Mar 19, 2022
asvetlov commented Mar 20, 2022
Merged. Thanks! |
PEP 594 – Removing dead batteries from the standard library removes asyncore and asynchat in 3.12 with the following note:
However, the citation misses the tests for
os. So this PR portstest_os.TestSendfileas the only class that uses asyncore to create a dummy sendfile server and communicate with it.To simplify the review I broke all changes into a few commits to get readable diffs:
TestCasetoIsolatedAsyncioTestCaseos.sendfileasync-friendly by moving it into a worker thread to not block an event loop of IsolatedAsyncioTestCase. As a result,sendfile_wrapperthat called it is also made asyncby
IsolatedAsyncioTestCaseis counted as a test failure (this commit is actually the last)SendfileTestServerwithasyncio.start_server. The client side is left mostly untouched becauseos.sendfileworks directly with a low-level socket ignoring asyncio message loop anyway. "Mostly" becauseconnectis delegated to an event loop to not block the server in the same thread220 ready. Instead, we use a guarantee thatasyncio.loop.sock_connectyields only after establishing a connectionSendfileTestServerwith related asyncio importsasyncio.to_threadmaintains its own threading machinery)https://bugs.python.org/issue47015