Files
sdk/runtime/tests
Vyacheslav Egorov 090c07ad1f [vm] Improve unwinding for Future.timeout
Make unwinding follow the awaiter link attached to the timeout handler,
which allows it to continue past the asynchronous gap into the
corresponding listeners. This significantly improves the stack trace:
for example a timing out `await Socket.connect()` now produces:

    SocketException: Connection timed out, ...
    _NativeSocket.connect.<anonymous closure>.<anonymous closure>
    _RootZone.run (dart:async/zone.dart:1655:54)
    Future.timeout.<anonymous closure>
    <asynchronous suspension>
    _RawSocket.connect.<anonymous closure>
    <asynchronous suspension>
    Socket._connect.<anonymous closure>
    <asynchronous suspension>
    main
    <asynchronous suspension>

Where without this change it produced:

    SocketException: Connection timed out, ...
    _NativeSocket.connect.<anonymous closure>.<anonymous closure>
    _RootZone.run
    Future.timeout.<anonymous closure>
    Timer._createTimer.<anonymous closure>
    _Timer._runTimers
    _Timer._handleMessage
    _RawReceivePort._handleMessage

Which is much less informative.

TEST=vm/dart/awaiter_stacks

Fixes https://github.com/dart-lang/sdk/issues/56431

Change-Id: If4798e9e216ed88480a2b2b91ad6fa13dcb14ca4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/380982
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2024-08-19 06:52:34 +00:00
..