You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
area-pkgUsed for miscellaneous pkg/ packages not associated with specific area- teams.pkg-ddsFor issues related to the Dart Development Servicetype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)
The implementation does the following intermixing of async and sync code:
final history = (awaitgetStreamHistory(stream)).history;
Event? firstStreamEvent;
unawaited(streamEvents.peek.then((e) {
firstStreamEvent = e;
}));
for (final event in history) {
if (firstStreamEvent !=null&&
event.timestamp!> firstStreamEvent!.timestamp!) {
break;
}
Future.then is never executed synchronously (at least not for builtin implementation of Future) - which means firstStreamEvent is always null and the code does not do what it is expected to do.
Also the way code is written it leaves any errors thrown by peek unhandled instead of properly forwarding them into Stream returned by onEventWithHistory.
This was revealed when I tried adding code to properly close event streams when underlying VmService connection goes away. I have now undone this change because onEventWithHistory needs to be fixed first.
diff --git a/pkg/vm_service/lib/src/vm_service.dart b/pkg/vm_service/lib/src/vm_service.dart
index e14557b3bf3..a32c9f4915f 100644
--- a/pkg/vm_service/lib/src/vm_service.dart+++ b/pkg/vm_service/lib/src/vm_service.dart@@ -1890,6 +1890,9 @@ class VmService {
'Service connection disposed',
));
});
+ for (var controller in _eventControllers.values) {+ await controller.close();+ }
_outstandingRequests.clear();
final handler = _disposeHandler;
if (handler != null) {
The text was updated successfully, but these errors were encountered:
mraleph
added
area-pkg
Used for miscellaneous pkg/ packages not associated with specific area- teams.
pkg-dds
For issues related to the Dart Development Service
labels
May 5, 2025
area-pkgUsed for miscellaneous pkg/ packages not associated with specific area- teams.pkg-ddsFor issues related to the Dart Development Servicetype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)
The implementation does the following intermixing of async and sync code:
Future.then
is never executed synchronously (at least not for builtin implementation ofFuture
) - which meansfirstStreamEvent
is alwaysnull
and the code does not do what it is expected to do.Also the way code is written it leaves any errors thrown by
peek
unhandled instead of properly forwarding them intoStream
returned byonEventWithHistory
.This was revealed when I tried adding code to properly close event streams when underlying
VmService
connection goes away. I have now undone this change becauseonEventWithHistory
needs to be fixed first.The text was updated successfully, but these errors were encountered: