Open kenzieschmoll opened 1 year ago
For reference, what triggered this tweet was me debugging a command line.
For some reason, even though the main
of my command line had completed and all work had stopped, the program didn't actually end.
One workaround was to do the following:
void main() {
try {
await doSomething();
} finally {
exit(exitCode);
}
}
But that's of course not ideal, and debugging it is non-trivial.
If you're having issues with your process not terminating after returning from main
, you almost certainly have an open ReceivePort
somewhere in your program. You can find out where this port was allocated with a description and stack trace under VM Tools -> Isolates -> Open Ports
in DevTools (this requires the Enable VM developer mode
to be enabled in the settings).
As for tracking async operations, I'm concerned that this will result in a large performance hit as collecting stack traces for each Future
or Stream
allocation is very expensive, especially considering how common it is to allocate these types. Any sort of async operation tracing will need some significant design work and likely need to be placed behind a flag.
Fyi @christopherfujino
Fyi @christopherfujino
ahh yeah, thanks!
Nice, this helped me get a stacktrace for a bug that had been bothering me for months (the test runner hanging when a tools test would fail).
Perhaps this tool could be implemented by the community as a DevTools extension?
Support a way to see all the pending Streams/Futures with a stacktraces. Original request: https://twitter.com/remi_rousselet/status/1641763619502280707.