Comments (7)
Ok, I figured it out. Strange that this hasn't come up before. What happens here is that AnyIO's stream protocol signals about the EOF simply by setting the receive event, but if there's also data in the buffer, the receive()
call just reads the data and clears the flag, thus erasing any evidence of the EOF condition.
from anyio.
Could you review the PR that fixes it? That would help.
from anyio.
For reference, what does the synchronous Python server implementation look like?
from anyio.
Curiously, this works fine with the trio
backend.
from anyio.
I now have a regression test that fails on asyncio and passes on trio.
from anyio.
Thanks @agronholm, that was way too fast for me to answer or provide more code :) I think it is not relevant anymore, but before I was using a more basic example without the TextReceiveStream
wrapper, like in the documentation. It had the same issue.
from anyio.
Could you review the PR that fixes it? That would help.
Did that, and adjusted the example in case somebody does copy-paste, because TextReceiveStream does iterate lines.
from anyio.
Related Issues (20)
- Stricter typing for `TaskGroup.start()` HOT 1
- Cancelling a TaskGroup in which a task is starting all also cancel the TaskGroup in which it is due to run HOT 4
- [pytest] support keeping event loop for higher scope HOT 10
- Restore signal handlers at the end of `open_signal_receiver`. HOT 3
- service name not available for the specified socket type HOT 19
- RuntimeError when using Ctrl+C while awaiting a task using `await TaskGrup.start()` HOT 5
- 100% CPU load after cancel HOT 13
- run_process fails when running from .exe console_script entrypoint on windows HOT 2
- Different cancel scope behaviour on asyncio vs Trio HOT 2
- Hypothesis tests that are class members are passed self twice HOT 1
- Using `request.getfixturevalue` triggers errors "This event loop is already running" HOT 1
- Raising an error inside a task of a task group can produce: `RuntimeError: called 'started' twice on the same task status` HOT 7
- Cancelling `TaskGroup.start()` cancels `TaskGroup` itself (only for `asyncio` backend) HOT 4
- anyio is unexpectedly cancelling tasks HOT 6
- Provide async `getfixturevalue()` method on anyio
- run_sync_in_worker_thread hangs when 2 calls made in quick succession HOT 2
- MemoryObjectStream can drop items when the receiving end is cancelled HOT 7
- `MemoryObjectSendStream.send(item)` doesn't raise `BrokenResourceError` when the last receive stream is closed if `item` is falsey
- Test failures with Python 3.13.0b1 in 4.4.0 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anyio.