-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Cancelling Async Generator Hangs Indefinitely #59793
Comments
Summary: Async generator using |
Interestingly if you modify the reproducer to be
The generator shuts down once In particular
|
That seems to be correct and expected behavior. You have an The spec text is descriptive. Being "passivated" is presumably it being waiting at a The effect of cancelling an |
Ok, it's a little odd to me that cancellation wouldn't be preemptive, but if that is the way it is that's the way it is. My challenge is the stream corresponds to a network request, and with this behaviour there is no way to cancel it until the server sends more data. Is there some alternative cancellation mechanism, or is it simply a case of generators can't be used here? Unless I'm missing something this makes generators a potential gold mine for resource leaks, which should probably be called out as a big warning, unless this behaviour can be changed? |
Problem
Given the following stream
If we then wrap this in
Everything works correctly
Prints as expected
If, however, we change watch to be
Cancellation hangs indefinitely.
The specification has the following to say on the topic.
I'm not entirely sure what passivated means, but I think hanging indefinitely is at least not an obvious behaviour if it is intentional.
Platform
I have tested this on Linux (flutter), Android (flutter) and DartPad and the behaviour seems to be consistent
The text was updated successfully, but these errors were encountered: