-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Async stack unwinding does not properly unwind a stack through Future<List<T>> get wait
#59730
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
Comments
Summary: User reports |
Future<List<T>> get wait
is not doing his job properlyFuture<List<T>> get wait
The exception itself is caught, but the debugger is treating it as uncaught. That happens quite often in async code because the only reliable way to figure out if exception will bubble through or not is to run |
Suggestions for Improvement:
@mraleph what are your thoughts on these propositions? |
That they are generated by some LLM and as such neither wrong nor right. Just saying words which kinda make sense together, but not truly showing any knowledge or comprehension. The actual fix is here: https://dart-review.googlesource.com/c/sdk/+/401062 |
@mraleph LLM rephrases my words because I'm not good at writing and wrote something too long. I have limited knowledge of the issue, I was expecting the debugger to be able to know the "Await Stack" like regular synchronous code. I'm glad you were able to find a solution. What approach did you use? Refining the Heuristics? |
The solution was to slightly rewrite Dart |
@mraleph, thanks for finding a solution so rapidly. I have a limited understanding of this subject, but because the Dart runtime can associate the right future/exception with the right try-catch, would it make sense to share this flow graph with the debugger? |
@stephane-archer Sorry for the delayed response. The problem is that there is no true "flow graph" - at least not in a pure form. There is a maze of boxes ( That's why async unwinding is so complicated and unreliable - the async stack does not exist in "declarative" form (e.g. as a list of frames or even as a graph of connected computations), it is very imperative. You need to run the code to determine what will happen. To reliably figure out where exception lands (and whether it will be caught or not) you need to actually run the code and see. Async unwinding tries to compensate for that - but it might fail. That being said: both debugger logic and |
@mraleph Thanks for taking the time to explain this |
When executing this code an Uncaught exception happens at the end of the function but all futures have been await using `await futures.wait;
I think
Future<List<T>> get wait
is not doing his job properlySee screenshots for execution:
The text was updated successfully, but these errors were encountered: