micropython / micropython/micropython-lib
[uasyncio] Trying to call aclose() twice on streams with the same underlying socket leads to exception
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.1k
- Avg merge
- 7d 6h
- Merged PRs (30d)
- 3
Description
reader, writer = await asyncio.open_connection(hostname, port)
# sending and receiving
await reader.aclose()
await writer.aclose()
Traceback (most recent call last):
File "client.py", line 28, in <module>
File "/Users/danni/.micropython/lib/uasyncio/core.py", line 112, in run_until_complete
File "/Users/danni/.micropython/lib/uasyncio/core.py", line 104, in run_forever
File "/Users/danni/.micropython/lib/uasyncio/core.py", line 89, in run_forever
File "/Users/danni/.micropython/lib/uasyncio/__init__.py", line 28, in remove_reader
KeyError: <value>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the two-close sequence, then inspect uasyncio/core.py and uasyncio/init.py around the reader-removal path shown in the traceback. Check how reader and writer share the socket and verify that closing both in sequence completes without a KeyError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100