-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Merge StreamWriter and StreamReader into just asyncio.Stream #81070
Comments
The separation was a bad idea, sorry. Both classes are coupled too much.
The idea is:
|
Seeing a test_ayncio failure on koobs-freebsd-current: Timeout (0:25:00)! Some errors (warnings?) later in the re-run (which passes), may be related/indicative: Future exception was never retrieved
future: <Future finished exception=BrokenPipeError()>
Traceback (most recent call last):
File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/asyncio/subprocess.py", line 173, in _feed_stdin
await self.stdin.drain()
File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/asyncio/streams.py", line 1415, in drain
await self._protocol._drain_helper()
File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/asyncio/streams.py", line 594, in _drain_helper
await waiter
BrokenPipeError Full log attached |
Thanks for letting me know. |
test_stream_shutdown_hung_task_prevents_cancellation was added as part of this issue. Seems to be a random error : https://ci.appveyor.com/project/python/cpython/builds/24901585 ====================================================================== Traceback (most recent call last):
File "C:\projects\cpython\lib\asyncio\windows_events.py", line 453, in finish_recv
return ov.getresult()
OSError: [WinError 64] The specified network name is no longer available
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\projects\cpython\lib\test\test_asyncio\test_streams.py", line 1605, in test_stream_shutdown_hung_task_prevents_cancellation
self.loop.run_until_complete(test())
File "C:\projects\cpython\lib\asyncio\base_events.py", line 608, in run_until_complete
return future.result()
File "C:\projects\cpython\lib\test\test_asyncio\test_streams.py", line 1601, in test
await task
File "C:\projects\cpython\lib\test\test_asyncio\test_streams.py", line 1586, in client
self.assertEqual(b'', await stream.readline())
File "C:\projects\cpython\lib\asyncio\streams.py", line 1545, in readline
line = await self.readuntil(sep)
File "C:\projects\cpython\lib\asyncio\streams.py", line 1638, in readuntil
await self._wait_for_data('readuntil')
File "C:\projects\cpython\lib\asyncio\streams.py", line 1521, in _wait_for_data
await self._waiter
File "C:\projects\cpython\lib\asyncio\proactor_events.py", line 279, in _loop_reading
data = fut.result()
File "C:\projects\cpython\lib\asyncio\windows_events.py", line 808, in _poll
value = callback(transferred, key, ov)
File "C:\projects\cpython\lib\asyncio\windows_events.py", line 457, in finish_recv
raise ConnectionResetError(*exc.args)
ConnectionResetError: [WinError 64] The specified network name is no longer available |
Wow! Please let me work on it. |
@andrew That would be great, as having failing buildbots can hide new regressions that end up taking much longer to identify and fix as they are hidden, and is better for you than reverting implementation code |
FYI: since:
AIX bot 'hangs' during ctrl-c gives this (in case useful) == Tests result: INTERRUPTED == 1 test omitted: Total duration: 13 min 36 sec
Tests result: INTERRUPTED
/data/prj/python/git/python3-3.8/Lib/asyncio/base_events.py:646: ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>
_warn(f"unclosed event loop {self!r}", ResourceWarning, source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
Exception ignored in: <coroutine object StreamTests.test_sendfile.<locals>.test at 0x30576ed0>
Traceback (most recent call last):
File "/data/prj/python/git/python3-3.8/Lib/test/test_asyncio/test_streams.py", line 1643, in test
await do_connect(*srv.sockets[0].getsockname())
File "/data/prj/python/git/python3-3.8/Lib/asyncio/streams.py", line 314, in __aexit__
await self.close()
File "/data/prj/python/git/python3-3.8/Lib/asyncio/streams.py", line 292, in close
await tasks.wait([stream.close() for stream in streams])
File "/data/prj/python/git/python3-3.8/Lib/asyncio/streams.py", line 292, in <listcomp>
await tasks.wait([stream.close() for stream in streams])
File "/data/prj/python/git/python3-3.8/Lib/asyncio/streams.py", line 1382, in close
self._transport.close()
File "/data/prj/python/git/python3-3.8/Lib/asyncio/selector_events.py", line 680, in close
self._loop.call_soon(self._call_connection_lost, None)
File "/data/prj/python/git/python3-3.8/Lib/asyncio/base_events.py", line 711, in call_soon
self._check_closed()
File "/data/prj/python/git/python3-3.8/Lib/asyncio/base_events.py", line 504, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
/data/prj/python/git/python3-3.8/Lib/asyncio/streams.py:352: ResourceWarning: unclosed stream server <StreamServer>
_warn(f"unclosed stream server {self!r}",
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/data/prj/python/git/python3-3.8/Lib/asyncio/selector_events.py:684: ResourceWarning: unclosed transport <_SelectorSocketTransport fd=7>
_warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/data/prj/python/git/python3-3.8/Lib/asyncio/selector_events.py:684: ResourceWarning: unclosed transport <_SelectorSocketTransport closing fd=8>
_warn(f"unclosed transport {self!r}", ResourceWarning, source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback |
hmm - i had just synced with master. must have just missed something since there is a strike-out through #57460. If so, please ignore. BBL. |
Can this issue be closed now? |
Please keep it until new streams will be documented. |
Thanks, Karthikeyan! The only thing that needs to be documented is Stream class itself. |
Sure, I think I missed it somehow though you mentioned it's around combining StreamReader and StreamWriter and to have appropriate signatures for the methods. I will try to raise a PR this week. I also realize there are no docstrings for the new functions like connect, connect_read_pipe, connect_write_pipe etc. Is it worthy enough of adding them too in the PR? |
Yes, Stream doc should be a combination of StreamReader and StreamWriter with small changes/additions. Regarding docstrings: there is no strong requirement (we don't provide docstrings for all asyncio public API) but please don't hesitate to write them. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: